Exemple #1
0
        public void EditorMode()
        {
            User u = GetCurrentUser();

            u.GetPermissions();
            if (u.ChekPermission("Editor"))
            {
                punAlternAbonentEditor.Visible = true;
                gvJournal.Visible  = false;
                gvJournal2.Visible = true;
                BindDistricts();
                UniversalEntity      ue   = new UniversalEntity();
                AlternativeAbonent   aa   = new AlternativeAbonent();
                AlternativeAbonentDO aado = new AlternativeAbonentDO();
                ue = aado.RetrieveBySOrderID(_OrderID);
                if (ue.Count > 0)
                {
                    aa = (AlternativeAbonent)ue[0];
                    stbNumberJournalPhysical.Text = aa.PhysicalNumberJournal;
                    tbAddress.Text            = aa.Address;
                    stbClientSurname.Text     = aa.Surname;
                    stbClientName.Text        = aa.FirstName;
                    stbClientLastName.Text    = aa.LastName;
                    stbPhone.Text             = aa.Phone;
                    ddsDistrict.SelectedValue = aa.DistrictID.ToString();
                }
            }
            else
            {
                punAlternAbonentEditor.Visible = false;
                gvJournal.Visible  = true;
                gvJournal2.Visible = false;
            }
        }
Exemple #2
0
        public void Bind()
        {
            EditorMode();
            cbSeld.Checked = false;
            cbSeld.Enabled = true;
            cbPaid.Checked = false;
            cbPaid.Enabled = true;

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

            AlternativeOrder   ao   = new AlternativeOrder();
            AlternativeOrderDO aodo = new AlternativeOrderDO();
            UniversalEntity    ue   = new UniversalEntity();

            ue = aodo.RetrieveSOrderById(_OrderID);
            if (ue.Count > 0)
            {
                ao = (AlternativeOrder)ue[0];
                if (ao.DateOut != null)
                {
                    cbSeld.Checked = true;
                    cbSeld.Enabled = false;
                    cbPaid.Checked = true;
                    cbPaid.Enabled = false;
                }
                if (ao.IsPaid)
                {
                    cbPaid.Checked = true;
                    cbPaid.Enabled = false;
                    cbSeld.Checked = true;
                    cbSeld.Enabled = false;
                    if (ao.PaymentDay.HasValue)
                    {
                        tbPaymentDay.Text = ao.PaymentDay.Value.ToShortDateString();
                    }
                    tbPaymentDay.Enabled = false;
                }
            }

            hfODID.Value = _OrderID.ToString();
            StringBuilder        sb   = new StringBuilder();
            AlternativeAbonent   aa   = new AlternativeAbonent();
            AlternativeAbonentDO aado = new AlternativeAbonentDO();

            ue = aado.RetrieveBySOrderID(_OrderID);
            if (ue.Count > 0)
            {
                aa = (AlternativeAbonent)ue[0];
                sb.AppendLine("<span>ФИО: " + aa.Surname + " " + aa.FirstName + " " + aa.LastName + "</span><br/>");
                sb.AppendLine("<span>Номер по журналу: " + aa.PhysicalNumberJournal + "</span><br/>");
                sb.AppendLine("<span>Тел. " + aa.Phone + "</span><br/>");
                sb.AppendLine("<span>Адрес: " + aa.Address + "</span><br/>");

                AlternAbonentInfo.Text = sb.ToString();
            }
        }
Exemple #3
0
        protected void radbutSaveAlternativeAbonentInfo_OnClick(object sender, EventArgs e)
        {
            UniversalEntity      ue   = new UniversalEntity();
            AlternativeAbonent   aa   = new AlternativeAbonent();
            AlternativeAbonentDO aado = new AlternativeAbonentDO();

            ue = aado.RetrieveBySOrderID(Utilities.ConvertToInt(hfODID.Value));
            if (ue.Count > 0)
            {
                aa = (AlternativeAbonent)ue[0];
                aa.PhysicalNumberJournal = stbNumberJournalPhysical.Text;
                aa.FirstName             = stbClientName.Text;
                aa.Surname  = stbClientSurname.Text;
                aa.LastName = stbClientLastName.Text;
                aa.Phone    = stbPhone.Text;
                aa.Address  = tbAddress.Text;
                aado.UpdateWithHistory(aa, GetCurrentUser().ID);
            }

            _OrderID = Utilities.ConvertToInt(hfODID.Value);
            Bind();
        }
