protected void drlCampaign_SelectedIndexChanged(object sender, EventArgs e) { int readMail = 0; try { srBUS = new SendRegisterBUS(); srdBus = new SendRegisterDetailBUS(); sendContentBus = new SendContentBUS(); mgBus = new MailGroupBUS(); int sendId = int.Parse(drlCampaign.SelectedValue.ToString()); DataTable campain = srdBus.GetByID(sendId); DataTable errSend = srdBus.GetByStatus(false, sendId); DataTable unreceve = srdBus.GetByNotReceve(sendId); int err = errSend.Rows.Count; this.lblTotalMailSend.Text = campain.Rows.Count.ToString(); int notreceve = unreceve.Rows.Count; lblEmailSend.Text = new MailConfigBUS().GetByID(int.Parse(srBUS.GetByID(sendId).Rows[0]["mailconfigid"]+"")).Rows[0]["eMail"].ToString(); if (campain.Rows.Count > 0) { foreach (DataRow row in campain.Rows) { if (row["isOpenMail"].ToString() == "True") { readMail++; } } lblNotOpen2.Text = (campain.Rows.Count - readMail).ToString(); } lblNotOpen2.Text = "0"; lblOpened.Text = readMail.ToString(); DataTable sendregisteDetail = srBUS.GetByID(sendId); if (sendregisteDetail.Rows.Count > 0) { int contentID = int.Parse(sendregisteDetail.Rows[0]["SendContentId"].ToString()); lblDateStart.Text = sendregisteDetail.Rows[0]["StartDate"].ToString(); lblDateEnd.Text = sendregisteDetail.Rows[0]["EndDate"].ToString(); int groupSend = int.Parse(sendregisteDetail.Rows[0]["GroupTo"].ToString()); if (groupSend == -3) lblGroupEmailTo.Text = "Tất cả"; else lblGroupEmailTo.Text = mgBus.GetByID(groupSend).Rows[0]["Name"].ToString(); if (sendContentBus.GetByID(contentID).Rows.Count > 0) { lblCampianName.Text = sendContentBus.GetByID(contentID).Rows[0]["Subject"].ToString(); } } if (campain.Rows.Count > 0) CreateChart(campain.Rows.Count, err, readMail, 1, notreceve, lblCampianName.Text); else lblChart.Text = ""; LoadOpenEmail(sendId); } catch (Exception ex) { //pnError.Visible = true; //lblError.Text = ex.Message; } }
protected void loadListContentHasSend() { try { int groupId = int.Parse(Request.Params["groupId"]); PartSendBUS psBus = new PartSendBUS(); SendContentBUS scBus = new SendContentBUS(); MailGroupBUS mgBus = new MailGroupBUS(); DataTable tblPartSend = psBus.GetByUserIdAndGroupId(getUserLogin().UserId, groupId); if (tblPartSend.Rows.Count > 0) { string hasContentSend = tblPartSend.Rows[0]["hasContentSend"].ToString(); string[] arrayContentSend = hasContentSend.Split(','); dlContentList.DataSource = arrayContentSend; dlContentList.DataBind(); for (int i = 0; i < arrayContentSend.Length; i++) { Label lblSubject = (Label)dlContentList.Items[i].FindControl("lblSubject"); Label lblContent = (Label)dlContentList.Items[i].FindControl("lblContent"); string contentId = arrayContentSend[i]; DataTable tblContent = scBus.GetByID(int.Parse(contentId)); if (tblContent.Rows.Count > 0) { lblSubject.Text = tblContent.Rows[0]["Subject"].ToString(); lblContent.Text = tblContent.Rows[0]["Body"].ToString(); } } } DataTable tblMailGroup = mgBus.GetByID(groupId); if (tblMailGroup.Rows.Count > 0) { lblGroupName.Text = tblMailGroup.Rows[0]["Name"].ToString(); } } catch (Exception) { throw; } }
protected string LoadChart(object id) { int readMail = 0; try { //int i=0; for (int i = 0; i < dlContentSendEvent.Items.Count; i++) { HiddenField hdfId = (HiddenField)dlContentSendEvent.Items[i].FindControl("hdfId"); if (hdfId.Value + "" == id + "") { SendRegisterBUS srBUS = new SendRegisterBUS(); SendRegisterDetailBUS srdBus = new SendRegisterDetailBUS(); SendContentBUS sendContentBus = new SendContentBUS(); MailGroupBUS mgBus = new MailGroupBUS(); int sendId = int.Parse(id + ""); DataTable campain = srdBus.GetByContentID(sendId); DataTable errSend = srdBus.GetContentSendEventDetailByStatus(false, sendId); DataTable unreceve = srdBus.GetByNotReceve(sendId); int err = errSend.Rows.Count; Label lblTotalMailSend = (Label)dlContentSendEvent.Items[i].FindControl("lblTotalMailSend"); Label lblEmailSend = (Label)dlContentSendEvent.Items[i].FindControl("lblEmailSend"); Label lblNotOpen2 = (Label)dlContentSendEvent.Items[i].FindControl("lblNotOpen2"); Label lblOpened = (Label)dlContentSendEvent.Items[i].FindControl("lblOpened"); Label lblDateStart = (Label)dlContentSendEvent.Items[i].FindControl("lblDateStart"); Label lblDateEnd = (Label)dlContentSendEvent.Items[i].FindControl("lblDateEnd"); Label lblGroupEmailTo = (Label)dlContentSendEvent.Items[i].FindControl("lblGroupEmailTo"); Label lblCampianName = (Label)dlContentSendEvent.Items[i].FindControl("lblCampianName"); Label lblChart = (Label)dlContentSendEvent.Items[i].FindControl("lblChart"); lblTotalMailSend.Text = campain.Rows.Count.ToString(); int notreceve = unreceve.Rows.Count; if (campain.Rows.Count > 0) { lblEmailSend.Text = campain.Rows[0]["MailSend"].ToString(); foreach (DataRow row in campain.Rows) { if (row["isOpenMail"].ToString() == "True") { readMail++; } } lblNotOpen2.Text = (campain.Rows.Count - readMail).ToString(); } lblOpened.Text = readMail.ToString(); DataTable sendregisteDetail = cseBus.GetById(sendId); if (sendregisteDetail.Rows.Count > 0) { int contentID = int.Parse(sendregisteDetail.Rows[0]["id"].ToString()); //lblDateStart.Text = sendregisteDetail.Rows[0]["StartDate"].ToString(); //lblDateEnd.Text = sendregisteDetail.Rows[0]["EndDate"].ToString(); int groupSend = int.Parse(sendregisteDetail.Rows[0]["GroupTo"].ToString()); if (groupSend == -3) lblGroupEmailTo.Text = "Tất cả"; else lblGroupEmailTo.Text = mgBus.GetByID(groupSend).Rows[0]["Name"].ToString(); if (sendContentBus.GetByID(contentID).Rows.Count > 0) { lblCampianName.Text = sendContentBus.GetByID(contentID).Rows[0]["Subject"].ToString(); } } CreateChart(campain.Rows.Count, err, readMail, 1, notreceve, lblCampianName.Text, lblChart); } } } catch (Exception ex) { pnError.Visible = true; lblError.Text = ex.Message; } return ""; }
protected void LoadEventReport() { try { mailGroupBus = new MailGroupBUS(); eventDetailBus = new EventDetailBUS(); UserLoginDTO userLogin = getUserLogin(); DataTable dtGroup = new DataTable(); int eventID = int.Parse(drlNhomMail.SelectedValue.ToString()); dtGroup = mailGroupBus.GetMailGroupByEventId(eventID); rptGroup.DataSource = dtGroup; rptGroup.DataBind(); for (int i = 0; i < dtGroup.Rows.Count; i++) { DataRow rowGroup = dtGroup.Rows[i]; int groupId = int.Parse(rowGroup["Id"].ToString()); DataTable dtEventByGroup = eventDetailBus.GetByGroupIdNew(groupId, eventID); if (dtEventByGroup.Rows.Count > 0) { Label lblGroupName = (Label)rptGroup.Items[i].FindControl("lblGroupName"); lblGroupName.Text = rowGroup["Name"].ToString() + " ( Có " + dtEventByGroup.Rows.Count + " khách hàng đăng ký )"; } if (dtEventByGroup.Rows.Count > 0) { DataList dlEventRegister = (DataList)rptGroup.Items[i].FindControl("dlEventRegister"); dlEventRegister.DataSource = dtEventByGroup; dlEventRegister.DataBind(); for (int j = 0; j < dtEventByGroup.Rows.Count; j++) { DataRow rowEventDetail = dtEventByGroup.Rows[j]; Label lblEmail = (Label)dlEventRegister.Items[j].FindControl("lblEmail"); lblEmail.Text = rowEventDetail["EmailID"].ToString(); Label lblName = (Label)dlEventRegister.Items[j].FindControl("lblName"); lblName.Text = (rowEventDetail["FullName"].ToString() == null) ? "Không có" : rowEventDetail["FullName"].ToString(); Label lblAddress = (Label)dlEventRegister.Items[j].FindControl("lblAddress"); lblAddress.Text = (rowEventDetail["Address"].ToString() == "") ? "Không có" : rowEventDetail["Address"].ToString(); Label lblCreateDate = (Label)dlEventRegister.Items[j].FindControl("lblCreateDate"); lblCreateDate.Text = rowEventDetail["CreateDate"].ToString(); Label lblGroup = (Label)dlEventRegister.Items[j].FindControl("lblGroupName"); lblGroup.Text = rowGroup["Name"].ToString();//Lay tu group ben tren Label lblEvent = (Label)dlEventRegister.Items[j].FindControl("lblEvent"); lblEvent.Text = rowEventDetail["EventId"].ToString(); } } LoadReport(eventID); } } catch (Exception ex) { logs.Error(userLogin.Username + "EventReport - LoadEventReport", ex); } }
private void InitBUS() { ulBus = new UserLoginBUS(); mgBUS = new MailGroupBUS(); srBUS = new SendRegisterBUS(); ctBUS = new CustomerBUS(); dgBUS = new DetailGroupBUS(); }
private void InitBUS() { ctBUS = new CustomerBUS(); mgBUS = new MailGroupBUS(); srBUS = new SendRegisterBUS(); dtgBUS = new DetailGroupBUS(); }
protected void getRegisterSendList() { try { cateBUs = new CategoryBUS(); srBUS = new SendRegisterBUS(); srdBus = new SendRegisterDetailBUS(); mailConfigBus = new MailConfigBUS(); mailGroupBus = new MailGroupBUS(); sendContentBus = new SendContentBUS(); dsgBus = new DetailGroupBUS(); UserLoginDTO userLogin = getUserLogin(); DataTable tblSendRegister = new DataTable(); if (userLogin.DepartmentId == 1) { tblSendRegister = srBUS.GetAll(); } else { tblSendRegister = srBUS.GetAll(userLogin.UserId); } if (tblSendRegister.Rows.Count > 0) { dlWaitSend.DataSource = tblSendRegister; dlWaitSend.DataBind(); for (int i = 0; i < tblSendRegister.Rows.Count; i++) { try { DataRow row = tblSendRegister.Rows[i]; int Sendtype = int.Parse(row["Sendtype"].ToString()); HiddenField hdfId = (HiddenField)dlWaitSend.Items[i].FindControl("hdfId"); hdfId.Value = row["Id"].ToString(); int contentId = int.Parse(row["SendContentId"].ToString()); //DataTable tblContent = sendContentBus.GetByID(contentId); Label lblSubject = (Label)dlWaitSend.Items[i].FindControl("lblSubject"); //if (tblContent.Rows.Count > 0) //{ // lblSubject.Text = tblContent.Rows[0]["Subject"].ToString(); //} //else lblSubject.Text = row["Subject"] + ""; int mailConfig = int.Parse(row["MailConfigID"].ToString()); DataTable tblMailConfig = mailConfigBus.GetByID(mailConfig); if (tblMailConfig.Rows.Count > 0) { Label lblMailConfig = (Label)dlWaitSend.Items[i].FindControl("lblMailConfig"); lblMailConfig.Text = tblMailConfig.Rows[0]["Email"].ToString(); } int groupTo = int.Parse(row["GroupTo"].ToString()); if (groupTo == -3) { Label lblGroupTo = (Label)dlWaitSend.Items[i].FindControl("lblGroupTo"); lblGroupTo.Text = "Tất cả khách hàng"; } else if (groupTo == -2) { Label lblGroupTo = (Label)dlWaitSend.Items[i].FindControl("lblGroupTo"); lblGroupTo.Text = "Nhóm mua nhiều lần"; } else if (groupTo == -1) { Label lblGroupTo = (Label)dlWaitSend.Items[i].FindControl("lblGroupTo"); lblGroupTo.Text = "Nhóm mua lần đầu"; } else { DataTable tblGroupTo = new DataTable(); if (Sendtype == 1) { tblGroupTo = mailGroupBus.GetByID(groupTo); if (tblGroupTo.Rows.Count > 0) { Label lblGroupTo = (Label)dlWaitSend.Items[i].FindControl("lblGroupTo"); lblGroupTo.Text = tblGroupTo.Rows[0]["Name"].ToString(); } } else { tblGroupTo = cateBUs.GetByID(groupTo); if (tblGroupTo.Rows.Count > 0) { Label lblGroupTo = (Label)dlWaitSend.Items[i].FindControl("lblGroupTo"); lblGroupTo.Text = tblGroupTo.Rows[0]["Title"].ToString(); } } } Label lblStartDate = (Label)dlWaitSend.Items[i].FindControl("lblStartDate"); lblStartDate.Text = row["StartDate"].ToString(); Label lblEndDate = (Label)dlWaitSend.Items[i].FindControl("lblEndDate"); int status = int.Parse(row["Status"].ToString()); Panel panel = (Panel)dlWaitSend.Items[i].FindControl("Panel1"); TextBox progressbar = (TextBox)dlWaitSend.Items[i].FindControl("progressbar"); LinkButton lbtDetail = (LinkButton)dlWaitSend.Items[i].FindControl("lbtDetail"); //get list detail DataTable listDetail = srdBus.GetByID(int.Parse(row["Id"].ToString())); int hasSend = 0, sumSend = dsgBus.GetByID(groupTo).Rows.Count; for (int k = 0; k < listDetail.Rows.Count; k++) { hasSend++; } //calc percent has send int percent = 0; if (sumSend != 0) { percent = (hasSend * 100) / sumSend; } if (status == 0) { //display process bar panel.Visible = true; progressbar.BackColor = System.Drawing.Color.Cornsilk; progressbar.Width = percent + 20; progressbar.Text = percent + "%"; lbtDetail.Visible = false; lbtDetail.Text = ""; lblEndDate.Text = "Chưa xác định "; } else { //hidden process bar panel.Visible = false; lbtDetail.Text = "Xem chi tiết"; lbtDetail.PostBackUrl = "reportSend.aspx?campaign-id=" + row["Id"].ToString(); lblEndDate.Text = row["EndDate"].ToString(); } LinkButton lbtDelete = (LinkButton)dlWaitSend.Items[i].FindControl("lbtDelete"); lbtDelete.CommandArgument = row["Id"].ToString(); } catch (Exception) { continue; } } } } catch (Exception) { } }
private void InitBus() { cm = new Common(); ctBUS = new CustomerBUS(); oBUS = new OrderBUS(); odBUS = new OrderDatailBUS(); mgBUS = new MailGroupBUS(); dgBUS = new DetailGroupBUS(); }
private void InitBUS() { ctBUS = new CustomerBUS(); mailGroupBus = new MailGroupBUS(); dgBUS = new DetailGroupBUS(); }
private void LoadMailGroupLists() { mailGroupBus = new MailGroupBUS(); createTableMail(); DataTable dtMailGroup = new DataTable(); UserLoginDTO userLogin = getUserLogin(); if (userLogin.DepartmentId == 1) { dtMailGroup = mailGroupBus.GetAll(); } else //if (getUserLogin().DepartmentId == 2) { dtMailGroup = mailGroupBus.GetMailGroupByUserId(getUserLogin().UserId); } if (dtMailGroup.Rows.Count > 0) { DataRow rowE = group.NewRow(); if (userLogin.DepartmentId == 1) { rowE["Id"] = -3; rowE["Name"] = "Tất cả"; group.Rows.Add(rowE); } if (userLogin.DepartmentId == 2) { rowE["Id"] = -3; rowE["Name"] = "Tất cả"; group.Rows.Add(rowE); } if (userLogin.DepartmentId == 3) { rowE["Id"] = -3; rowE["Name"] = "Tất cả"; group.Rows.Add(rowE); } foreach (DataRow rowItem in dtMailGroup.Rows) { rowE = group.NewRow(); rowE["Id"] = rowItem["Id"]; rowE["Name"] = rowItem["Name"]; group.Rows.Add(rowE); } } this.drlMailGroup.DataSource = group; this.drlMailGroup.DataTextField = "Name"; this.drlMailGroup.DataValueField = "Id"; this.drlMailGroup.DataBind(); }
private void InitialBUS() { scBUS = new SendContentBUS(); mailConfigBus = new MailConfigBUS(); mailGroupBus = new MailGroupBUS(); customerBus = new CustomerBUS(); srBUS = new SendRegisterBUS(); common = new Common(); dsgBUS = new DetailGroupBUS(); }
private void InitialBUS() { mailConfigBus = new MailConfigBUS(); mailGroupBus = new MailGroupBUS(); eventBus = new EventBUS(); }
private void LoadCustomer() { mgBUS = new MailGroupBUS(); customer = new DataTable(); customerBySelect = new DataTable(); int GroupID = 0; GroupID = int.Parse(drlSubGroup.SelectedValue.ToString()); if (getUserLogin().DepartmentId == 1) { //customer = ctBUS.GetAll(); customer = ctBUS.GetAllFilterCustomer(txtName.Text.Trim(), txtEmail.Text.Trim(), GroupID,txtPhone.Text.Trim()); } else { customer = ctBUS.GetAllByUserAssignTo(getUserLogin().UserId, GroupID, txtName.Text.Trim(), txtEmail.Text.Trim(),txtPhone.Text.Trim()); } //customerBySelect = customer; try { dlPager.MaxPages = 1000; dlPager.PageSize = 50; dlPager.DataSource = customer.DefaultView; dlPager.BindToControl = dtlCustomer; this.dtlCustomer.DataSource = dlPager.DataSourcePaged; this.dtlCustomer.DataBind(); } catch (Exception ex) { logs.Error(userLogin.Username + "-Client - LoadCustomer", ex); } }