Esempio n. 1
0
        private void InsertUserProfile()
        {
            try
            {
                List <PrimaryHaul_WS.AppCode_DS.PHDS_User.User_VendorRow> drVenders = new List <PrimaryHaul_WS.AppCode_DS.PHDS_User.User_VendorRow>();
                PrimaryHaul_WS.AppCode_DS.PHDS_User.User_ProfileRow       drProfile = new PrimaryHaul_WS.AppCode_DS.PHDS_User.User_ProfileDataTable().NewUser_ProfileRow();


                #region Row Profile
                drProfile.UserType            = GetRoleId();
                drProfile.RoleID              = GetRoleId();//(Request["r"] != null && Request["r"] != "") ? Request["r"].ToString().ToUpper() : GetRoleId().ToString();
                drProfile.UserName            = txtUserName.Text;
                drProfile.Passwd              = PH_EncrptHelper.MD5Encryp(txtPassword.Text);
                drProfile.FullName_En         = txtEngName.Text;
                drProfile.FullName_Th         = txtTHAName.Text;
                drProfile.Mobile              = txtMobile.Text;
                drProfile.EMail_Address       = txtEmail.Text;
                drProfile.User_Status         = rdoStatusA.Checked?"A":"D";
                drProfile.TaxID               = txtHaulierCode.Text;
                drProfile.Contact_Person      = txtContact.Text;
                drProfile.StampTime           = DateTime.Now;
                drProfile.Passwd_Expired_Date = chkForepasswrd.Checked ? DateTime.Now : DateTime.ParseExact(txtPasswrdExpried.Text, ConfigurationManager.AppSettings["PH_Date_format"], null);
                #endregion

                #region Vendor
                if (txtTaxId.Text != "")
                {
                    PrimaryHaul_WS.AppCode_DS.PHDS_User.User_VendorRow drVendor;
                    string[] strVendorsId = txtTaxId.Text.Split(',');
                    foreach (string strVendor in strVendorsId)
                    {
                        if (strVendor.Trim() != "")
                        {
                            drVendor             = new PrimaryHaul_WS.AppCode_DS.PHDS_User.User_VendorDataTable().NewUser_VendorRow();
                            drVendor.Vendor_Code = strVendor.Trim();
                            drVendor.StampTime   = DateTime.Now;
                            drVenders.Add(drVendor);
                        }
                    }
                }
                #endregion

                PHCore_Status status = new PHCore_User().PH_Flow_UserInsert(AppCode.strConnDB, drProfile, drVenders);

                if (status.Status == PHCore_Status.SignInStatus.Success)
                {
                    Response.Redirect("addnew.aspx?" + Request.QueryString, false);
                }
                else
                {
                    lblError.Text = status.Message;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 2
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try {
         if (PHCore_User.ChangeProfile(AppCode.strConnDB, Request["id"], txtContact.Text, txtEmail.Text, txtMobile.Text) > 0)
         {
             lblError.Text = ConfigurationManager.AppSettings["PH_Success_Message"];
         }
         else
         {
             lblError.Text = ConfigurationManager.AppSettings["PH_Error_Message"];
         }
     }
     catch (Exception ex)
     {
         lblError.Text = ex.Message;
         PH_ExceptionManager.WriteError(ex.Message);
     }
 }
Esempio n. 3
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         if (PHCore_User.SelAllUserName(AppCode.strConnDB, txtUserName.Text).Trim() != "")
         {
             lblErrUserName.Text = ConfigurationManager.AppSettings["PH_AddNew_UserName_Err"];
         }
         else if (GetRoleId() == PHCore_Status.RoleID.HL.ToString() && PH_HaulierInfo.PH_Haulier_SelByTaxId(AppCode.strConnDB, txtHaulierCode.Text).Trim() == "")
         {
             lblErrHaulierCode.Text = ConfigurationManager.AppSettings["PH_AddNew_Haulier_Err"];
         }
         else
         {
             InsertUserProfile();
         }
     }
     catch (Exception ex)
     {
         lblError.Text = ex.Message;
         PH_ExceptionManager.WriteError(ex.Message);
     }
 }
Esempio n. 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try {
         if (!IsPostBack)
         {
             if (Request["id"] != null && Request["id"] != "")
             {
                 DataTable dt = PHCore_User.SelByUserId(AppCode.strConnDB, Request["id"]);
                 if (dt.Rows.Count > 0)
                 {
                     txtContact.Text = dt.Rows[0]["contact_person"].ToString();
                     txtMobile.Text  = dt.Rows[0]["mobile"].ToString();
                     txtEmail.Text   = dt.Rows[0]["email_address"].ToString();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         lblError.Text = ex.Message;
         PH_ExceptionManager.WriteError(ex.Message);
     }
 }
Esempio n. 5
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         if (PH_EncrptHelper.MD5Decryp(Request["p"]) == txtPassword.Text)
         {
             lblErr.Text = ConfigurationManager.AppSettings["PH_Error_PasswordExpired"];
         }
         else
         {
             var rtn = PHCore_User.ChangePasswd(AppCode.strConnDB, Request["id"], txtPassword.Text, DateTime.ParseExact(txtPasswordExpired.Text, "dd/MM/yyyy", null));
             if (rtn > 0)
             {
                 Response.Redirect("login.aspx", false);
             }
         }
     }
     catch (Exception ex)
     {
         lblErr.Text = ex.Message;
         PH_ExceptionManager.WriteError(ex.Message);
     }
 }