protected void btnSetEngeneer_OnClick(object sender, EventArgs e) { try { int idServiceEngeneer = MainHelper.DdlGetSelectedValueInt(ref ddlServiceEngeneer); string[] arrC2dIds = hfCheckedContractorsDevices.Value.Split(','); List<int> shownItemList = new List<int>(); foreach (RepeaterItem ctrItem in tblContractorList.Items) { var tblDeviceList = (ctrItem.FindControl("tblDeviceList") as Repeater); bool hasChanged = false; foreach (RepeaterItem item in tblDeviceList.Items) { //CheckBox chkSetClaim = (CheckBox)item.FindControl("chkSetClaim"); HiddenField hfIdContract2Devices = (HiddenField)item.FindControl("hfIdContract2Devices"); int idContract2Devices = MainHelper.HfGetValueInt32(ref hfIdContract2Devices); if (arrC2dIds.Contains(idContract2Devices.ToString())) { //DropDownList ddlServiceEngeneer = (DropDownList)row.FindControl("ddlServiceEngeneer"); //int idServiceEngeneer = MainHelper.DdlGetSelectedValueInt(ref ddlServiceEngeneer); HiddenField hfIdClaim = (HiddenField)item.FindControl("hfIdClaim"); int idClaim = MainHelper.HfGetValueInt32(ref hfIdClaim); ServiceClaim claim = new ServiceClaim() { Id = idClaim, IdContract2Devices = idContract2Devices, IdServiceEngeneer = idServiceEngeneer, IdCreator = User.Id }; claim.Save(); hasChanged = true; } } if (hasChanged) { shownItemList.Add(ctrItem.ItemIndex); } } tblContractorList.DataBind(); foreach (RepeaterItem ctrItem in tblContractorList.Items) { if (shownItemList.Contains(ctrItem.ItemIndex)) { ShowDevices(ctrItem.ItemIndex, true); } } ClearCheckedRows(); //ShowOpenedDeviceLists(); //RedirectWithParams(); } catch (Exception ex) { ServerMessageDisplay(new[] { phServerMessage }, ex.Message, true); } }
private string[] GetSelectedDeviceValues(Repeater rtr) { List<string> lst = new List<string>(); foreach (RepeaterItem item in rtr.Items) { var chkIdC2d = item.FindControl("chkIdC2d") as CheckBox; if (chkIdC2d != null && chkIdC2d.Checked) { lst.Add(chkIdC2d.Attributes["Value"]); } } return lst.ToArray(); }
private ServiceClaim GetFormData() { int[] lstDeviceIds; ////При редактировании выводится только то устройство, которое на которое составлена заявка без возможности изменить if (OneDeviceList) { lstDeviceIds = new[] { MainHelper.DdlGetSelectedValueInt(ref ddlDevice) }; } else { //lstDeviceIds = MainHelper.ChkListGetCheckedValuesInt(ref chklDeviceList); List<int> lstC2d = new List<int>(); foreach (RepeaterItem item in rtrDeviceList.Items) { var chkIdC2d = item.FindControl("chkIdC2d") as CheckBox; if (chkIdC2d != null && chkIdC2d.Checked) { int idC2d = Convert.ToInt32(chkIdC2d.Attributes["Value"]); lstC2d.Add(idC2d); } } //string[] strDevIds = hfLstCheckedDeviceIds.Value.Split(','); //foreach (string id in strDevIds) //{ // int idC2d; // int.TryParse(id, out idC2d); // lstC2d.Add(idC2d); //} lstDeviceIds = lstC2d.ToArray(); } ServiceClaim serviceClaim = new ServiceClaim { Id = Id, LstIdContract2Devices = lstDeviceIds, //IdContract = MainHelper.DdlGetSelectedValueInt(ref ddlContract), IdDevice = MainHelper.DdlGetSelectedValueInt(ref ddlDevice), IdServiceClaimType = MainHelper.DdlGetSelectedValueInt(ref ddlServiceClaimType), IdServiceEngeneer = MainHelper.DdlGetSelectedValueInt(ref ddlServiceEngeneer, true), PlaningDate = MainHelper.TxtGetTextDateTime(ref txtPlaningDate, true), Descr = MainHelper.TxtGetText(ref txtDescr), IdCreator = User.Id }; //serviceClaim.OrderNum ??? return serviceClaim; }
protected override void FillFilterLinksDefaults() { //Если заполненный, занчит уже с умолчаниями if (FilterLinks != null) return; FilterLinks = new List<FilterLink>(); FilterLinks.Add(new FilterLink("ctr", ddlContractor)); FilterLinks.Add(new FilterLink("cit", ddlCity)); FilterLinks.Add(new FilterLink("addr", ddlAddress)); FilterLinks.Add(new FilterLink("sadm", ddlServiceAdmin)); FilterLinks.Add(new FilterLink("mth", txtDateMonth, DateTime.Now.ToString("MM.yyyy"))); //FilterLinks.Add(new FilterLink("rcnt", txtRowsCount, "30")); FilterLinks.Add(new FilterLink("nst", rblNoSet, "-13")); FilterLinks.Add(new FilterLink("dne", rblDone, "-13")); BtnSearchClientId = btnSearch.ClientID; }