Ejemplo n.º 1
0
 void AddParametresToSqlCommand(AlternativeOrderDetails ent, ref SqlCommand sc)
 {
     sc.Parameters.Add("@SOrderID", ent.SOrderID);
     sc.Parameters.Add("@VodomerID", ent.VodomerID);
     sc.Parameters.Add("@StartValue", ent.StartValue);
     // sc.Parameters.Add("@EndValue", ent.EndValue);
     // sc.Parameters.Add("@SpecialPrice", ent.SpecialPrice);
 }
Ejemplo n.º 2
0
        public AlternativeOrderDetails createEntityFromReader(SqlDataReader dr)
        {
            AlternativeOrderDetails ent = new AlternativeOrderDetails();

            if (!dr.IsDBNull(dr.GetOrdinal("ID")))
            {
                ent.ID = Convert.ToInt32(dr["ID"]);
            }

            if (!dr.IsDBNull(dr.GetOrdinal("SOrderID")))
            {
                ent.SOrderID = Convert.ToInt32(dr["SOrderID"]);
            }

            if (!dr.IsDBNull(dr.GetOrdinal("VodomerID")))
            {
                ent.VodomerID = Convert.ToInt32(dr["VodomerID"]);
            }

            if (!dr.IsDBNull(dr.GetOrdinal("StartValue")))
            {
                ent.StartValue = dr["StartValue"].ToString();
            }

            if (!dr.IsDBNull(dr.GetOrdinal("EndValue")))
            {
                ent.EndValue = dr["EndValue"].ToString();
            }

            if (!dr.IsDBNull(dr.GetOrdinal("SpecialPrice")))
            {
                ent.SpecialPrice = Convert.ToDouble(dr["SpecialPrice"]);
            }

            if (!dr.IsDBNull(dr.GetOrdinal("ReplacementPrice")))
            {
                ent.ReplacementPrice = Convert.ToDouble(dr["ReplacementPrice"]);
            }

            if (!dr.IsDBNull(dr.GetOrdinal("DismantlingPrice")))
            {
                ent.DismantlingPrice = Convert.ToDouble(dr["DismantlingPrice"]);
            }

            if (!dr.IsDBNull(dr.GetOrdinal("InstallPrice")))
            {
                ent.InstallPrice = Convert.ToDouble(dr["InstallPrice"]);
            }

            if (!dr.IsDBNull(dr.GetOrdinal("PhysicalPrice")))
            {
                ent.PhysicalPrice = Convert.ToDouble(dr["PhysicalPrice"]);
            }

            return(ent);
        }
Ejemplo n.º 3
0
        public int Create(AlternativeOrderDetails ent)
        {
            int createid = 0;
            AlternativeOrderDetailsDAO entDAO = new AlternativeOrderDetailsDAO();

            sc             = new SqlCommand("CreateSOrderDetails");
            sc.CommandType = CommandType.StoredProcedure;
            addParametres(ent);
            createid = entDAO.createEntity(sc);
            return(createid);
        }
Ejemplo n.º 4
0
        public override UniversalEntity createEntity()
        {
            UniversalEntity ue = new UniversalEntity();

            while (dr.Read())
            {
                AlternativeOrderDetails ent = new AlternativeOrderDetails();
                ent = createEntityFromReader(dr);
                ue.Add(ent);
            }
            return(ue);
        }
Ejemplo n.º 5
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>";
                    }
                }
            }
        }
Ejemplo n.º 6
0
 void addParametres(AlternativeOrderDetails ent)
 {
     AddParametresToSqlCommand(ent, ref sc);
 }
Ejemplo n.º 7
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();
                }
            }
        }
Ejemplo n.º 8
0
        //Сохранение в базу
        protected void lbSaveAll_Click(object sender, EventArgs e)
        {
            if (Session["Abonent"] != null)
            {
                SessionAbonent sa = (SessionAbonent)Session["Abonent"];
                if (sa.Vodomer.Count == 0)
                {
                    SetMessege("Предупреждение", "Необходимо добавить минимум 1 водомер.");
                }
                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 = "Определения метрологических характеристик водомера.";
                            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.Create(v);
                                    uod.UOrderID   = uoid;
                                    uod.VodomerID  = vid;
                                    uod.StartValue = v.VodomerPreview.StartValue;
                                    int uodid = uoddo.Create(uod);
                                }
                            }
                        }
                    }
                    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;
                            FOrder2018   fo   = new FOrder2018();
                            FOrder2018DO fodo = new FOrder2018DO();
                            fo.ActionType = "Определения метрологических характеристик водомера.";
                            fo.FAbonentID = fid;
                            fo.UserID     = GetCurrentUser().ID;

                            int foid = fodo.CreateFOrder(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.Create(v);
                                    fod.FOrderID   = foid;
                                    fod.VodomerID  = vid;
                                    fod.StartValue = v.VodomerPreview.StartValue;
                                    int uodid = foddo.CreateFOrderDetails(fod);
                                }
                            }
                        }
                    }
                    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   = "Снятие/установка водомеров.";
                            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.Create(v);
                                    sd.SOrderID   = soid;
                                    sd.VodomerID  = vid;
                                    sd.StartValue = v.VodomerPreview.StartValue;
                                    int uodid = sodDO.Create(sd);
                                }
                            }
                        }
                    }
                    //SetMessege("Статус", "Абонент и водомер успешно внесены в базу.");
                    LoadStep3();
                }
            }
        }