예제 #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                using (SalesDBEntities1 objEntity = new SalesDBEntities1())
                {
                    followup objProNew = new followup();
                    objProNew.followupDate   = Convert.ToDateTime(txtFD.Text);
                    objProNew.isActive       = true;
                    objProNew.isDone         = false;
                    objProNew.inquiryID      = Convert.ToInt64(ddlStore.SelectedValue);
                    objProNew.followupDetail = txtDetail.Text;

                    objEntity.followups.Add(objProNew);
                    objEntity.SaveChanges();



                    Response.Redirect("~/followups.aspx", false);
                }
            }
            catch (Exception ex)
            {
                appOperations.LogException(ex, "User Save");
                liVal.Text = ex.Message;
            }
        }
예제 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                using (SalesDBEntities1 objEntity = new SalesDBEntities1())
                {
                    customerMST objProNew = new customerMST();
                    objProNew.cellNumber       = txtCell.Text;
                    objProNew.companyName      = txtCompany.Text;
                    objProNew.CreatedBy        = Convert.ToDecimal(Session["userID"]);
                    objProNew.CreatedDate      = DateTime.Now;
                    objProNew.customerStatusID = Convert.ToInt64(ddlStatus.SelectedValue);
                    objProNew.customerTypeID   = Convert.ToInt64(ddlType.SelectedValue);
                    objProNew.firstName        = txtFName.Text;
                    objProNew.homeNumber       = txtHome.Text;
                    objProNew.isActive         = true;
                    objProNew.isDeleted        = false;
                    objProNew.lastName         = txtLName.Text;
                    objProNew.middelName       = txtMName.Text;

                    objEntity.customerMSTs.Add(objProNew);
                    objEntity.SaveChanges();
                    Response.Redirect("~/customers.aspx", false);
                }
            }
            catch (Exception ex)
            {
                appOperations.LogException(ex, "");
                liVal.Text = ex.Message;
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                using (SalesDBEntities1 objEntity = new SalesDBEntities1())
                {
                    messageMail objProNew = new messageMail();
                    objProNew.messageDate   = DateTime.Now;
                    objProNew.isDeleted     = false;
                    objProNew.isImportant   = false;
                    objProNew.receiverID    = Convert.ToInt64(ddlStore.SelectedValue);
                    objProNew.messageDetail = txtDetail.Text;
                    objProNew.senderID      = Convert.ToDecimal(Session["userID"]);

                    objEntity.messageMails.Add(objProNew);
                    objEntity.SaveChanges();



                    Response.Redirect("~/mails.aspx", false);
                }
            }
            catch (Exception ex)
            {
                appOperations.LogException(ex, "");
                liVal.Text = ex.Message;
            }
        }
