Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String strOutput = String.Empty;

            String OperatorName = String.Empty;
            String OperatorID   = Request.QueryString["repname"];

            OperatorName = logindal.getLoginNameFromID(OperatorID);
            List <String> AllAccountsByOwner = getAllCompaniesOwnedByOwner(OperatorID);

            foreach (String SingleCompanyID in AllAccountsByOwner)
            {
                strOutput = strOutput + OperatorName + "|";
                String CompanyName = companydal.getCompanyNameByID(SingleCompanyID);
                strOutput = strOutput + CompanyName + "|";
                String ContactID   = contactdal.getContactByCompanyBasedOnLastOrder(Int32.Parse(SingleCompanyID));
                String ContactName = contactdal.getContactFullNameBasedOnContactID(ContactID);
                strOutput = strOutput + ContactName + "|";
                String LastOrderDate = orderdal.getLastOrderDateForCompany(SingleCompanyID);
                strOutput = strOutput + LastOrderDate + "~";
            }

            int Length = strOutput.Length;

            if (Length != 0)
            {
                strOutput = strOutput.Substring(0, (Length - 1));
            }

            Response.Write(strOutput);
        }
Ejemplo n.º 2
0
        protected void sendEmail(object sender, EventArgs e)
        {
            var conn = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString;
            var Cdal = new ContactDAL(conn);

            foreach (GridViewRow row in GridViewProduct.Rows)
            {
                CheckBox chkSelect = (CheckBox)(row.Cells[0].FindControl("SelectCheckBox"));
                if (chkSelect.Checked)
                {
                    string hiddenFieldValue = (row.Cells[0].FindControl("comId") as HiddenField).Value;
                    var    orderId          = (row.Cells[0].FindControl("OrderID") as Label).Text;
                    var    producTCode      = (row.Cells[0].FindControl("SupplierItemCode") as Label).Text;
                    var    AccountOwner     = (row.Cells[0].FindControl("AccountOwner") as Label).Text;
                    var    contactName      = (row.Cells[0].FindControl("contactName") as Label).Text;
                    var    conectID         = Cdal.getContactByCompanyBasedOnLastOrder(Convert.ToInt32(hiddenFieldValue));
                    var    conEmail         = Cdal.GetContactByContactId(Convert.ToInt32(conectID));
                    contactName = conEmail.FirstName;
                    if (!string.IsNullOrEmpty(conEmail.Email))
                    {
                        SendMEmail(conEmail.Email, contactName, AccountOwner, hiddenFieldValue, orderId);
                    }
                }
            }
            messagelable.Text = "Successfully sent";
        }