/// <summary> /// Получение инфы об абоненте /// </summary> /// <param name="id">ID абонента</param> /// <returns>Разметка для вывода информации об абоненте.</returns> StringBuilder GetAbonentInfo(int id) { UniversalEntity ue = new UniversalEntity(); StringBuilder sb = new StringBuilder(); UAbonent ua = new UAbonent(); UAbonentDO uado = new UAbonentDO(); ue = uado.RetrieveByOrderID(id); if (ue.Count > 0) { ua = (UAbonent)ue[0]; hfOKPO.Value = ua.OKPO; //Вывод инфы об абоненте hfBudjet.Value = ua.IsBudget ? "1" : "0"; sb.AppendLine("<span><b>" + ua.Title + " " + ua.DogID.ToString() + "</b></span><br/>"); sb.AppendLine("<span> <b>ОКПО:</b> " + ua.OKPO + "</span> "); sb.AppendLine("<span><b>МФО</b>: " + ua.MFO + "</span> "); sb.AppendLine("<span><b>Р/С:</b> " + ua.RS + "</span><br/>"); sb.AppendLine("<span><b>ИНН:</b> " + ua.INN + "</span> "); sb.AppendLine("<span><b>Св. пл НДС:</b> " + ua.VATPay + "</span><br/>"); sb.AppendLine("<span><b>Договор:</b> " + ua.Contract + "</span><br/>"); if (ua.IsBudget) { sb.AppendLine("<span><b>Бюджет</b></span><br/>"); } sb.AppendLine("<span><b>Банк: </b>" + ua.Bank + "</span><br/>"); sb.AppendLine("<span><b>Адрес:</b> " + ua.Address + "</span><br/>"); sb.AppendLine("<span><b>Телефон:</b> " + ua.Phone + "</span><br/>"); sb.AppendLine("<span><b>В лице:</b> " + ua.ContactFace + "</span><br/>"); sb.AppendLine("<span><b>На основании:</b> " + ua.Cause + "</span><br/>"); sb.AppendLine("<span><b>Тип налогообложения:</b> " + ua.TaxType + "</span><br/>"); } return(sb); }
//Режим редактиорвания абонента protected void lbEdit_Click(object sender, EventArgs e) { panEdit.Visible = true; panView.Visible = false; UniversalEntity ue = new UniversalEntity(); int id = Convert.ToInt32(hfODID.Value); StringBuilder sb = new StringBuilder(); UAbonent ua = new UAbonent(); UAbonentDO uado = new UAbonentDO(); ue = uado.RetrieveByOrderID(id); if (ue.Count > 0) { ua = (UAbonent)ue[0]; tbTitle.Text = ua.Title; tbOKPO.Text = ua.OKPO; tbMFO.Text = ua.MFO; tbContract.Text = ua.Contract; tbRS.Text = ua.RS; tbBank.Text = ua.Bank; tbAddress.Text = ua.Address; tbPhone.Text = ua.Phone; tbContactFace.Text = ua.ContactFace; tbCause.Text = ua.Cause; tbINN.Text = ua.INN; tbVATPay.Text = ua.VATPay; cbBudjet.Checked = ua.IsBudget; hfID.Value = ua.ID.ToString(); hfDogID.Value = ua.DogID.ToString(); tbTaxType.Text = ua.TaxType; } }
//Добавление юр. лица protected void repCorporate_ItemCommand(object source, RepeaterCommandEventArgs e) { Session["Abonent"] = null; SessionAbonent sa = new SessionAbonent(); StringBuilder sb = new StringBuilder(); if (hfClientType.Value == Abonent.Corporate.ToString()) { sa.Type = (short)Abonent.Corporate; UAbonent ua = new UAbonent(); ua.Title = (e.Item.FindControl("litFULL_NAME") as Literal).Text; ua.DogID = Convert.ToInt32((e.Item.FindControl("litID_DOC") as Literal).Text); ua.IsBudget = (e.Item.FindControl("litBUDZHET") as Literal).Text == "1" ? true : false; // Convert.ToBoolean((e.Item.FindControl("litBUDZHET") as Literal).Text); ua.MFO = (e.Item.FindControl("litMFO") as Literal).Text; ua.RS = (e.Item.FindControl("litR_S") as Literal).Text; ua.Contract = (e.Item.FindControl("litDOGOVOR") as Literal).Text; ua.Bank = (e.Item.FindControl("litBANK") as Literal).Text; ua.Address = (e.Item.FindControl("litUR_ADDRESS") as Literal).Text; ua.Phone = (e.Item.FindControl("litPhone") as Literal).Text; ua.ContactFace = (e.Item.FindControl("litFace") as Literal).Text; ua.Cause = (e.Item.FindControl("litCause") as Literal).Text; ua.INN = (e.Item.FindControl("litInn") as Literal).Text; ua.VATPay = (e.Item.FindControl("litSvidetelstvo") as Literal).Text; ua.TaxType = (e.Item.FindControl("litTaxType") as Literal).Text; ua.OKPO = (e.Item.FindControl("litOKPO") as Literal).Text; //tbCorporateOKPO.Text.Trim(); hfOKPO sa.UAbon = ua; //Вывод инфы по абоненту sb.AppendLine("<span><b>" + ua.Title + " " + ua.DogID.ToString() + "</b></span><br/>"); sb.AppendLine("<span> <b>ОКПО:</b> " + ua.OKPO + "</span> "); sb.AppendLine("<span><b>МФО</b>: " + ua.MFO + "</span> "); sb.AppendLine("<span><b>Р/С:</b> " + ua.RS + "</span> "); sb.AppendLine("<span><b>Договор:</b> " + ua.Contract + "</span> "); if (ua.IsBudget) { sb.AppendLine("<span><b>Бюджет</b></span><br/>"); } sb.AppendLine("<span><b>Банк: </b>" + ua.Bank + "</span><br/>"); sb.AppendLine("<span><b>Адрес:</b> " + ua.Address + "</span><br/>"); litAbonentInfo.Text = sb.ToString(); } Session["Abonent"] = sa; Step1.Visible = false; Step2.Visible = true; BindSellers(); BindDiameter(); }
//для формы добавления юр лица protected void repCorporateAbonent_Click(object sender, EventArgs e) { Session["Abonent"] = null; SessionAbonent sa = new SessionAbonent(); StringBuilder sb = new StringBuilder(); StringBuilder sbErrorua = new StringBuilder(); if (string.IsNullOrEmpty(tbClientTitle.Text)) { sbErrorua.Append("Необходимо заполнить название предприятия.<br/>"); } if (string.IsNullOrEmpty(tbClientOKPO.Text)) { sbErrorua.Append("Необхходимо заполнить ОКПО.<br/>"); } if (string.IsNullOrEmpty(tbClientRS.Text)) { sbErrorua.Append("Необходимо заполнить расчетный счет.<br/>"); } if (string.IsNullOrEmpty(tbClientPhone.Text)) { sbErrorua.Append("Необходимо заполнить номер телефона.<br/>"); } /* if (string.IsNullOrEmpty(tbAddress.Text)) * { * sbErrorua.Append("Необходимо заполнить адрес.<br/>"); * }*/ if (sbErrorua.Length > 0) { radWM.RadAlert(sbErrorua.ToString(), null, null, "Предупреждение", ""); } else { if (hfClientType.Value == Abonent.Corporate.ToString()) { sa.Type = (short)Abonent.Corporate; UAbonent ua = new UAbonent(); ua.Title = tbClientTitle.Text.Trim(); ua.OKPO = tbClientOKPO.Text.Trim(); ua.RS = tbClientRS.Text.Trim(); ua.Phone = tbClientPhone.Text.Trim(); ua.Address = tbAddressUA.Text.Trim(); sa.UAbon = ua; sb.AppendLine("<b><span>Абонент:" + ua.Title + "</span><br/>"); sb.AppendLine("<b><span>Тел.:" + ua.Phone + "</span><br/>"); sb.AppendLine("<b><span>Адрес:" + ua.Address + "</span><br/>"); litAbonentInfo.Text = sb.ToString(); } Session["Abonent"] = sa; ClearFAbonentForm(); Step1.Visible = false; Step2.Visible = true; radgridD.Rebind(); } }
public int Create(UAbonent ent) { int createdid = 0; UAbonentDAO entDAO = new UAbonentDAO(); sc = new SqlCommand("CreateUAbonent"); sc.CommandType = CommandType.StoredProcedure; addParameters(ent); createdid = entDAO.createEntity(sc); return(createdid); }
public override UniversalEntity createEntity() { UniversalEntity ue = new UniversalEntity(); while (dr.Read()) { UAbonent ent = new UAbonent(); ent = createEntityFromReader(dr); ue.Add(ent); } return(ue); }
public bool Update(UAbonent ent) { bool success = true; UAbonentDAO entDAO = new UAbonentDAO(); sc = new SqlCommand("UpdateUabonent"); sc.CommandType = CommandType.StoredProcedure; sc.Parameters.Add("@ID", ent.ID); addParameters(ent); success = entDAO.updateEntity(sc); return(success); }
//Режим редактиорвания абонента protected void lbEdit_Click(object sender, EventArgs e) { User u = GetCurrentUser(); u.GetPermissions(); /*if (u.ChekPermission("littlewdk")) * { * btActRublesForLittleWdk.Visible = true; * btBillRublesForLittleWDK.Visible = true; * btUAPayRublesForLittleWDK.Visible = true; * } * else * { * btActRublesForLittleWdk.Visible = false; * btBillRublesForLittleWDK.Visible = false; * btUAPayRublesForLittleWDK.Visible = false; * }*/ panEdit.Visible = true; panView.Visible = false; UniversalEntity ue = new UniversalEntity(); int id = Convert.ToInt32(hfODID.Value); StringBuilder sb = new StringBuilder(); UAbonent ua = new UAbonent(); UAbonentDO uado = new UAbonentDO(); ue = uado.RetrieveByOrderID(id); if (ue.Count > 0) { ua = (UAbonent)ue[0]; tbTitle.Text = ua.Title; tbNumberJournal.Text = ua.NumberJournal; tbOKPO.Text = ua.OKPO; tbMFO.Text = ua.MFO; tbContract.Text = ua.Contract; tbRS.Text = ua.RS; tbBank.Text = ua.Bank; tbAddress.Text = ua.Address; tbPhone.Text = ua.Phone; tbContactFace.Text = ua.ContactFace; tbCause.Text = ua.Cause; tbINN.Text = ua.INN; tbVATPay.Text = ua.VATPay; cbBudjet.Checked = ua.IsBudget; hfID.Value = ua.ID.ToString(); hfDogID.Value = ua.DogID.ToString(); tbTaxType.Text = ua.TaxType; } }
void AddParametersToSqlCommand(UAbonent ent, ref SqlCommand sc) { sc.Parameters.Add("@Title", ent.Title); sc.Parameters.Add("@DogID", ent.DogID); sc.Parameters.Add("@OKPO", ent.OKPO); sc.Parameters.Add("@MFO", ent.MFO); sc.Parameters.Add("@RS", ent.RS); sc.Parameters.Add("@Contract", ent.Contract); sc.Parameters.Add("@Bank", ent.Bank); sc.Parameters.Add("@Address", ent.Address); sc.Parameters.Add("@IsBudget", ent.IsBudget); sc.Parameters.Add("@Phone", ent.Phone); sc.Parameters.Add("@ContactFace", ent.ContactFace); sc.Parameters.Add("@Cause", ent.Cause); sc.Parameters.Add("@INN", ent.INN); sc.Parameters.Add("@VATPay", ent.VATPay); sc.Parameters.Add("@TaxType", ent.TaxType); }
//Сбор информации об абоненте из UI UAbonent CollectUAbonent() { UAbonent ua = new UAbonent(); ua.Title = tbTitle.Text; ua.OKPO = tbOKPO.Text; ua.MFO = tbMFO.Text; ua.Contract = tbContract.Text; ua.RS = tbRS.Text; ua.Bank = tbBank.Text; ua.Address = tbAddress.Text; ua.Phone = tbPhone.Text; ua.ContactFace = tbContactFace.Text; ua.Cause = tbCause.Text; ua.INN = tbINN.Text; ua.VATPay = tbVATPay.Text; ua.IsBudget = cbBudjet.Checked; ua.ID = Utilities.ConvertToInt(hfID.Value); ua.DogID = Utilities.ConvertToInt(hfDogID.Value); ua.TaxType = tbTaxType.Text; return(ua); }
//Добавление юр. лица protected void repCorporate_ItemCommand(object source, RepeaterCommandEventArgs e) { Session["Abonent"] = null; SessionAbonent sa = new SessionAbonent(); StringBuilder sb = new StringBuilder(); StringBuilder sbErrorua = new StringBuilder(); if (string.IsNullOrEmpty(tbClientTitle.Text)) { sbErrorua.Append("Необходимо заполнить название предприятия.<br/>"); } if (string.IsNullOrEmpty(tbClientOKPO.Text)) { sbErrorua.Append("Необхходимо заполнить ОКПО.<br/>"); } if (string.IsNullOrEmpty(tbClientRS.Text)) { sbErrorua.Append("Необходимо заполнить расчетный счет.<br/>"); } if (string.IsNullOrEmpty(tbClientPhone.Text)) { sbErrorua.Append("Необходимо заполнить номер телефона.<br/>"); } if (string.IsNullOrEmpty(tbAddress.Text)) { sbErrorua.Append("Необходимо заполнить адрес.<br/>"); } if (sbErrorua.Length > 0) { radWM.RadAlert(sbErrorua.ToString(), null, null, "Предупреждение", ""); } if (hfClientType.Value == Abonent.Corporate.ToString()) { sa.Type = (short)Abonent.Corporate; UAbonent ua = new UAbonent(); ua.Title = (e.Item.FindControl("litFULL_NAME") as Literal).Text; ua.DogID = Convert.ToInt32((e.Item.FindControl("litID_DOC") as Literal).Text); ua.IsBudget = (e.Item.FindControl("litBUDZHET") as Literal).Text == "1" ? true : false; // Convert.ToBoolean((e.Item.FindControl("litBUDZHET") as Literal).Text); ua.MFO = (e.Item.FindControl("litMFO") as Literal).Text; ua.RS = (e.Item.FindControl("litR_S") as Literal).Text; ua.Contract = (e.Item.FindControl("litDOGOVOR") as Literal).Text; ua.Bank = (e.Item.FindControl("litBANK") as Literal).Text; ua.Address = (e.Item.FindControl("litUR_ADDRESS") as Literal).Text; ua.Phone = (e.Item.FindControl("litPhone") as Literal).Text; ua.ContactFace = (e.Item.FindControl("litFace") as Literal).Text; ua.Cause = (e.Item.FindControl("litCause") as Literal).Text; ua.INN = (e.Item.FindControl("litInn") as Literal).Text; ua.VATPay = (e.Item.FindControl("litSvidetelstvo") as Literal).Text; ua.TaxType = (e.Item.FindControl("litTaxType") as Literal).Text; ua.OKPO = (e.Item.FindControl("litOKPO") as Literal).Text; sa.UAbon = ua; //Вывод инфы по абоненту sb.AppendLine("<span><b>" + ua.Title + " " + ua.DogID.ToString() + "</b></span><br/>"); sb.AppendLine("<span> <b>ОКПО:</b> " + ua.OKPO + "</span> "); sb.AppendLine("<span><b>МФО</b>: " + ua.MFO + "</span> "); sb.AppendLine("<span><b>Р/С:</b> " + ua.RS + "</span> "); sb.AppendLine("<span><b>Договор:</b> " + ua.Contract + "</span> "); if (ua.IsBudget) { sb.AppendLine("<span><b>Бюджет</b></span><br/>"); } sb.AppendLine("<span><b>Банк: </b>" + ua.Bank + "</span><br/>"); sb.AppendLine("<span><b>Адрес:</b> " + ua.Address + "</span><br/>"); litAbonentInfo.Text = sb.ToString(); } Session["Abonent"] = sa; Step1.Visible = false; Step2.Visible = true; /*Session["Abonent"] = sa; * ClearFAbonentForm(); * Step1.Visible = false; * Step2.Visible = true; * radgridD.Rebind();*/ }
//Сохранение в базу 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(); } } }
//Генерация договора protected void btContract_Click(object sender, EventArgs e) { UniversalEntity ue = new UniversalEntity(); UniversalEntity uev = new UniversalEntity(); int id = Convert.ToInt32(hfODID.Value); UAbonent ua = new UAbonent(); UAbonentDO uado = new UAbonentDO(); ue = uado.RetrieveByOrderID(id); UOrderDetailsDO uoddo = new UOrderDetailsDO(); VodomerTypeDO vtdo = new VodomerTypeDO(); VodomerType vt; UOrderDetails uod; if (ue.Count > 0) { double sum = 0; double sumvat = 0; string vodomer = string.Empty; ua = (UAbonent)ue[0]; ue = uoddo.RetrieveUOrderDetailsByOrderID(id); if (ue.Count > 0) { for (int i = 0; i < ue.Count; i++) { uod = (UOrderDetails)ue[i]; sum += uod.GetPriceWithVAT(); sumvat += uod.GetPriceVAT(); uev = vtdo.RetrieveVodomerTypeByVodomerId(uod.VodomerID); if (uev.Count > 0) { for (int j = 0; j < uev.Count; j++) { vt = (VodomerType)uev[j]; vodomer += "Поверить " + vt.Description + " Ø " + vt.Diameter.ToString() + " мм в количестве 1 шт., "; } } } } UOrder uo = new UOrder(); UOrderDO uoDO = new UOrderDO(); ue = uoDO.RetrieveUOrderById(id); if (ue.Count > 0) { uo = (UOrder)ue[0]; } if (ua.IsBudget) { //Для бюджетных организаций using (DocX document = DocX.Load(Request.MapPath("~\\Templates/noncommerce.docx"))) { //DocXExtender.ReplaceFormatedText(document, "DDD", "дата"); document.ReplaceText("NNN", uo.ID.ToString(), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("DATE", RuDateAndMoneyConverter.DateToTextLong(uo.DateIn) + " г.", false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("TITLE", ua.Title, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("VODOMER", vodomer, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("SUM", RuDateAndMoneyConverter.CurrencyToTxt(sum, true), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("NDS", RuDateAndMoneyConverter.CurrencyToTxt(sumvat, true), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("SSS", (sum).ToString("0.00") + " грн", false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("RS", ua.RS, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("BANK", ua.Bank, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("MFO", ua.MFO, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("OKPO", ua.OKPO, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("ADDRESS", ua.Address, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("FACE", ua.ContactFace, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("CAUSE", ua.Cause, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("PHONE", ua.Phone, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); //TAXTYPE document.ReplaceText("TAXTYPE", ua.TaxType, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); //VODOMER document.SaveAs(Request.MapPath("~\\Templates/outnoncommerce.docx")); litScript.Text = "<iframe style=\"display:none;\" src=\"../GetDocument.ashx?Commerce=1\"></iframe>"; } } else { //для небюджетных организаций using (DocX document = DocX.Load(Request.MapPath("~\\Templates/commerce.docx"))) { //DocXExtender.ReplaceFormatedText(document, "DDD", "дата"); document.ReplaceText("NNN", uo.ID.ToString(), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("DATE", RuDateAndMoneyConverter.DateToTextLong(uo.DateIn) + " г.", false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("TITLE", ua.Title, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("VODOMER", vodomer, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("SUM", RuDateAndMoneyConverter.CurrencyToTxt(sum, true), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("NDS", RuDateAndMoneyConverter.CurrencyToTxt(sumvat, true), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("RS", ua.RS, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("BANK", ua.Bank, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("MFO", ua.MFO, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("OKPO", ua.OKPO, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("ADDRESS", ua.Address, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("FACE", ua.ContactFace, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("CAUSE", ua.Cause, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("PHONE", ua.Phone, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); document.ReplaceText("TAXTYPE", ua.TaxType, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase); //VODOMER document.SaveAs(Request.MapPath("~\\Templates/outcommerce.docx")); litScript.Text = "<iframe style=\"display:none;\" src=\"../GetDocument.ashx?Commerce=0\"></iframe>"; } } } }
//Сохранение в базу 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) { FAbonent fa = sa.FAbon; FAbonentDO fado = new FAbonentDO(); int fid = fado.Create(fa); if (fid > 0) { sa.FAbon.ID = fid; Session["Abonent"] = sa; FOrder fo = new FOrder(); FOrderDO fodo = new FOrderDO(); fo.ActionType = "Поверка водомера."; fo.FAbonentID = fid; fo.UserID = GetCurrentUser().ID; int foid = fodo.Create(fo); if (foid > 0) { hfOrder.Value = foid.ToString(); FOrderDetails fod = new FOrderDetails(); FOrderDetailsDO foddo = new FOrderDetailsDO(); 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.Create(fod); } } } } //SetMessege("Статус", "Абонент и водомер успешно внесены в базу."); LoadStep3(); } } }
public UAbonent createEntityFromReader(SqlDataReader dr) { UAbonent ent = new UAbonent(); if (!dr.IsDBNull(dr.GetOrdinal("ID"))) { ent.ID = Convert.ToInt32(dr["ID"]); } if (!dr.IsDBNull(dr.GetOrdinal("Title"))) { ent.Title = dr["Title"].ToString(); } if (!dr.IsDBNull(dr.GetOrdinal("OKPO"))) { ent.OKPO = dr["OKPO"].ToString(); } if (!dr.IsDBNull(dr.GetOrdinal("MFO"))) { ent.MFO = dr["MFO"].ToString(); } if (!dr.IsDBNull(dr.GetOrdinal("RS"))) { ent.RS = dr["RS"].ToString(); } if (!dr.IsDBNull(dr.GetOrdinal("Address"))) { ent.Address = dr["Address"].ToString(); } if (!dr.IsDBNull(dr.GetOrdinal("Contract"))) { ent.Contract = dr["Contract"].ToString(); } if (!dr.IsDBNull(dr.GetOrdinal("Bank"))) { ent.Bank = dr["Bank"].ToString(); } if (!dr.IsDBNull(dr.GetOrdinal("IsBudget"))) { ent.IsBudget = Convert.ToBoolean(dr["IsBudget"]); } if (!dr.IsDBNull(dr.GetOrdinal("DogID"))) { ent.DogID = Convert.ToInt32(dr["DogID"]); } if (!dr.IsDBNull(dr.GetOrdinal("VATPay"))) { ent.VATPay = dr["VATPay"].ToString(); } if (!dr.IsDBNull(dr.GetOrdinal("Phone"))) { ent.Phone = dr["Phone"].ToString(); } if (!dr.IsDBNull(dr.GetOrdinal("ContactFace"))) { ent.ContactFace = dr["ContactFace"].ToString(); } if (!dr.IsDBNull(dr.GetOrdinal("Cause"))) { ent.Cause = dr["Cause"].ToString(); } if (!dr.IsDBNull(dr.GetOrdinal("INN"))) { ent.INN = dr["INN"].ToString(); } if (!dr.IsDBNull(dr.GetOrdinal("TaxType"))) { ent.TaxType = dr["TaxType"].ToString(); } return(ent); }
public static void GenerateUAct(int id) { UniversalEntity ue = new UniversalEntity(); UAbonent ua = new UAbonent(); UAbonentDO uado = new UAbonentDO(); UOrder uo = new UOrder(); UOrderDO uodo = new UOrderDO(); UOrderDetailsDO uodDO = new UOrderDetailsDO(); ue = uado.RetrieveByOrderID(id); string header = string.Empty; string actNumber = string.Empty; if (ue.Count > 0) { ua = (UAbonent)ue[0]; header += ua.Title + " \nюр адрес: " + ua.Address + " \n№ св. пл. НДС: " + ua.VATPay + " \n№ ИНН: " + ua.INN + " \nтел.: " + ua.Phone; } ue = uodo.RetrieveUOrderById(id); if (ue.Count > 0) { uo = (UOrder)ue[0]; if (uo.DateOut.HasValue) { actNumber = " г. Донецк АКТ № " + uo.ID + " от ____________________" + DateTime.Now.Year.ToString() + " г."; } else { actNumber = " г. Донецк АКТ № " + uo.ID + " от ____________________" + DateTime.Now.Year.ToString() + " г."; } } ue = uodDO.RetrieveUOrderDetailsByOrderID(id); InitializeWorkbook(); ISheet sheet1 = hssfworkbook.GetSheet("s"); sheet1.GetRow(11).GetCell(0).SetCellValue(" по договору (письму) № " + uo.ID + " от ____________________" + DateTime.Now.Year.ToString() + " г."); sheet1.GetRow(41).GetCell(0).SetCellValue(" по договору (письму) № " + uo.ID + " от ____________________" + DateTime.Now.Year.ToString() + " г."); //create cell on rows, since rows do already exist,it's not necessary to create rows again. sheet1.GetRow(2).GetCell(3).SetCellValue(header); sheet1.GetRow(32).GetCell(3).SetCellValue(header); sheet1.GetRow(9).GetCell(0).SetCellValue(actNumber); sheet1.GetRow(39).GetCell(0).SetCellValue(actNumber); int rowC = 44; int row = 14; double sum = 0; int count = ue.Count; if (count <= 5) { CustomRetrieverDO crDO = new CustomRetrieverDO(); ue = crDO.RetrieveUActByOrderID5Low(id); if (ue.Count > 0) { for (int i = row; i < ue.Count + row; i++) { ArrayList al = (ArrayList)ue[i - row]; //FOrderDetailsAct u = (FOrderDetailsAct)fodal[i - row]; sheet1.GetRow(i).GetCell(0).SetCellValue(i - row + 1); sheet1.GetRow(i).GetCell(1).SetCellValue(string.Format("Определения метрологических характеристик водомера D{0}, {1}, {2}", al[0].ToString(), al[1].ToString(), al[2].ToString())); sheet1.GetRow(i).GetCell(2).SetCellValue("калькуляция"); sheet1.GetRow(i).GetCell(3).SetCellValue("шт."); sheet1.GetRow(i).GetCell(4).SetCellValue(al[4].ToString()); sheet1.GetRow(i).GetCell(5).SetCellValue(Convert.ToDouble(al[3]).ToString("0.00")); sheet1.GetRow(i).GetCell(6).SetCellValue(Convert.ToDouble(al[3]).ToString("0.00")); sheet1.GetRow(rowC).GetCell(0).SetCellValue(i - row + 1); sheet1.GetRow(rowC).GetCell(1).SetCellValue(string.Format("Определения метрологических характеристик водомера D{0}, {1}, {2}", al[0].ToString(), al[1].ToString(), al[2].ToString())); sheet1.GetRow(rowC).GetCell(2).SetCellValue("калькуляция"); sheet1.GetRow(rowC).GetCell(3).SetCellValue("шт."); sheet1.GetRow(rowC).GetCell(4).SetCellValue(al[4].ToString()); sheet1.GetRow(rowC).GetCell(5).SetCellValue(Convert.ToDouble(al[3]).ToString("0.00")); sheet1.GetRow(rowC).GetCell(6).SetCellValue(Convert.ToDouble(al[3]).ToString("0.00")); sum += Convert.ToDouble(al[3]); rowC++; } } } else { CustomRetrieverDO crDO = new CustomRetrieverDO(); ue = crDO.RetrieveUActByOrderID5High(id); if (ue.Count > 0) { for (int i = row; i < ue.Count + row; i++) { ArrayList al = (ArrayList)ue[i - row]; //FOrderDetailsAct u = (FOrderDetailsAct)fodal[i - row]; sheet1.GetRow(i).GetCell(0).SetCellValue(i - row + 1); sheet1.GetRow(i).GetCell(1).SetCellValue(string.Format("Определения метрологических характеристик водомера D{0}", al[0].ToString())); sheet1.GetRow(i).GetCell(2).SetCellValue("калькуляция"); sheet1.GetRow(i).GetCell(3).SetCellValue("шт."); sheet1.GetRow(i).GetCell(4).SetCellValue(al[3].ToString()); sheet1.GetRow(i).GetCell(5).SetCellValue(Convert.ToDouble(al[1]).ToString("0.00")); sheet1.GetRow(i).GetCell(6).SetCellValue(Convert.ToDouble(al[2]).ToString("0.00")); sheet1.GetRow(rowC).GetCell(0).SetCellValue(i - row + 1); sheet1.GetRow(rowC).GetCell(1).SetCellValue(string.Format("Определения метрологических характеристик водомера D{0}", al[0].ToString())); sheet1.GetRow(rowC).GetCell(2).SetCellValue("калькуляция"); sheet1.GetRow(rowC).GetCell(3).SetCellValue("шт."); sheet1.GetRow(rowC).GetCell(4).SetCellValue(al[3].ToString()); sheet1.GetRow(rowC).GetCell(5).SetCellValue(Convert.ToDouble(al[1]).ToString("0.00")); sheet1.GetRow(rowC).GetCell(6).SetCellValue(Convert.ToDouble(al[2]).ToString("0.00")); sum += Convert.ToDouble(al[2]); rowC++; } } } /*int rowC = 44; * int row = 14; * double sum = 0; * if (ue.Count > 0) * { * for (int i = row; i < ue.Count + row; i++) * { * UOrderDetails u = (UOrderDetails)ue[i - row]; * * sheet1.GetRow(i).GetCell(0).SetCellValue(i - row+1); * sheet1.GetRow(i).GetCell(1).SetCellValue(string.Format("Определения метрологических характеристик водомера D{0}, {1}, {2}", al[0].ToString(), al[1].ToString(), al[2].ToString())); * sheet1.GetRow(i).GetCell(2).SetCellValue("калькуляция"); * sheet1.GetRow(i).GetCell(3).SetCellValue("шт."); * sheet1.GetRow(i).GetCell(4).SetCellValue("1"); * sheet1.GetRow(i).GetCell(5).SetCellValue(u.Price.ToString("0.00")); * sheet1.GetRow(i).GetCell(6).SetCellValue(u.Price.ToString("0.00")); * * sheet1.GetRow(rowC).GetCell(0).SetCellValue(i - row + 1); * sheet1.GetRow(rowC).GetCell(1).SetCellValue(string.Format("Определения метрологических характеристик водомера D{0}, {1}, {2}", al[0].ToString(), al[1].ToString(), al[2].ToString())); * sheet1.GetRow(rowC).GetCell(2).SetCellValue("калькуляция"); * sheet1.GetRow(rowC).GetCell(3).SetCellValue("шт."); * sheet1.GetRow(rowC).GetCell(4).SetCellValue("1"); * sheet1.GetRow(rowC).GetCell(5).SetCellValue(u.Price.ToString("0.00")); * sheet1.GetRow(rowC).GetCell(6).SetCellValue(u.Price.ToString("0.00")); * * sum += u.Price; * rowC++; * } * }*/ sheet1.GetRow(19).GetCell(6).SetCellValue(sum.ToString("0.00")); sheet1.GetRow(20).GetCell(6).SetCellValue(Utilities.GetVAT(sum).ToString("0.00")); sheet1.GetRow(21).GetCell(6).SetCellValue((sum + Utilities.GetVAT(sum)).ToString("0.00")); sheet1.GetRow(49).GetCell(6).SetCellValue(sum.ToString("0.00")); sheet1.GetRow(50).GetCell(6).SetCellValue(Utilities.GetVAT(sum).ToString("0.00")); sheet1.GetRow(51).GetCell(6).SetCellValue((sum + Utilities.GetVAT(sum)).ToString("0.00")); /* sheet1.GetRow(2).GetCell(1).SetCellValue(300); * sheet1.GetRow(3).GetCell(1).SetCellValue(500050); * sheet1.GetRow(4).GetCell(1).SetCellValue(8000); * sheet1.GetRow(5).GetCell(1).SetCellValue(110); * sheet1.GetRow(6).GetCell(1).SetCellValue(100); * sheet1.GetRow(7).GetCell(1).SetCellValue(200); * sheet1.GetRow(8).GetCell(1).SetCellValue(210); * sheet1.GetRow(9).GetCell(1).SetCellValue(2300); * sheet1.GetRow(10).GetCell(1).SetCellValue(240); * sheet1.GetRow(11).GetCell(1).SetCellValue(180123); * sheet1.GetRow(12).GetCell(1).SetCellValue(150);*/ //Force excel to recalculate all the formula while open sheet1.ForceFormulaRecalculation = true; WriteToFile(); }
void addParameters(UAbonent ent) { AddParametersToSqlCommand(ent, ref sc); }
public static void GenerateBill(int id) { InitializeWorkbookBill(); ISheet sheet1 = hssfworkbook.GetSheet("s"); UniversalEntity ue = new UniversalEntity(); //UniversalEntity uev = new UniversalEntity(); UAbonent ua = new UAbonent(); UAbonentDO uado = new UAbonentDO(); UOrder uo = new UOrder(); UOrderDO uodo = new UOrderDO(); UOrderDetailsDO uodDO = new UOrderDetailsDO(); ue = uado.RetrieveByOrderID(id); string header = string.Empty; string actNumber = string.Empty; if (ue.Count > 0) { ua = (UAbonent)ue[0]; header += ua.Title + " \nюр адрес: " + ua.Address + " \n№ св. пл. НДС: " + ua.VATPay + " \n№ ИНН: " + ua.INN + " \nтел.: " + ua.Phone; } ue = uodo.RetrieveUOrderById(id); if (ue.Count > 0) { uo = (UOrder)ue[0]; sheet1.GetRow(4).GetCell(GetLetterNumber("aj")).SetCellValue(uo.ID); sheet1.GetRow(9).GetCell(GetLetterNumber("ai")).SetCellValue(RuDateAndMoneyConverter.DateToTextLongUA(uo.DateIn) + "р."); } ue = uodDO.RetrieveUOrderDetailsByOrderID(id); sheet1.GetRow(16).GetCell(6).SetCellValue(header); int count = ue.Count; double sum = 0; int row = 20; if (count <= 5) { CustomRetrieverDO crDO = new CustomRetrieverDO(); ue = crDO.RetrieveUActByOrderID5Low(id); if (ue.Count > 0) { for (int i = row; i < ue.Count + row; i++) { ArrayList al = (ArrayList)ue[i - row]; sheet1.GetRow(i).GetCell(GetLetterNumber("a")).SetCellValue(string.Format("Определения метрологических характеристик водомера D{0}, {1}, {2}", al[0].ToString(), al[1].ToString(), al[2].ToString())); sheet1.GetRow(i).GetCell(GetLetterNumber("ad")).SetCellValue("шт."); sheet1.GetRow(i).GetCell(GetLetterNumber("aj")).SetCellValue(al[4].ToString()); sheet1.GetRow(i).GetCell(GetLetterNumber("ap")).SetCellValue(Convert.ToDouble(al[3]).ToString("0.00")); sheet1.GetRow(i).GetCell(GetLetterNumber("av")).SetCellValue(Convert.ToDouble(al[3]).ToString("0.00")); sum += Convert.ToDouble(al[3]); } } } else { CustomRetrieverDO crDO = new CustomRetrieverDO(); ue = crDO.RetrieveUActByOrderID5High(id); if (ue.Count > 0) { for (int i = row; i < ue.Count + row; i++) { ArrayList al = (ArrayList)ue[i - row]; //FOrderDetailsAct u = (FOrderDetailsAct)fodal[i - row]; sheet1.GetRow(i).GetCell(GetLetterNumber("a")).SetCellValue(string.Format("Определения метрологических характеристик водомера D{0}", al[0].ToString())); sheet1.GetRow(i).GetCell(GetLetterNumber("ad")).SetCellValue("шт."); sheet1.GetRow(i).GetCell(GetLetterNumber("aj")).SetCellValue(al[3].ToString()); sheet1.GetRow(i).GetCell(GetLetterNumber("ap")).SetCellValue(Convert.ToDouble(al[3]).ToString("0.00")); sheet1.GetRow(i).GetCell(GetLetterNumber("av")).SetCellValue(Convert.ToDouble(al[3]).ToString("0.00")); sum += Convert.ToDouble(al[2]); } } } /*int row = 20; * double sum = 0; * * * * * * if (ue.Count > 0) * { * for (int i = row; i < ue.Count + row; i++) * { * UOrderDetails u = (UOrderDetails)ue[i - row]; * * sheet1.GetRow(i).GetCell(GetLetterNumber("a")).SetCellValue("Определения метрологических характеристик водомера "); * sheet1.GetRow(i).GetCell(GetLetterNumber("ad")).SetCellValue("шт."); * sheet1.GetRow(i).GetCell(GetLetterNumber("aj")).SetCellValue("1"); * sheet1.GetRow(i).GetCell(GetLetterNumber("ap")).SetCellValue(u.Price.ToString("0.00")); * sheet1.GetRow(i).GetCell(GetLetterNumber("av")).SetCellValue(u.Price.ToString("0.00")); * sum += u.Price; * } * }*/ sheet1.GetRow(31).GetCell(GetLetterNumber("av")).SetCellValue(sum.ToString("0.00")); sheet1.GetRow(32).GetCell(GetLetterNumber("av")).SetCellValue(Utilities.GetVAT(sum).ToString("0.00")); sheet1.GetRow(33).GetCell(GetLetterNumber("av")).SetCellValue((sum + Utilities.GetVAT(sum)).ToString("0.00")); sheet1.GetRow(35).GetCell(GetLetterNumber("a")).SetCellValue("Загальна сума, що підлягає оплаті: " + UADateAndMoneyConverter.CurrencyToTxt((sum + Utilities.GetVAT(sum)), true)); //Загальна сума, що підлягає оплаті //Force excel to recalculate all the formula while open sheet1.ForceFormulaRecalculation = true; WriteToFileB(); }
//Сохранение в базу 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 = "Определения метрологических характеристик водомера"; 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) { FAbonent fa = sa.FAbon; FAbonentDO fado = new FAbonentDO(); int fid = fado.Create(fa); if (fid > 0) { sa.FAbon.ID = fid; Session["Abonent"] = sa; FOrder fo = new FOrder(); FOrderDO fodo = new FOrderDO(); fo.ActionType = "Определения метрологических характеристик водомера "; fo.FAbonentID = fid; fo.UserID = GetCurrentUser().ID; int foid = fodo.Create(fo); if (foid > 0) { hfOrder.Value = foid.ToString(); FOrderDetails fod = new FOrderDetails(); FOrderDetailsDO foddo = new FOrderDetailsDO(); 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.Create(fod); } Response.Redirect("FJournal.aspx?id=" + foid.ToString()); } } } // LoadStep3(); } } }
//Сохранение в базу 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(); } } }