protected void btnSave_Click(object sender, EventArgs e) { //if (Session["BranchID"] != null) //{ try { if (CurrentMemberID > 0) { using (TheFacade facade = new TheFacade()) { Member member = facade.MemberFacade.GetMemberById(CurrentMemberID); if (member != null && member.MemberVerificationStatus == (int)EnumCollection.VerificationStatus.Approved_for_Committee_Meeting) { member.MemberVerificationStatus = (int)EnumCollection.VerificationStatus.Completed; member.MembershipStatus = (int)EnumCollection.MembershipStatus.Approved; DateTime expireDate = new DateTime(DateTime.Now.Year, 6, 30); if (DateTime.Now.Date > expireDate) { expireDate = expireDate.AddYears(1); } try { expireDate = Convert.ToDateTime(txtExpireDate.Text); } catch (Exception ex) { } member.MembershipCode = txtMembershipCode.Text; facade.Update <Member>(member); Ins_MembershipExpireInfo info = new Ins_MembershipExpireInfo(); info.MemberID = member.ID; info.ExpireDate = expireDate.Date; info.CreateBy = 1; info.CreateDate = DateTime.Now; info.UpdateBy = 1; info.UpdateDate = DateTime.Now; info.IsRemoved = 0; facade.Insert <Ins_MembershipExpireInfo>(info); Ins_MemberVerification memberVerification = facade.MemberFacade.GetMemberVerificationByMemberID(member.ID); if (memberVerification != null) { memberVerification.Status = (int)EnumCollection.VerificationStatus.Completed; facade.Update <Ins_MemberVerification>(memberVerification); } Acc_ChartOfAccount chartofAcc = facade.AccountsFacade.GetAcc_ChartOfAccountByName("Account Receivable"); Acc_ChartOfAccountMember customerAccount = new Acc_ChartOfAccountMember(); #region acc Acc_ChartOfAccount newAccount = new Acc_ChartOfAccount(); newAccount.AccountNo = GenerateAccountNo(chartofAcc.Gparent.ToString()); newAccount.Name = member.Name; newAccount.IsActive = 1; newAccount.AccountTypeID = Convert.ToInt32(EnumCollection.AccountType.Transactable); newAccount.ParentID = chartofAcc.IID; newAccount.Gparent = chartofAcc.Gparent; newAccount.OpeningBalance = Convert.ToDecimal(txtOpeningBalance.Text); newAccount.CreateBy = 1; newAccount.UpdateBy = 1; newAccount.CreateDate = DateTime.Now; newAccount.UpdateDate = DateTime.Now; newAccount.IsRemoved = 0; facade.Insert <Acc_ChartOfAccount>(newAccount); #endregion customerAccount.ChartofAccountID = newAccount.IID; customerAccount.MemberID = member.ID; customerAccount.UpdateDate = DateTime.Now; customerAccount.UpdateBy = 1; customerAccount.CreateDate = DateTime.Now; customerAccount.CreateBy = 1; customerAccount.IsRemoved = 0; facade.Insert <Acc_ChartOfAccountMember>(customerAccount); } else { Session["duplicate"] = true; } } } else { using (TheFacade facade = new TheFacade()) { } } Session["IsSaved"] = true; } catch { Session["IsSaved"] = false; } finally { Response.Redirect(Request.Url.ToString()); } //} //else //{ // FormsAuthentication.SignOut(); // Roles.DeleteCookie(); // Session.Abandon(); // Response.Redirect("~/login.aspx"); //} }
//Account Number Generate public long GetMemberForAccount(long CurrentMemberID) { try { if (CurrentMemberID > 0) { using (TheFacade facade = new TheFacade()) { Member member = facade.MemberFacade.GetMemberById(CurrentMemberID); if (member != null) { member.MemberVerificationStatus = (int)EnumCollection.VerificationStatus.Completed; member.MembershipStatus = (int)EnumCollection.MembershipStatus.Approved; DateTime expireDate = new DateTime(DateTime.Now.Year, 6, 30); if (DateTime.Now.Date > expireDate) { expireDate = expireDate.AddYears(1); } try { expireDate = Convert.ToDateTime(txtExpireDate.Text); } catch (Exception ex) { } member.MembershipCode = txtMembershipCode.Text; facade.Update <Member>(member); Ins_MembershipExpireInfo info = new Ins_MembershipExpireInfo(); info.MemberID = member.ID; info.ExpireDate = expireDate.Date; info.CreateBy = 1; info.CreateDate = DateTime.Now; info.UpdateBy = 1; info.UpdateDate = DateTime.Now; info.IsRemoved = 0; facade.Insert <Ins_MembershipExpireInfo>(info); Ins_MemberVerification memberVerification = facade.MemberFacade.GetMemberVerificationByMemberID(member.ID); if (memberVerification != null) { memberVerification.Status = (int)EnumCollection.VerificationStatus.Completed; facade.Update <Ins_MemberVerification>(memberVerification); } Acc_ChartOfAccount chartofAcc = facade.AccountsFacade.GetAcc_ChartOfAccountByName("Account Receivable"); Acc_ChartOfAccountMember customerAccount = new Acc_ChartOfAccountMember(); #region acc Acc_ChartOfAccount newAccount = new Acc_ChartOfAccount(); newAccount.AccountNo = GenerateAccountNo(chartofAcc.Gparent.ToString()); newAccount.Name = member.Name; newAccount.IsActive = 1; newAccount.AccountTypeID = Convert.ToInt32(EnumCollection.AccountType.Transactable); newAccount.ParentID = chartofAcc.IID; newAccount.Gparent = chartofAcc.Gparent; newAccount.OpeningBalance = Convert.ToDecimal(txtOpeningBalance.Text); newAccount.CreateBy = 1; newAccount.UpdateBy = 1; newAccount.CreateDate = DateTime.Now; newAccount.UpdateDate = DateTime.Now; newAccount.IsRemoved = 0; facade.Insert <Acc_ChartOfAccount>(newAccount); #endregion customerAccount.ChartofAccountID = newAccount.IID; customerAccount.MemberID = member.ID; customerAccount.UpdateDate = DateTime.Now; customerAccount.UpdateBy = 1; customerAccount.CreateDate = DateTime.Now; customerAccount.CreateBy = 1; customerAccount.IsRemoved = 0; facade.Insert <Acc_ChartOfAccountMember>(customerAccount); } else { Session["duplicate"] = true; } } } else { using (TheFacade facade = new TheFacade()) { } } Session["IsSaved"] = true; } catch { Session["IsSaved"] = false; } finally { Response.Redirect(Request.Url.ToString()); } lablmessage.Text = " Registration & Account Create Succesfully"; return(CurrentMemberID); }