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; }