المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : if someone could help me identify the problem please. [modified]



C# Programming
07-23-2009, 09:50 PM
Here is my Code

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Data.Odbc;
using My;
using System.Data;

namespace FirstCitizensBank_DropOffReport
{
class Program : MyGeneral
{
public static string dataBasePath;
public static string dbname;
public static string strconn;
static void Main(string[] args)
{
StartUp("", "", true);
dataBasePath = ConfigPath + "Empathic\\FirstCit\\";
dbname = "Bank";
strconn = "";


try
{
string repname = dataBasePath + "Reports\\Dropoff" + myDate.ToString("yyyyMMdd") + ".xls";

DateTime enddate = myDate.AddDays(-myDate.Day);
DateTime startdate = enddate.AddDays(1).AddMonths(-1);
MyWriteExcel exl = new MyWriteExcel(repname, dataBasePath + "Reports\\Templates\\DropoffTemp.xls");

//dbname = dbname + myDate.ToString("yyMM");
//WriteMonth(ref exl, startdate, enddate, "B");

enddate = startdate.AddDays(-1);
//startdate = startdate.AddMonths(-1);
dbname = "Bank";
dbname = dbname + myDate.AddMonths(-1).ToString("yyMM");
WriteMonth(ref exl, startdate, enddate, "C");

enddate = startdate.AddDays(-1);
startdate = startdate.AddMonths(-2);
dbname = "Bank";
dbname = dbname + myDate.AddMonths(-2).ToString("yyMM");
WriteMonth(ref exl, startdate, enddate, "D");

exl.Save();
exl.Close();

MyEmail email = new MyEmail("", "First Citizens Bank Dropoff Report", "Please see attached report");
email.AddAttachment(repname);
email.AddBCC(CommonEmail);
email.sendEmail();

endProgram();
}
catch (Exception e)
{
WriteToLog("@Failed: " + e.ToString());

HelpPage(e.ToString(), "Failed");
}

}

public static void WriteMonth(ref MyWriteExcel exl, DateTime startdate, DateTime enddate, string column)
{
string sql = "select count(*) as total, sum(iif(mid(CALLSTATUS, 1, 2) >= '06', 1, 0)) as entered, sum(iif(DONE is not null, 1, 0)) as completed"
+ " from " + dbname + " where startdate >= " + startdate.ToString("yyyyMMdd") + " and startdate = " + startdate.ToString("yyyyMMdd") + " and startdate = " + startdate.ToString("yyyyMMdd") + " and startdate = " + startdate.ToString("yyyyMMdd") + " and startdate