public void bindGrid(string fillflag, int pageIndex) { try { string sortdir = (fillflag == "sort" ? GetSortDirection() : GridViewSortDirection); CampaignJob objCampaignJob = new CampaignJob(ConnectionString); DataTable campaignJobs = new DataTable(); campaignJobs = objCampaignJob.getAllSentCampaignsByDateRange(ConnectionString, txtStartDate.Text, txtEndDate.Text, GridSortExpression, sortdir, pageIndex, 10, out rowCount, out targetedCount, out sentCount, out bounceCount); RgrdSentCampaigns.VirtualItemCount = rowCount; lblBounces.Text = bounceCount.ToString(); lblcampaignsent.Text = rowCount.ToString(); lblContactsTargeted.Text = targetedCount.ToString(); lblSuccessfulDeliveries.Text = sentCount.ToString(); RgrdSentCampaigns.CurrentPageIndex = pageIndex; RgrdSentCampaigns.DataSource = campaignJobs; RgrdSentCampaigns.DataBind(); GridPrevSortExpression = GridSortExpression; if (campaignJobs.Rows.Count == 0) { lblMsg.Text = "No Records Found in given Date Range!"; } } catch (Exception ex) { throw ex; } }
protected void bindClienInfo(string cName) { if (ddlClients.SelectedIndex > 0) { MembershipUser objMembershipUser = Membership.GetUser(cName); ProfileBase objProfileBase = ProfileBase.Create(cName, true); StringBuilder clientInfo = new StringBuilder(); clientInfo.AppendLine(objProfileBase.GetPropertyValue("FName").ToString() + " " + objProfileBase.GetPropertyValue("LName").ToString()); clientInfo.AppendLine(objProfileBase.GetPropertyValue("Address").ToString()); clientInfo.AppendLine(objProfileBase.GetPropertyValue("State").ToString()); clientInfo.AppendLine(objProfileBase.GetPropertyValue("Country").ToString() + "-" + objProfileBase.GetPropertyValue("PostalCode").ToString()); clientInfo.AppendLine(objMembershipUser.Email.ToString()); clientEmail = objMembershipUser.Email.ToString(); txtClientInfo.Text = clientInfo.ToString(); string dbName = objProfileBase.GetPropertyValue("DBName").ToString(); string dbUserID = objProfileBase.GetPropertyValue("DBUserID").ToString(); string dbPassword = objProfileBase.GetPropertyValue("DBPassword").ToString(); string dbServerName = objProfileBase.GetPropertyValue("DBServerName").ToString(); string ConString = string.Format("Data Source={0};Initial Catalog={1};User ID={2};Password={3};Pooling=True", dbServerName, dbName, dbUserID, dbPassword); CampaignJob objCampaignJob = new CampaignJob(ConString); DataTable campaignJobs = new DataTable(); campaignJobs = objCampaignJob.getAllSentCampaignsByDateRange(ConString, Convert.ToDateTime(calExSDate.SelectedDate.ToString()).ToShortDateString(), Convert.ToDateTime(calExEDate.SelectedDate.ToString()).ToShortDateString(), "CreatedDate", "desc", 0, 10, out rowCount, out targetedCount, out sentCount, out bounceCount); lblnoofemailsent.Text = targetedCount.ToString(); double amount = Math.Round(Convert.ToDouble(lblnoofemailsent.Text.ToString()) * Convert.ToDouble(lblprice.Text), 2); lblamount.Text = amount.ToString(); lbltotal.Text = amount.ToString(); if (amount > 0) { double discountAmt = 0.0; double taxAmt = 0.0; double gAmt = 0.0; if (txtdiscount.Text != string.Empty && txtTax.Text != string.Empty) { discountAmt = amount - Convert.ToDouble(txtdiscount.Text); lblamtdiscount.Text = discountAmt.ToString(); taxAmt = Math.Round((Convert.ToDouble(discountAmt.ToString()) * Convert.ToDouble(txtTax.Text.ToString())) / 100, 2); lblamttax.Text = taxAmt.ToString(); gAmt = Math.Round(discountAmt + taxAmt, 2); lblgrandtotal.Text = gAmt.ToString(); } } else clearValues(); pnlControls.Controls.Clear(); pnlAmount.Controls.Clear(); hdDynamicAmt.Value = "0"; for (int i = 1; i <= tblDesc.Rows.Count && i <= tblAmount.Rows.Count; i++) { tblDesc.Rows[i - 1].Style["display"] = "none"; tblAmount.Rows[i - 1].Style["display"] = "none"; pnlControls.Controls.Add(tblDesc); pnlAmount.Controls.Add(tblAmount); Session["tableDesc"] = tblDesc; Session["tableAmount"] = tblAmount; TextBox txtAmount = (TextBox)this.FindControlRecursive(this, "txtAmt" + i.ToString()); if (txtAmount != null) txtAmount.Text = string.Empty; } } }