private void detach_LoanGroups(LoanGroup entity) { this.SendPropertyChanging(); entity.AccountType = null; }
partial void DeleteLoanGroup(LoanGroup instance);
partial void UpdateLoanGroup(LoanGroup instance);
partial void InsertLoanGroup(LoanGroup instance);
/// <summary> /// Creates a member account and automatically creates an investment for the member and returns the member id /// </summary> /// <param name="group"></param> /// <param name="enumIvestmentType"></param> /// <returns></returns> //public static int createAccountForGroup(LoanGroup group, EnumInvestmentTypes enumIvestmentType, bool AutoGenerateAccountNumber) //{ // using (FinanceManagerDataContext db = new FinanceManagerDataContext()) // { // group.Investments.Add(new Investment() { InvestmentTypeId = (int)enumIvestmentType, IsActive = true, CreatedDate = DateTime.Now }); // db.LoanGroups.InsertOnSubmit(group); // db.SubmitChanges(); // if (AutoGenerateAccountNumber) // { // group.AccountNumber = Utils.GenerateAccountNumber(group.GroupId); // db.SubmitChanges(); // } // } // return group.GroupId; //} /// <summary> /// Creates a member account and automatically creates an investment for the member and returns the member id /// </summary> /// <param name="group"></param> /// <param name="enumIvestmentType"></param> /// <returns></returns> public static int createAccountForGroup(LoanGroup group, AccountType accountType, bool AutoGenerateAccountNumber) { using (FinanceManagerDataContext db = new FinanceManagerDataContext()) { group.Investments.Add(new Investment() { InvestmentTypeId = accountType.DefaultInvestmentTypeID, IsActive = true, CreatedDate = DateTime.Now, IsDeleted = false , AccountTypeId = accountType.AccountTypeId}); group.CreatedDate = DateTime.Now; db.LoanGroups.InsertOnSubmit(group); db.SubmitChanges(); if (AutoGenerateAccountNumber) { group.AccountNumber = Utils.GenerateAccountNumber(group.AccountTypeId.Value, group.BranchID.Value); db.SubmitChanges(); } } return group.GroupId; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["GroupId"] != null) { CurrentLoanGroup = db.LoanGroups.FirstOrDefault(g => g.GroupId == Convert.ToInt32(Request.QueryString["GroupId"])); txtGroupName.Text = CurrentLoanGroup.GroupName.ToString(); txtDecription.Text = CurrentLoanGroup.Description.ToString(); txtAccountNumber.Text = CurrentLoanGroup.AccountNumber; cboBranches.SelectedValue = CurrentLoanGroup.BranchID.ToString(); GetAllNonGroupMembers(CurrentLoanGroup.GroupId); GetGroupMembers(CurrentLoanGroup.GroupId); lstMembers.DataSource = GroupMembers; lstMembers.DataTextField = "Member"; lstMembers.DataValueField = "MemberId"; lstMembers.DataBind(); lstNonMembers.DataSource = NonGroupMembers; lstNonMembers.DataTextField = "Member"; lstNonMembers.DataValueField = "MemberId"; lstNonMembers.DataBind(); //HyperLink1.NavigateUrl = "GroupWithdrawal.aspx?gid=" + CurrentLoanGroup.GroupId; //HyperLink2.NavigateUrl = "GroupDeposit.aspx?gid=" + CurrentLoanGroup.GroupId; InvestmentHyperLink.NavigateUrl = "GroupInvestments.aspx?gid=" + CurrentLoanGroup.GroupId; LoanHyperLink.NavigateUrl = "GroupLoansLoans.aspx?gid=" + CurrentLoanGroup.GroupId; try { DropDownList1.SelectedValue = CurrentLoanGroup.AccountTypeId.ToString(); } catch (Exception) { } } else { //get the current group id when a group id is passed. //if (Request.QueryString["GroupId"] != null) // CurrentLoanGroup = db.LoanGroups.FirstOrDefault(g => g.GroupId == Convert.ToInt32(Request.QueryString["GroupId"])); CurrentLoanGroup = new LoanGroup(); GroupMembers = new List<MembersView>(); GetAllNonGroupMembers(CurrentLoanGroup.GroupId); GetGroupMembers(CurrentLoanGroup.GroupId); lstMembers.DataSource = GroupMembers.OrderBy( g => g.Member).ToList(); lstMembers.DataTextField = "Member"; lstMembers.DataValueField = "MemberId"; lstMembers.DataBind(); lstNonMembers.DataSource = NonGroupMembers.OrderBy( g => g.Member).ToList(); lstNonMembers.DataTextField = "Member"; lstNonMembers.DataValueField = "MemberId"; lstNonMembers.DataBind(); } } }