コード例 #1
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();
                }
            }
        }
コード例 #2
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();
                }
            }
        }