예제 #4
0
        private void getUserDetail()
        {
            try
            {
                decimal userID = Convert.ToDecimal(Session["userID"]);
                using (SalesDBEntities1 objEntity = new SalesDBEntities1())
                {
                    userDetail objProNew = objEntity.userDetails.FirstOrDefault(Pro => Pro.userID == userID);
                    if (objProNew != null)
                    {
                        txtState.Text = objProNew.state;

                        txtAddLine1.Text     = objProNew.addressLine1;
                        txtAddressLine2.Text = objProNew.addressLine2;
                        txtCity.Text         = objProNew.city;
                        txtFName.Text        = objProNew.firstName;
                        txtLName.Text        = objProNew.lastName;

                        txtContact.Text = objProNew.contactNumber;
                        txtPass.Text    = StringCipher.DecryptStringAES(objProNew.userPass);
                        txtDOB.Text     = Convert.ToString(objProNew.DOB);

                        objEntity.SaveChanges();

                        string filename = objProNew.userID.ToString() + ".jpg";
                        imgPic.ImageUrl = "~/userData/userPic/" + filename;
                    }
                }
            }
            catch (Exception ex)
            {
                appOperations.LogException(ex, "User Save");
                liVal.Text = ex.Message;
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                using (SalesDBEntities1 objEntity = new SalesDBEntities1())
                {
                    userDetail objpro = objEntity.userDetails.FirstOrDefault(Pro => Pro.userName == txtUserName.Text);
                    if (objpro != null)
                    {
                        liVal.Text = "User Name Already Exists. <br/> Please Enter different Name.";
                        return;
                    }
                    else
                    {
                        userDetail objProNew = new userDetail();
                        if (ddlAccount.SelectedValue != "0")
                        {
                            objProNew.accountID = Convert.ToDecimal(ddlAccount.SelectedValue);
                        }
                        if (ddlStore.SelectedValue != "0")
                        {
                            objProNew.storeID = Convert.ToDecimal(ddlStore.SelectedValue);
                        }
                        if (ddlUserType.SelectedValue != "0")
                        {
                            objProNew.userGroupID = Convert.ToDecimal(ddlUserType.SelectedValue);
                        }
                        objProNew.state         = txtState.Text;
                        objProNew.isActive      = true;
                        objProNew.CreatedDate   = DateTime.Now;
                        objProNew.addressLine1  = txtAddLine1.Text;
                        objProNew.addressLine2  = txtAddressLine2.Text;
                        objProNew.city          = txtCity.Text;
                        objProNew.firstName     = txtFName.Text;
                        objProNew.lastName      = txtLName.Text;
                        objProNew.CreatedBy     = Convert.ToDecimal(Session["userID"]);
                        objProNew.contactNumber = txtContact.Text;
                        objProNew.userName      = txtUserName.Text;
                        objProNew.userPass      = StringCipher.EncryptStringAES(txtPass.Text);
                        objProNew.DOB           = Convert.ToDateTime(txtDOB.Text);
                        objEntity.userDetails.Add(objProNew);
                        objEntity.SaveChanges();

                        string filename = objProNew.userID.ToString() + ".jpg";
                        flPhoto.SaveAs(Server.MapPath("~/userData/userPic/" + filename));


                        Response.Redirect("~/adUsers.aspx", false);
                    }
                }
            }
            catch (Exception ex)
            {
                appOperations.LogException(ex, "User Save");
                liVal.Text = ex.Message;
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                using (SalesDBEntities1 objEntity = new SalesDBEntities1())
                {
                    decimal     custID    = Convert.ToDecimal(Session["custID"]);
                    customerMST objProNew = objEntity.customerMSTs.FirstOrDefault(cust => cust.customerID == custID);
                    if (objProNew != null)
                    {
                        objProNew.cellNumber       = txtCell.Text;
                        objProNew.companyName      = txtCompany.Text;
                        objProNew.LastmodifiedBy   = Convert.ToDecimal(Session["userID"]);
                        objProNew.LastmodifiedDate = DateTime.Now;
                        objProNew.customerStatusID = Convert.ToInt64(ddlStatus.SelectedValue);
                        objProNew.customerTypeID   = Convert.ToInt64(ddlType.SelectedValue);
                        objProNew.firstName        = txtFName.Text;
                        objProNew.homeNumber       = txtHome.Text;
                        objProNew.isActive         = true;
                        objProNew.isDeleted        = false;
                        objProNew.lastName         = txtLName.Text;
                        objProNew.middelName       = txtMName.Text;



                        objProNew.addressLine1 = txtAddress1.Text;
                        objProNew.addressLine2 = txtAddress2.Text;
                        objProNew.city         = txtCity.Text;
                        if (txtDOB.Text != "")
                        {
                            objProNew.DOB = Convert.ToDateTime(txtDOB.Text);
                        }
                        objProNew.email     = txtEmail.Text;
                        objProNew.website   = txtWebSite.Text;
                        objProNew.workPhone = txtWorkPhone.Text;



                        objEntity.SaveChanges();
                        liVal.Text = "Saved Successfull.";
                    }
                    else
                    {
                        liVal.Text = "Customer Not Found.";
                    }
                }
            }
            catch (Exception ex)
            {
                appOperations.LogException(ex, "");
                liVal.Text = ex.Message;
            }
        }
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            // validate the Captcha to check we're not dealing with a bot
            bool isHuman = ExampleCaptcha.Validate(CaptchaCodeTextBox.Text);

            CaptchaCodeTextBox.Text = null; // clear previous user input

            if (!isHuman)
            {
                lblVal.Text = "Invalid Code.";
                return;
            }
            else
            {
                try
                {
                    using (SalesDBEntities1 objEntity = new SalesDBEntities1())
                    {
                        userDetail objUser = objEntity.userDetails.FirstOrDefault(users => users.userName == txtUserName.Text);
                        if (objUser != null)
                        {
                            if (StringCipher.DecryptStringAES(objUser.userPass) == txtPass.Text)
                            {
                                Session["userID"]   = objUser.userID;
                                Session["userType"] = objUser.userGroupID;
                                Session["userName"] = txtUserName.Text;
                                Session["Name"]     = objUser.firstName;
                                Response.Redirect("~/Dashboard.aspx", false);
                            }
                            else
                            {
                                lblVal.Text = "Please verify your Password";
                            }
                        }
                        else
                        {
                            lblVal.Text = "Please check user name and password.";
                        }
                    }
                }
                catch (Exception ex)
                {
                    appOperations.LogException(ex, "Login -Button Click");
                    lblVal.Text = "Something went wrong.<br/>Please try again later.";
                }
            }
        }
        private void getCust()
        {
            try
            {
                using (SalesDBEntities1 objEntity = new SalesDBEntities1())
                {
                    decimal     custID    = Convert.ToDecimal(Session["custID"]);
                    customerMST objProNew = objEntity.customerMSTs.FirstOrDefault(cust => cust.customerID == custID);
                    if (objProNew != null)
                    {
                        txtCell.Text    = objProNew.cellNumber;
                        txtCompany.Text = objProNew.companyName;

                        if (ddlStatus.Items.FindByValue(Convert.ToInt64(objProNew.customerStatusID).ToString()) != null)
                        {
                            ddlStatus.Items.FindByValue(Convert.ToInt64(objProNew.customerStatusID).ToString()).Selected = true;
                        }
                        if (ddlType.Items.FindByValue(Convert.ToInt64(objProNew.customerTypeID).ToString()) != null)
                        {
                            ddlType.Items.FindByValue(Convert.ToInt64(objProNew.customerTypeID).ToString()).Selected = true;
                        }
                        txtFName.Text = objProNew.firstName;
                        txtHome.Text  = objProNew.homeNumber;

                        txtLName.Text = objProNew.lastName;
                        txtMName.Text = objProNew.middelName;

                        txtAddress1.Text  = objProNew.addressLine1;
                        txtAddress2.Text  = objProNew.addressLine2;
                        txtCity.Text      = objProNew.city;
                        txtDOB.Text       = Convert.ToString(objProNew.DOB);
                        txtEmail.Text     = objProNew.email;
                        txtWebSite.Text   = objProNew.website;
                        txtWorkPhone.Text = objProNew.workPhone;
                    }
                    else
                    {
                        liVal.Text = "Customer Not Found.";
                    }
                }
            }
            catch (Exception ex)
            {
                appOperations.LogException(ex, "");
                liVal.Text = ex.Message;
            }
        }
