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 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;
        }
        private void FillFormData(ServiceClaim serviceClaim)
        {
            FormTitle = Id == 0 ? "Добавление выезда на обслуживание" : String.Format("Редактирование выезда №{0}", serviceClaim.Number);

            //MainHelper.DdlSetSelectedValue(ref ddlContract, serviceClaim.IdContract);

            if (OneDeviceList)
            {
                DataTable dtDevices = Db.Db.Srvpl.GetContract2DevicesSelectionList(serviceClaim.IdContract, serviceClaim.IdDevice);
                MainHelper.DdlFill(ref ddlDevice, dtDevices);
                //При редактировании выводим только то устройство, которое на которое составлена заявка без возможности изменить
                MainHelper.DdlSetSelectedValue(ref ddlDevice, serviceClaim.IdDevice, false);
                txtContractSelection.Enabled =
                    ddlContract.Enabled = false;
            }
            else
            {
                //foreach (ListItem li in chklDeviceList.Items)
                //{
                //    li.Selected = true;
                //}

                foreach (RepeaterItem item in rtrDeviceList.Items)
                {
                    var chkIdC2d = item.FindControl("chkIdC2d") as CheckBox;

                    if (chkIdC2d != null)
                    {
                        chkIdC2d.Checked = true;
                        //if (String.IsNullOrEmpty(hfLstCheckedDeviceIds.Value))
                        //{
                        //    hfLstCheckedDeviceIds.Value += chkIdC2d.Attributes["Value"];
                        //}
                        //else
                        //{
                        //    hfLstCheckedDeviceIds.Value += String.Format(",{0}", chkIdC2d.Attributes["Value"]);
                        //}
                        //chkIdC2d_OnCheckedChanged(chkIdC2d, new EventArgs());
                    }
                }
            }

            MainHelper.HfSetValue(ref hfIdContract2Devices, serviceClaim.IdContract2Devices);
            MainHelper.DdlSetSelectedValue(ref ddlServiceClaimType, serviceClaim.IdServiceClaimType);
            MainHelper.DdlSetSelectedValue(ref ddlServiceEngeneer, serviceClaim.IdServiceEngeneer);
            //MainHelper.TxtSetDate(ref txtPlaningDate, serviceClaim.PlaningDate);
            MainHelper.TxtSetText(ref txtPlaningDate, String.Format("{0:MM/yyyy}", serviceClaim.PlaningDate ?? DateTime.Now));
            MainHelper.TxtSetText(ref txtDescr, serviceClaim.Descr);
        }
        protected new void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            FormPartsDisplay();
            FormAdditions();

            if (!IsPostBack)
            {
                FormTitle = "Добавление выезда на обслуживание";

                ServiceClaim serviceClaim = new ServiceClaim();

                if (Id > 0)
                {
                    serviceClaim = new ServiceClaim(Id);
                }

                FillFormData(serviceClaim);

            }

            RegisterStartupScripts();
        }
        private ServiceClaim GetFormData()
        {
            int[] lstDeviceIds;

            //При редактировании выводится только то устройство, которое на которое составлена заявка без возможности изменить
            if (OneDeviceList)
            {
                lstDeviceIds = new[] { MainHelper.DdlGetSelectedValueInt(ref ddlDevice) };
            }
            else
            {
                lstDeviceIds = MainHelper.ChkListGetCheckedValuesInt(ref chklDeviceList);
            }

            ServiceClaim serviceClaim = new ServiceClaim
            {
                Id = Id,
                IdContract = MainHelper.DdlGetSelectedValueInt(ref ddlContract),
                LstIdDevice = lstDeviceIds,
                IdServiceType = MainHelper.DdlGetSelectedValueInt(ref ddlServiceType),
                IdServiceEngeneer = MainHelper.DdlGetSelectedValueInt(ref ddlServiceEngeneer, true),
                PlaningDate = MainHelper.TxtGetTextDateTime(ref txtPlaningDate, true),
                Descr = MainHelper.TxtGetText(ref txtDescr),
                IdCreator = User.Id
            };

            //serviceClaim.OrderNum ???

            return serviceClaim;
        }
        private void FillFormData(ServiceClaim serviceClaim)
        {
            FormTitle = Id == 0 ? "Добавление выезда на обслуживание" : String.Format("Редактирование выезда №{0}", serviceClaim.Number);

            //MainHelper.DdlSetSelectedValue(ref ddlContract, serviceClaim.IdContract);

            if (OneDeviceList)
            {
                //txtContractSelection.Enabled =
                    ddlContract.Enabled = false;
            }

            if (OneDeviceList)
            {
                //При редактировании выводим только то устройство, которое на которое составлена заявка без возможности изменить
                MainHelper.DdlSetSelectedValue(ref ddlDevice, serviceClaim.LstIdDevice[0], false);
            }
            else
            {
                foreach (ListItem li in chklDeviceList.Items)
                {
                    li.Selected = true;
                }
            }

            MainHelper.DdlSetSelectedValue(ref ddlServiceType, serviceClaim.IdServiceType);
            MainHelper.DdlSetSelectedValue(ref ddlServiceEngeneer, serviceClaim.IdServiceEngeneer);
            MainHelper.TxtSetDate(ref txtPlaningDate, serviceClaim.PlaningDate);
            MainHelper.TxtSetText(ref txtDescr, serviceClaim.Descr);
        }
