コード例 #1
0
        //Сохраняем всё
        protected void lbSaveAll_Click(object sender, EventArgs e)
        {
            string errorMessage = string.Empty;
            bool   ok           = true;

            foreach (GridViewRow r in gvJournal.Rows)
            {
                if (string.IsNullOrEmpty((r.FindControl("litEndValue") as Literal).Text) && cbSeld.Checked)
                {
                    errorMessage  += "Необходимо заполнить конечные показания водомеров.<br/>";
                    ok             = false;
                    cbPaid.Checked = true;
                    break;
                }
            }
            if (cbPaid.Checked && string.IsNullOrEmpty(tbPaymentDay.Text))
            {
                ok             = false;
                cbSeld.Checked = true;
                errorMessage  += "Необходимо заполнить дату оплаты.<br/>";
            }

            else
            {
                NewFOrder   fo   = new NewFOrder();
                NewFOrderDO fodo = new NewFOrderDO();
                fo.ID            = Convert.ToInt32(hfODID.Value);
                fo.IsPaid        = cbPaid.Checked;
                fo.DefectVodomer = cbDefectVodomer.Checked;
                fo.UserID        = GetCurrentUser().ID;
                fo.PaymentDay    = Convert.ToDateTime(tbPaymentDay.Text);

                /*if (fo.PaymentDay.HasValue)
                 *  //fo.PaymentDay = Convert.ToDateTime(tbPaymentDay.Text);
                 *  tbPaymentDay.Text = fo.PaymentDay.Value.ToLongDateString();*/
                if (cbSeld.Checked)
                {
                    fo.DateOut = DateTime.Now;
                }
                bool rez = fodo.UpdateFOrder(fo);

                _OrderID = fo.ID;
                Bind();
            }
        }
コード例 #2
0
        public void EditorMode()
        {
            User u = GetCurrentUser();

            u.GetPermissions();
            //проверяем наличие прав для редактировнаия
            if (u.ChekPermission("Editor"))
            {
                punAdonentEditor.Visible = true;
                gvJournal.Visible        = false;
                gvJournal2.Visible       = true;
                BindDistricts();
                UniversalEntity ue   = new UniversalEntity();
                NewFAbonent     fa   = new NewFAbonent();
                NewFAbonentDO   fado = new NewFAbonentDO();
                ue = fado.RetrieveByOrderID(_OrderID);
                if (ue.Count > 0)
                {
                    fa = (NewFAbonent)ue[0];
                    tbNumberJournalPhysical.Text = fa.PhysicalNumberJournal;
                    tbAddress.Text            = fa.Address;
                    tbClientSurname.Text      = fa.Surname;
                    ddlDistrict.SelectedValue = fa.DistrictID.ToString();
                    tbClientName.Text         = fa.FirstName;
                    tbClientLastName.Text     = fa.LastName;
                    tbPhone.Text     = fa.Phone;
                    cbNotPay.Checked = fa.NotPay;
                    //cbRejectVodomer.Checked = fa.RejectVodomer;
                }
                NewFOrder   fo    = new NewFOrder();
                NewFOrderDO fodDO = new NewFOrderDO();
                ue = fodDO.RetrieveFOrderById(_OrderID);
                if (ue.Count > 0)
                {
                    fo = (NewFOrder)ue[0];
                    cbDefectVodomer.Checked = fo.DefectVodomer;
                }
            }
            else
            {
                punAdonentEditor.Visible = false;
                gvJournal.Visible        = true;
                gvJournal2.Visible       = false;
            }
        }
コード例 #3
0
        public void Bind()
        {
            EditorMode();
            cbSeld.Checked          = false;
            cbSeld.Enabled          = true;
            cbPaid.Checked          = false;
            cbPaid.Enabled          = true;
            cbRejectVodomer.Checked = false;
            cbRejectVodomer.Enabled = true;
            cbDefectVodomer.Checked = false;
            cbDefectVodomer.Enabled = true;


            tbPaymentDay.Enabled = true;
            tbPaymentDay.Text    = DateTime.Now.ToShortDateString();


            NewFOrder   fo   = new NewFOrder();
            NewFOrderDO fodo = new NewFOrderDO();
            //StringBuilder sbl = new StringBuilder();
            UniversalEntity ue = new UniversalEntity();

            ue = fodo.RetrieveFOrderById(_OrderID);
            if (ue.Count > 0)
            {
                fo = (NewFOrder)ue[0];

                if (fo.DateOut != null)
                {
                    cbSeld.Checked = true;
                    cbSeld.Enabled = false;
                    cbPaid.Checked = true;
                    cbPaid.Enabled = false;
                }
                if (fo.IsPaid)
                {
                    cbPaid.Checked = true;
                    cbPaid.Enabled = false;
                    cbSeld.Checked = true;
                    cbSeld.Enabled = false;
                    if (fo.PaymentDay.HasValue)
                    {
                        tbPaymentDay.Text = fo.PaymentDay.Value.ToShortDateString();
                    }
                    tbPaymentDay.Enabled = false;
                }
                if (fo.DefectVodomer)
                {
                    cbDefectVodomer.Checked = true;
                    cbDefectVodomer.Enabled = false;
                }
            }


            hfODID.Value = _OrderID.ToString();
            StringBuilder sb   = new StringBuilder();
            NewFAbonent   fa   = new NewFAbonent();
            NewFAbonentDO fado = new NewFAbonentDO();

            ue = fado.RetrieveByOrderID(_OrderID);
            if (ue.Count > 0)
            {
                fa = (NewFAbonent)ue[0];
                if (fa.NotPay)
                {
                    cbPaid.Enabled      = false;
                    btActRubNew.Enabled = false;
                    //btPay.Enabled = false;
                    //btOrder.Enabled = false;
                    //btOrderCheck.Enabled = false;
                    btNewActCheckRub.Enabled = false;
                    //btWithdrawalAct.Enabled = false;
                }
                sb.AppendLine("<span>ФИО: " + fa.Surname + " " + fa.FirstName + " " + fa.LastName + "</span><br/>");
                sb.AppendLine("<span>номер по журналу: " + fa.PhysicalNumberJournal + "</span><br/>");
                sb.AppendLine("<span>Тел.: " + fa.Phone + "</span><br/>");
                sb.AppendLine("<span>Адрес: " + fa.Address + "</span><br/>");
                if (fa.NotPay)
                {
                    sb.AppendLine("<span style=\"color:red;font-size:18px;\">Без оплаты</span><br/>");
                }



                litAbonentInfo2018.Text = sb.ToString();
            }
        }
