private bool SaveData()
    {
        objClsCommon = new clsCommon();
        objCustomer  = new tblCustomer();
        if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
        {
            objCustomer.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value));
        }
        else
        {
            objCustomer.AddNew();
        }
        objCustomer.AppFirstName = txtFirstName.Text;
        objCustomer.AppLastName  = txtLastName.Text;
        objCustomer.AppEmailID   = txtEmail.Text;
        objEncrypt = new clsEncryption();
        objCustomer.AppPassword = objEncrypt.Encrypt(txtPassword.Text, appFunctions.strKey);
        objEncrypt            = null;
        objCustomer.AppMobile = txtMobile.Text;
        objCustomer.AppPhone  = txtPhone.Text;
        if (RbtnMale.Checked)
        {
            objCustomer.AppGender = true;
        }
        else
        {
            objCustomer.AppGender = false;
        }
        objCustomer.AppIsVerified = chkIsVerified.Checked;

        if (FileUploadImg.HasFile)
        {
            string strError = "";
            string Time     = Convert.ToString(DateTime.Now.Month) + Convert.ToString(DateTime.Now.Day) + Convert.ToString(DateTime.Now.Year) + Convert.ToString(DateTime.Now.Hour) + Convert.ToString(DateTime.Now.Minute) + Convert.ToString(DateTime.Now.Second);
            string strPath  = objClsCommon.FileUpload_Images(FileUploadImg.PostedFile, txtFirstName.Text.Trim().Replace(" ", "_") + "_" + Time, "Uploads/Customer/", ref strError, 0, objCustomer.s_AppImage, false, 0, 2000);
            if (strError == "")
            {
                objCustomer.AppImage = strPath;
            }
            else
            {
                DInfo.ShowMessage(strError, Enums.MessageType.Error);
                return(false);
            }
        }
        objCustomer.AppIsActive     = chkIsActive.Checked;
        objCustomer.AppIsNewsLetter = chkIsNewsLetter.Checked;
        objCustomer.Save();
        iCustomerID  = objCustomer.AppCustomerID;
        objCustomer  = null;
        objClsCommon = null;
        return(true);
    }
Exemple #2
0
    public bool SaveCustomer()
    {
        objCommon = new clsCommon();
        if (objCommon.IsRecordExists("tblCustomer", tblCustomer.ColumnNames.AppEmailID, tblCustomer.ColumnNames.AppCustomerID, txtEmailRegistration.Text))
        {
            DisplayInfoRegistration.ShowMessage("Email address already exist.", Enums.MessageType.Error);
            return(false);
        }
        objCommon = null;
        tblCustomer objCustomer = new tblCustomer();

        objCustomer.AddNew();
        objCustomer.AppFirstName = txtFirstName.Text.Trim();
        objCustomer.AppLastName  = txtLastName.Text.Trim();
        objCustomer.AppEmailID   = txtEmailRegistration.Text.Trim();
        objCustomer.AppMobile    = txtMobile.Text;
        //   objCustomer.AppAddress = txtAddress.Text;
        if (RbtnMale.Checked)
        {
            objCustomer.AppGender = true;
        }
        else
        {
            objCustomer.AppGender = false;
        }
        objEncrypt = new clsEncryption();
        objCustomer.AppPassword = objEncrypt.Encrypt(txtPasswordRegistration.Text, appFunctions.strKey);
        objEncrypt = null;

        // objCustomer.AppIsNewsLetter = ChkSubsucribNewsLetter.Checked;
        objCustomer.AppIsActive    = true;
        objCustomer.AppIsVerified  = false;
        objCustomer.AppCreatedDate = GetDateTime();
        objCustomer.Save();
        //      tblAddress objAdress = new tblAddress();
        //      objAdress.AddNew();
        ////      objAdress.AppAddress = txtAddress.Text;
        //      objAdress.AppCustomerID = objCustomer.AppCustomerID;

        //      objAdress.Save();
        SendMail(objCustomer.s_AppCustomerID);
        objCustomer = null;
        return(true);
    }
    public bool SaveCustomer()
    {
        objCommon = new clsCommon();
        if (objCommon.IsRecordExists("tblCustomer", tblCustomer.ColumnNames.AppEmailID, tblCustomer.ColumnNames.AppCustomerID, txtEmailRegistration.Text))
        {
            DisplayInfoRegistration.ShowMessage("Email address already exist.", Enums.MessageType.Error);
            return(false);
        }
        objCommon = null;
        tblCustomer objCustomer = new tblCustomer();

        objCustomer.AddNew();
        objCustomer.AppFirstName = txtFirstName.Text.Trim();
        objCustomer.AppLastName  = txtLastName.Text.Trim();
        objCustomer.AppEmailID   = txtEmailRegistration.Text.Trim();
        objCustomer.AppMobile    = txtMobile.Text;
        objCustomer.AppAddress   = txtAddress.Text;
        if (RbtnMale.Checked)
        {
            objCustomer.AppGender = true;
        }
        else
        {
            objCustomer.AppGender = false;
        }
        objEncrypt = new clsEncryption();
        objCustomer.AppPassword = objEncrypt.Encrypt(txtPasswordRegistration.Text, appFunctions.strKey);
        objEncrypt = null;

        objCustomer.AppIsActive    = true;
        objCustomer.AppIsVerified  = true;
        objCustomer.AppCreatedDate = GetDateTime();
        objCustomer.Save();

        HttpContext.Current.Session[appFunctions.Session.ClientUserID.ToString()]   = objCustomer.AppCustomerID;
        HttpContext.Current.Session[appFunctions.Session.ClientUserName.ToString()] = objCustomer.AppFirstName + " " + objCustomer.AppLastName;

        objCustomer = null;
        return(true);
    }