예제 #9
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string filename = DateTime.Now.ToString("MM_dd_yy_hh_mm_ss") + Path.GetFileName(flPhoto.PostedFile.FileName);
                flPhoto.SaveAs(Server.MapPath("~/userData/productPic/" + filename));

                using (SalesDBEntities1 objEntity = new SalesDBEntities1())
                {
                    productMST objpro = objEntity.productMSTs.FirstOrDefault(Pro => Pro.productCode == txtCode.Text || Pro.productName == txtName.Text);
                    if (objpro != null)
                    {
                        liVal.Text = "Product Code or Name Already Exists. <br/> Please Enter different Code or Name.";
                        return;
                    }
                    else
                    {
                        productMST objProNew = new productMST();
                        if (ddlCategory.SelectedValue != "0")
                        {
                            objProNew.categoryID = Convert.ToDecimal(ddlCategory.SelectedValue);
                        }
                        objProNew.productCode       = txtCode.Text;
                        objProNew.isActive          = true;
                        objProNew.CreatedDate       = DateTime.Now;
                        objProNew.CreatedBy         = Convert.ToDecimal(Session["userID"]);
                        objProNew.productDesciption = txtDesc.Text;
                        objProNew.productName       = txtName.Text;
                        objProNew.UnitPrice         = Convert.ToDecimal(txtPrice.Text);
                        objProNew.productPic        = "~/userData/productPic/" + filename;

                        objEntity.productMSTs.Add(objProNew);
                        objEntity.SaveChanges();


                        Response.Redirect("~/adProducts.aspx", false);
                    }
                }
            }
            catch (Exception ex)
            {
                appOperations.LogException(ex, "Category Save");
                liVal.Text = ex.Message;
            }
        }