Exemple #4
0
        //генерация квитнации
        protected void btAlternativePay_Click(object sender, EventArgs e)
        {
            AlternativeAbonentDO aaDO = new AlternativeAbonentDO();
            AlternativeOrderDO   aoDO = new AlternativeOrderDO();
            VodomerType          vt   = new VodomerType();
            AlternativeOrder     ao;
            AlternativeAbonent   aa;
            UniversalEntity      ue = new UniversalEntity();
            int id = Convert.ToInt32(hfODID.Value);

            ue = aaDO.RetrieveBySOrderID(id);

            Vodomer   vod   = new Vodomer();
            VodomerDO vodDO = new VodomerDO();

            AlternativeOrderDetailsDO aodDO = new AlternativeOrderDetailsDO();
            AlternativeOrderDetails   aods  = new AlternativeOrderDetails();
            //FOrderDetails fod;
            double sum       = 0; //гривневая цена
            double getvat    = 0; //гривневый ндс
            double uafin     = 0; //гривневая итоговая сумма
            double sumrub    = 0; //рублевая цена
            double dissum    = 0; //цена демонтаж
            double instsum   = 0;
            double getvatrub = 0; //рублевый ндс
            double finish    = 0; //рублевая итоговая сумма

            if (ue.Count > 0)
            {
                aa = (AlternativeAbonent)ue[0];
                ue = aoDO.RetrieveSOrderById(id);
                if (ue.Count > 0)
                {
                    ao = (AlternativeOrder)ue[0];

                    ue = aodDO.RetrieveSOrderDetailsBySorderID(id);
                    foreach (AlternativeOrderDetails fod in ue)
                    {
                        //гривневый счет

                        /*sum += fod.Price;
                         * getvat = sum * 0.2;
                         * getvat = Math.Round(getvat, 2);
                         * uafin = (sum + getvat);*/
                        //рублевый счет
                        //sumrub += fod.ReplacementPrice;
                        dissum  += fod.DismantlingPrice;
                        instsum += fod.InstallPrice;
                        sumrub   = dissum + instsum;
                    }
                    using (DocX document = DocX.Load(Request.MapPath("~\\Templates/payaltern.docx")))
                    {
                        //DocXExtender.ReplaceFormatedText(document, "DDD", "дата");
                        document.ReplaceText("FIO", aa.FirstName + " " + aa.Surname + " " + aa.LastName, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("ADDRESS", aa.Address, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("PNONE", aa.Phone, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("DATE", DateTime.Now.ToString("dd MMMM yyyy"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("NUMBER", ao.Prefix + ao.ID.ToString(), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        //document.ReplaceText("VIEW", ao.WorkType, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        //document.ReplaceText("DIAMETR", vt.Diameter.ToString(), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        //document.ReplaceText("NOMZAVOD", vod.FactoryNumber.ToString(), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        //document.ReplaceText("SUM", sum.ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        //document.ReplaceText("VAT", getvat.ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        //document.ReplaceText("ALL", uafin.ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        //document.ReplaceText("CENA", sumrub.ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        //document.ReplaceText("NDS", getvatrub.ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("VSEGO", sumrub.ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);


                        //VODOMER
                        document.SaveAs(Request.MapPath("~\\Templates/alternativepay.docx"));
                        litScriptS.Text = "<iframe style=\"display:none;\" src=\"../GetDocument.ashx?alternativepay=Special\"></iframe>";
                    }
                }
            }
        }