public bool InsertMemberWeb(emMemberWeb model) { #region set default model.RowFlag = 2; model.RowVersion = 1; model.CreatedBy = "sa"; model.ModifiedBy = "sa"; model.ModifiedDate = DateTimeNow; model.CreatedDate = DateTimeNow; #endregion qDB.emMemberWebs.InsertOnSubmit(model); qDB.SubmitChanges(); IsResult = true; return(IsResult); }
public bool UserRegisterWithAccount(view_emCompanyMember model) { emMember member = new emMember(); emMemberWeb memberWeb = new emMemberWeb(); #region Set ค่า เข้า memberWeb memberWeb.MemberID = model.MemberID; if (model.WebID > 0) { memberWeb.WebID = model.WebID; } else { memberWeb.WebID = 1; } #endregion try { using (var trans = new TransactionScope()) { InsertMemberWeb(memberWeb); trans.Complete(); IsResult = true; } if (!IsResult) { DeleteMemberWeb(member.MemberID); } } catch (Exception ex) { IsResult = false; } return(IsResult); }
public bool UpdateMemberWeb(emMemberWeb model) { return(IsResult); }
public bool UserRegister(Ouikum.Common.Register model) { EncryptManager encrypt = new EncryptManager(); emMember member = new emMember(); emMemberWeb memberWeb = new emMemberWeb(); //emMemberActivate memberActivate = new emMemberActivate(); emCompany company = new emCompany(); emCompanyProfile compProfile = new emCompanyProfile(); Ouikum.Common.emCompanyService svCompany = new Ouikum.Common.emCompanyService(qDB); #region Set ค่า เข้า Member if (model.MemberID > 0) { member.emMemberID = (int)model.MemberID; } member.UserName = model.UserName.Trim(); member.Password = encrypt.EncryptData(model.Password); member.DisplayName = model.DisplayName.Trim(); member.AddrLine1 = model.AddrLine1; member.Email = model.Emails.Trim(); member.FirstName = model.FirstName_register.Trim(); member.LastName = model.LastName.Trim(); member.CountryID = model.CountryID; member.ProvinceID = model.ProvinceID; member.DistrictID = model.DistrictID; member.MemberType = model.MemberType; member.Phone = model.Phone; member.PostalCode = model.PostalCode; member.Mobile = model.Mobile; member.Fax = model.Fax; member.IsShow = true; member.RegisDate = DateTimeNow; member.FacebookID = model.FacebookID; #endregion #region Set ค่า เข้า memberWeb if (model.WebID > 0) { memberWeb.WebID = model.WebID; } else { memberWeb.WebID = 1; } #endregion #region Set ค่า เข้า company company.CompName = model.CompName.Trim(); company.DisplayName = model.DisplayName.Trim(); company.CompEmail = model.Emails.Trim(); company.BizTypeID = Convert.ToInt32(model.BizTypeID); company.CompAddrLine1 = model.AddrLine1; company.CompCountryID = model.CountryID; company.CompProvinceID = model.ProvinceID; company.CompDistrictID = model.DistrictID; company.CompPostalCode = model.PostalCode; company.CompPhone = model.Phone; company.CompMobile = model.Mobile; company.CompFax = model.Fax; company.IsShow = true; if (model.BizTypeID == 13 && !string.IsNullOrEmpty(model.BizTypeOther)) { company.BizTypeOther = model.BizTypeOther; } #endregion #region Set ค่า เข้า companyProfile compProfile.CompName = model.CompName.Trim(); compProfile.AddrLine1 = model.AddrLine1; compProfile.CountryID = model.CountryID; compProfile.ProvinceID = model.ProvinceID; compProfile.DistrictID = model.DistrictID; compProfile.PostalCode = model.PostalCode; compProfile.IsShow = true; if (model.BizTypeID > 0) { compProfile.CompBizType = (byte)model.BizTypeID; } else { compProfile.CompBizType = 13; } if (model.BizTypeID == 13 && !string.IsNullOrEmpty(model.BizTypeOther)) { compProfile.CompBizTypeOther = model.BizTypeOther.Trim(); } #endregion try { using (var trans = new TransactionScope()) { InsertMember(member); memberWeb.MemberID = member.MemberID; InsertMemberWeb(memberWeb); //memberActivate.MemberID = member.MemberID; //InsertMemberActivate(memberActivate); company.MemberID = member.MemberID; svCompany.InsertCompany(company); compProfile.CompID = company.CompID; svCompany.InsertCompanyProfile(compProfile); #region Set ID ที่ได้ เข้า Register Model กลับไป model.MemberID = member.MemberID; model.emCompID = company.CompID; model.emCompProfileID = compProfile.CompProfileID; #endregion trans.Complete(); IsResult = true; } if (!IsResult) { DeleteMember(member.MemberID); DeleteMemberWeb(member.MemberID); DeleteMemberActivate(member.MemberID); DeleteCompany(member.MemberID); } } catch (Exception ex) { IsResult = false; } return(IsResult); }