예제 #10
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         using (SalesDBEntities1 objEntity = new SalesDBEntities1())
         {
             storeMST objpro = objEntity.storeMSTs.FirstOrDefault(Pro => Pro.storeName == txtName.Text);
             if (objpro != null)
             {
                 liVal.Text = "Store Name Already Exists. <br/> Please Enter different Name.";
                 return;
             }
             else
             {
                 storeMST objProNew = new storeMST();
                 if (ddlAccount.SelectedValue != "0")
                 {
                     objProNew.accountID = Convert.ToDecimal(ddlAccount.SelectedValue);
                 }
                 objProNew.State         = txtState.Text;
                 objProNew.isActive      = true;
                 objProNew.CreatedDate   = DateTime.Now;
                 objProNew.AddressLine1  = txtAddLine1.Text;
                 objProNew.AddressLine2  = txtAddressLine2.Text;
                 objProNew.City          = txtCity.Text;
                 objProNew.storeDetail   = txtDesc.Text;
                 objProNew.CreatedBy     = Convert.ToDecimal(Session["userID"]);
                 objProNew.ContactDetail = txtContact.Text;
                 objProNew.storeHolder   = txtManager.Text;
                 objProNew.storeName     = txtName.Text;
                 objEntity.storeMSTs.Add(objProNew);
                 objEntity.SaveChanges();
                 Response.Redirect("~/adStores.aspx", false);
             }
         }
     }
     catch (Exception ex)
     {
         appOperations.LogException(ex, "Category Save");
         liVal.Text = ex.Message;
     }
 }
예제 #11
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                using (SalesDBEntities1 objEntity = new SalesDBEntities1())
                {
                    inquiryMST objProNew = new inquiryMST();
                    objProNew.createdBy               = Convert.ToDecimal(Session["userID"]);
                    objProNew.createdDate             = DateTime.Now;
                    objProNew.custName                = Convert.ToString(ddlCustomer.SelectedItem.Text);
                    objProNew.customerID              = Convert.ToInt64(ddlCustomer.SelectedValue);
                    objProNew.inquiryNextFollowupDate = Convert.ToDateTime(txtFD.Text);
                    objProNew.inquiryOwner            = Convert.ToString(Session["userName"]);;
                    objProNew.inquiryOwnerID          = Convert.ToDecimal(Session["userID"]);;
                    objProNew.inquiryStatus           = "OPEN";
                    objProNew.inquiryType             = txtType.Text;
                    objProNew.isDeleted               = false;
                    objProNew.productCode             = Convert.ToString(ddlUnit.SelectedValue);
                    objProNew.productID               = Convert.ToDecimal(ddProduct.SelectedValue);
                    objProNew.productName             = Convert.ToString(ddProduct.SelectedItem.Text);
                    objProNew.productUnitPrice        = Convert.ToDecimal(ddlUnit.SelectedItem.Text);
                    objProNew.storeID = 1;

                    if (txtDiscount.Text != "")
                    {
                        objProNew.discountedPrice = Convert.ToDecimal(txtDiscount.Text);
                    }

                    objEntity.inquiryMSTs.Add(objProNew);
                    objEntity.SaveChanges();
                    Response.Redirect("~/inquiry.aspx", false);
                }
            }
            catch (Exception ex)
            {
                appOperations.LogException(ex, "");
                liVal.Text = ex.Message;
            }
        }
