protected void btnInsert_Click(object sender, EventArgs e) { List <RollBackDistributionCompanyInfo> finalList = listSelected; GridViewRowCollection displayedRows = gvSelectedRollBаcks.Rows; foreach (GridViewRow gvRow in displayedRows) { CheckBox cbIsForRollBack = gvRow.FindControl("cbSelected") as CheckBox; int rollBackID = Convert.ToInt32(gvSelectedRollBаcks.DataKeys[gvRow.RowIndex].Value); RollBackDistributionCompanyInfo fi = finalList.Where(c => c.ID == rollBackID).SingleOrDefault(); fi.IsForRollBack = cbIsForRollBack.Checked; } if (finalList.Where(c => c.IsForRollBack).ToList().Count > 0) { if (RollBackDistribution.CanMakeGroupRollBack(finalList.Where(c => c.IsForRollBack).ToList())) { lblError.Visible = false; RollBackDistribution.InsertForCompany(finalList.Where(c => c.IsForRollBack).ToList(), this.PageUser.ID); } else { lblError.Text = "Имате избрано раздолжници од повеќе компании"; lblError.Visible = true; } } else { lblError.Text = "Немате селектирано ниту една раздолжница"; lblError.Visible = true; } }
public static void InsertForCompany(List <RollBackDistributionCompanyInfo> finalList, int userID) { RollBackDistribution rdb = new RollBackDistribution(); rdb.BranchID = null; decimal[] values = getSums(finalList); rdb.BrokerageValue = values[1]; rdb.TotalValue = values[0]; rdb.StartDate = RollBackDistributionCompanyInfo.getDate(finalList, true); rdb.EndDate = RollBackDistributionCompanyInfo.getDate(finalList, false); rdb.Date = DateTime.Now; rdb.InsuranceCompanyID = finalList.First().InsuranceCompanyID; rdb.Number = GetNextNumber(); rdb.RollBackStatusID = RollBackDistributionStatuse.GetByCode(RollBackDistributionStatuse.NEPOTVRDENA_OD_KOMPANIJA).ID; rdb.UserID = userID; rdb.Insert(); RollBackDistributionStatuse finalized = RollBackDistributionStatuse.GetByCode(RollBackDistributionStatuse.ZAVRSENA_OD_FILIJALA); foreach (RollBackDistributionCompanyInfo info in finalList) { RollBackDistribution.Get(info.ID).RollBackStatusID = finalized.ID; Table.Context.SubmitChanges(); RollBackDistributionItem.InsertForCompany(info, rdb.ID); RollBackDistributionParentship.InsertParentShip(rdb.ID, info.ID); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { mvMain.SetActiveView(viewGrid); reportControl.BranchName = BrokerHouseInformation.GetBrokerHouseNameByCode(BrokerHouseInformation.FIRST_ROW); reportControl.CompanyName = "Брокерско друштво"; GXGridView1.TotalRecords = RollBackDistributionCompanyInfo.SelectCountCached(); list = RollBackDistributionCompanyInfo.Select().ToList(); } }
public static void InsertForCompany(RollBackDistributionCompanyInfo info, int rbdID) { List <RollBackDistributionItem> items = RollBackDistributionItem.GetByRollBackDistibution(info.ID); foreach (RollBackDistributionItem item in items) { RollBackDistributionItem newItem = new RollBackDistributionItem(); newItem.RollBackDistributionID = rbdID; newItem.PolicyItemID = item.PolicyItemID; newItem.Insert(); } }
protected void GXGridView1_PageChanged(object sender, GridViewPageEventArgs e) { List <RollBackDistributionCompanyInfo> distList = list; GridViewRowCollection displayedRows = GXGridView1.Rows; foreach (GridViewRow gvRow in displayedRows) { CheckBox cbIsForRollBack = gvRow.FindControl("cbSelected") as CheckBox; int rollBackID = Convert.ToInt32(GXGridView1.DataKeys[gvRow.RowIndex].Value); RollBackDistributionCompanyInfo fi = distList.Where(c => c.ID == rollBackID).SingleOrDefault(); fi.IsForRollBack = cbIsForRollBack.Checked; } list = distList; GXGridView1.PageIndex = e.NewPageIndex; GXGridView1.DataSourceID = null; GXGridView1.DataSource = distList; GXGridView1.DataBind(); }
protected void btnConfirm_Click(object sender, EventArgs e) { List <RollBackDistributionCompanyInfo> distList = list; GridViewRowCollection displayedRows = GXGridView1.Rows; foreach (GridViewRow gvRow in displayedRows) { CheckBox cbIsForRollBack = gvRow.FindControl("cbSelected") as CheckBox; int rollBackID = Convert.ToInt32(GXGridView1.DataKeys[gvRow.RowIndex].Value); RollBackDistributionCompanyInfo fi = distList.Where(c => c.ID == rollBackID).SingleOrDefault(); fi.IsForRollBack = cbIsForRollBack.Checked; } list = distList; List <RollBackDistributionCompanyInfo> infos = list.Where(c => c.IsForRollBack == true).ToList(); listSelected = infos; gvSelectedRollBаcks.DataSource = infos; gvSelectedRollBаcks.DataBind(); mvMain.SetActiveView(viewSelected); btnInsert.Enabled = true; }