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); } }
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); } }