예제 #12
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                decimal userID = Convert.ToDecimal(Session["userID"]);
                using (SalesDBEntities1 objEntity = new SalesDBEntities1())
                {
                    userDetail objProNew = objEntity.userDetails.FirstOrDefault(Pro => Pro.userID == userID);
                    if (objProNew != null)
                    {
                        objProNew.state = txtState.Text;

                        objProNew.addressLine1 = txtAddLine1.Text;
                        objProNew.addressLine2 = txtAddressLine2.Text;
                        objProNew.city         = txtCity.Text;
                        objProNew.firstName    = txtFName.Text;
                        objProNew.lastName     = txtLName.Text;

                        objProNew.contactNumber = txtContact.Text;
                        objProNew.userPass      = StringCipher.EncryptStringAES(txtPass.Text);
                        objProNew.DOB           = Convert.ToDateTime(txtDOB.Text);

                        objEntity.SaveChanges();

                        string filename = objProNew.userID.ToString() + ".jpg";
                        flPhoto.SaveAs(Server.MapPath("~/userData/userPic/" + filename));


                        Response.Redirect("~/adUsers.aspx", false);
                    }
                }
            }
            catch (Exception ex)
            {
                appOperations.LogException(ex, "User Save");
                liVal.Text = ex.Message;
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                using (SalesDBEntities1 objEntity = new SalesDBEntities1())
                {
                    categoryMST objcat = objEntity.categoryMSTs.FirstOrDefault(cat => cat.catName == txtCat.Text);
                    if (objcat != null)
                    {
                        liVal.Text = "Category Already Exists. <br/> Please Enter different Category.";
                        return;
                    }
                    else
                    {
                        categoryMST objcatNew = new categoryMST();

                        objcatNew.catName     = txtCat.Text;
                        objcatNew.catCode     = "S";
                        objcatNew.isActive    = true;
                        objcatNew.CreatedDate = DateTime.Now;
                        objcatNew.categoryID  = Convert.ToDecimal(Session["userID"]);
                        if (ddlCategory.SelectedValue != "0")
                        {
                            objcatNew.parentcategoryID = Convert.ToDecimal(ddlCategory.SelectedValue);
                        }

                        objEntity.categoryMSTs.Add(objcatNew);
                        objEntity.SaveChanges();
                        Response.Redirect("~/adPCategory.aspx", false);
                    }
                }
            }
            catch (Exception ex)
            {
                appOperations.LogException(ex, "Category Save");
                liVal.Text = ex.Message;
            }
        }
예제 #14
0
 protected void lbtnClose_Click(object sender, EventArgs e)
 {
     try
     {
         LinkButton lbtn   = (LinkButton)sender;
         decimal    onjInq = Convert.ToDecimal(lbtn.CommandArgument);
         using (SalesDBEntities1 objEntity = new SalesDBEntities1())
         {
             inquiryMST objpro = objEntity.inquiryMSTs.FirstOrDefault(Pro => Pro.inquiryMST1 == onjInq);
             if (objpro != null)
             {
                 objpro.inquiryStatus = "Close";
                 objEntity.SaveChanges();
             }
         }
         gvProduct.DataBind();
     }
     catch (Exception ex)
     {
         appOperations.LogException(ex, "");
         liVal.Text = ex.Message;
     }
 }