Exemple #7
0
 private void Save()
 {
     ServiceCame serviceCame = GetFormData();
     string serialNum = MainHelper.TxtGetText(ref txtClaimSelection);
     serviceCame.Save(UserIsSysAdmin, serialNum);
     ServiceClaim serviceClaim = new ServiceClaim(serviceCame.IdServiceClaim);
     string messageText = String.Format("Сохранение отметки об обслуживании заявки № {0} прошло успешно", serviceClaim.Number);
     ServerMessageDisplay(new[] { phServerMessage }, messageText);
 }
Exemple #8
0
        private void FillFormData(ServiceCame serviceCame)
        {
            ServiceClaim serviceClaim = new ServiceClaim(serviceCame.IdServiceClaim);

            FormTitle = String.Format("Отметка об обслуживании заявки №{0}", serviceClaim.Number);

            if (Id > 0)
            {
                FillClaimList(null, serviceCame.Id);
                MainHelper.TxtSetText(ref txtClaimSelection, String.Empty, false);
            }

            MainHelper.LbSetSelectedValue(ref lbClaim, serviceCame.IdServiceClaim);

            SetDateCaberBorder(serviceClaim.PlaningDate.Value);

            MainHelper.DdlSetSelectedValue(ref ddlServiceActionType, serviceCame.IdServiceActionType);
            MainHelper.DdlSetSelectedValue(ref ddlServiceEngeneer, serviceCame.IdServiceEngeneer);
            MainHelper.TxtSetText(ref txtCounter, serviceCame.Counter);
            MainHelper.TxtSetText(ref txtCounterColour, serviceCame.CounterColour);
            MainHelper.TxtSetDate(ref txtDateCame, serviceCame.DateCame);
            MainHelper.TxtSetText(ref txtDescr, serviceClaim.Descr);
            MainHelper.RblSetValue(ref rblProcessEnabled, serviceCame.ProcessEnabled);
            MainHelper.RblSetValue(ref rblDeviceEnabled, serviceCame.DeviceEnabled);
            MainHelper.RblSetValue(ref rblNeedZip, serviceCame.NeedZip);
            MainHelper.RblSetValue(ref rblNoCounter, serviceCame.NoCounter);
            MainHelper.RblSetValue(ref rblCounterUnavailable, serviceCame.CounterUnavailable);
            MainHelper.RblSetValue(ref rblNoPay, serviceCame.NoPay);
            MainHelper.TxtSetText(ref txtZipDescr, serviceCame.ZipDescr);
            MainHelper.TxtSetText(ref txtDateWorkStart, serviceCame.DateWorkStart);
            MainHelper.TxtSetText(ref txtDateWorkEnd, serviceCame.DateWorkEnd);
        }
        private void FillFormData(ServiceCame serviceCame)
        {
            ServiceClaim serviceClaim = new ServiceClaim(serviceCame.IdServiceClaim);

            FormTitle = String.Format("Отметка об обслуживании заявки №{0}", serviceClaim.Number);

            if (Id > 0)
            {
                FillClaimList(null, serviceCame.Id);
                MainHelper.TxtSetText(ref txtClaimSelection, String.Empty, false);
            }

            MainHelper.LbSetSelectedValue(ref lbClaim, serviceCame.IdServiceClaim);

            SetDateCaberBorder(serviceClaim.PlaningDate.Value);

            MainHelper.DdlSetSelectedValue(ref ddlServiceActionType, serviceCame.IdServiceActionType);
            MainHelper.DdlSetSelectedValue(ref ddlServiceEngeneer, serviceCame.IdServiceEngeneer);
            MainHelper.TxtSetText(ref txtCounter, serviceCame.Counter);
            MainHelper.TxtSetText(ref txtCounterColour, serviceCame.CounterColour);
            MainHelper.TxtSetDate(ref txtDateCame, serviceCame.DateCame);
            //MainHelper.TxtSetText(ref txtDescr, serviceClaim.Descr);
        }