コード例 #4
0
        //Сохранение в базу
        protected void lbSaveAll_Click(object sender, EventArgs e)
        {
            if (Session["Abonent"] != null)
            {
                SessionAbonent sa = (SessionAbonent)Session["Abonent"];
                if (sa.Vodomer.Count == 0)
                {
                    radWM.RadAlert("Необходимо добавить минимум 1 водомер.", null, null, "Предупреждение", "");
                }
                else
                {
                    if (sa.Type == (short)Abonent.Corporate)
                    {
                        UAbonent   ua   = sa.UAbon;
                        UAbonentDO uado = new UAbonentDO();
                        int        uid  = uado.Create(ua);
                        if (uid > 0)
                        {
                            sa.UAbon.ID        = uid;
                            Session["Abonent"] = sa;
                            UOrder   uo   = new UOrder();
                            UOrderDO uodo = new UOrderDO();
                            uo.ActionType = "*377;08;1;1 Опр. метр. хар.";
                            uo.UAbonentID = uid;
                            uo.UserID     = GetCurrentUser().ID;

                            int uoid = uodo.Create(uo);
                            if (uoid > 0)
                            {
                                hfOrder.Value = uoid.ToString();
                                UOrderDetails   uod   = new UOrderDetails();
                                UOrderDetailsDO uoddo = new UOrderDetailsDO();
                                VodomerDO       vdo   = new VodomerDO();
                                foreach (Vodomer v in sa.Vodomer)
                                {
                                    int vid = vdo.Create1(v);
                                    uod.UOrderID   = uoid;
                                    uod.VodomerID  = vid;
                                    uod.StartValue = v.VodomerPreview.StartValue;
                                    int uodid = uoddo.Create(uod);
                                }
                                Response.Redirect("UJournal.aspx?id=" + uoid.ToString());
                            }
                        }
                    }
                    if (sa.Type == (short)Abonent.Private)
                    {
                        NewFAbonent   fa   = sa.FAbon;
                        NewFAbonentDO fado = new NewFAbonentDO();
                        int           fid  = fado.Create(fa);
                        if (fid > 0)
                        {
                            sa.FAbon.ID        = fid;
                            Session["Abonent"] = sa;
                            NewFOrder   fo   = new NewFOrder();
                            NewFOrderDO fodo = new NewFOrderDO();
                            fo.ActionType = "*377;08;1;0 Проведение периодической поверки счетчика";
                            fo.FAbonentID = fid;
                            fo.UserID     = GetCurrentUser().ID;

                            int foid = fodo.Create(fo);
                            if (foid > 0)
                            {
                                hfOrder.Value = foid.ToString();
                                FOD2018             fod   = new FOD2018();
                                FOrderDetails2018DO foddo = new FOrderDetails2018DO();
                                VodomerDO           vdo   = new VodomerDO();
                                foreach (Vodomer v in sa.Vodomer)
                                {
                                    int vid = vdo.Create1(v);
                                    fod.FOrderID   = foid;
                                    fod.VodomerID  = vid;
                                    fod.StartValue = v.VodomerPreview.StartValue;
                                    int uodid = foddo.CreateFOrderDetails(fod);
                                }
                                Response.Redirect("FJournal2018.aspx?id=" + foid.ToString());
                            }
                        }
                    }
                    if (sa.Type == (short)Abonent.Special)
                    {
                        AlternativeAbonent   sab  = sa.AlternativeAbon;
                        AlternativeAbonentDO sabo = new AlternativeAbonentDO();
                        int fid = sabo.Create(sab);
                        if (fid > 0)
                        {
                            sa.AlternativeAbon.ID = fid;
                            Session["Abonent"]    = sa;
                            AlternativeOrder   so  = new AlternativeOrder();
                            AlternativeOrderDO sod = new AlternativeOrderDO();
                            so.WorkType   = "*377;09;1;1 Снятие/установка водомеров.";
                            so.SAbonentID = fid;
                            so.UserID     = GetCurrentUser().ID;

                            int soid = sod.CreateSOrder(so);
                            if (soid > 0)
                            {
                                hfOrder.Value = soid.ToString();
                                AlternativeOrderDetails   sd    = new AlternativeOrderDetails();
                                AlternativeOrderDetailsDO sodDO = new AlternativeOrderDetailsDO();
                                VodomerDO vdo = new VodomerDO();
                                foreach (Vodomer v in sa.Vodomer)
                                {
                                    int vid = vdo.Create1(v);
                                    sd.SOrderID   = soid;
                                    sd.VodomerID  = vid;
                                    sd.StartValue = v.VodomerPreview.StartValue;
                                    int uodid = sodDO.Create(sd);
                                }
                                Response.Redirect("SJournal.aspx?id=" + soid.ToString());
                            }
                        }
                    }
                    // LoadStep3();
                }
            }
        }