public emailSummary GetEmailSummary() { emailSummary summary = new emailSummary(); using (SqlConnection DBCon = new SqlConnection(connectionString)) { SqlCommand CmdSelect = new SqlCommand("get_email_summary", DBCon); CmdSelect.CommandType = CommandType.StoredProcedure; CmdSelect.Connection = DBCon; DBCon.Open(); SqlDataReader rd = CmdSelect.ExecuteReader(); if (rd.HasRows) { while (rd.Read()) { summary.AwaitingToSent = Convert.ToInt32((!DBNull.Value.Equals(rd["AwaitingToSent"])) ? rd["AwaitingToSent"].ToString() : "0"); //entity.tbl_email_awaiting.Where(a => a.int_status == 0).Count(); summary.AwaitingToSentfaild = Convert.ToInt32((!DBNull.Value.Equals(rd["AwaitingToSentfaild"])) ? rd["AwaitingToSentfaild"].ToString() : "0"); //entity.tbl_email_awaiting.Where(a => a.int_status == -1 && a.int_failed_count < faildCount).Count(); summary.SendFail = Convert.ToInt32((!DBNull.Value.Equals(rd["SendFail"])) ? rd["SendFail"].ToString() : "0"); //entity.tbl_email_awaiting.Where(a => a.int_status == -1 && a.int_failed_count == faildCount).Count(); summary.SuccessfullySent = Convert.ToInt32((!DBNull.Value.Equals(rd["SuccessfullySent"])) ? rd["SuccessfullySent"].ToString() : "0"); //entity.tbl_email_awaiting.Where(a => a.int_status == 255).Count(); summary.InProcessOfSending = Convert.ToInt32((!DBNull.Value.Equals(rd["InProcessOfSending"])) ? rd["InProcessOfSending"].ToString() : "0"); //entity.tbl_email_awaiting.Where(a => a.int_status == 2).Count(); } } } return(summary); }
public emailSummary GetEmailSummary() { emailSummary summary = new emailSummary(); using (SqlConnection DBCon = new SqlConnection(connectionString)) { SqlCommand CmdSelect = new SqlCommand("get_email_summary", DBCon); CmdSelect.CommandType = CommandType.StoredProcedure; CmdSelect.Connection = DBCon; DBCon.Open(); SqlDataReader rd = CmdSelect.ExecuteReader(); if (rd.HasRows) { while (rd.Read()) { summary.AwaitingToSent = Convert.ToInt32((!DBNull.Value.Equals(rd["AwaitingToSent"])) ? rd["AwaitingToSent"].ToString() : "0"); //entity.tbl_email_awaiting.Where(a => a.int_status == 0).Count(); summary.AwaitingToSentfaild = Convert.ToInt32((!DBNull.Value.Equals(rd["AwaitingToSentfaild"])) ? rd["AwaitingToSentfaild"].ToString() : "0"); //entity.tbl_email_awaiting.Where(a => a.int_status == -1 && a.int_failed_count < faildCount).Count(); summary.SendFail = Convert.ToInt32((!DBNull.Value.Equals(rd["SendFail"])) ? rd["SendFail"].ToString() : "0"); //entity.tbl_email_awaiting.Where(a => a.int_status == -1 && a.int_failed_count == faildCount).Count(); summary.SuccessfullySent = Convert.ToInt32((!DBNull.Value.Equals(rd["SuccessfullySent"])) ? rd["SuccessfullySent"].ToString() : "0"); //entity.tbl_email_awaiting.Where(a => a.int_status == 255).Count(); summary.InProcessOfSending = Convert.ToInt32((!DBNull.Value.Equals(rd["InProcessOfSending"])) ? rd["InProcessOfSending"].ToString() : "0"); //entity.tbl_email_awaiting.Where(a => a.int_status == 2).Count(); } } } return summary; }
public void FillStatus() { dbHelper helper = new dbHelper(); summary = helper.GetEmailSummary(); }