protected void Gridview1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { PriceChangeJour row = (PriceChangeJour)e.Row.DataItem; ImageButton GoToLinesImageButton1 = (ImageButton)e.Row.FindControl("GoToLinesImageButton1"); GoToLinesImageButton1.PostBackUrl = "sklad.aspx?ID=" + row.ID.ToString(); } }
protected void NewJoursGridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { PriceChangeJour row = (PriceChangeJour)e.Row.DataItem; HyperLink GoToLinesHyperLink1 = (HyperLink)e.Row.FindControl("GoToLinesHyperLink1"); GoToLinesHyperLink1.NavigateUrl = "NewJoursLines.aspx?ID=" + row.ID.ToString(); } }
protected void CreateNewButton1_Click(object sender, EventArgs e) { PriceChangeJour np = new PriceChangeJour(); np.Change_log_id_UKM = 0; np.Order_no = 0; np.FromTerminal = true; np.Active = true; np.TimeStamp = DateTime.Now; np.InUse = false; context.PriceChangeJours.InsertOnSubmit(np); context.SubmitChanges(); PriceJoursLinqDataSource1.DataBind(); Gridview1.DataBind(); }
protected void CreateNewButton1_Click(object sender, EventArgs e) { int MobilePrinterNum = 0; if (ddlMobilePrinterNum.SelectedIndex != -1) { MobilePrinterNum = Int32.Parse(ddlMobilePrinterNum.SelectedItem.Value.ToString()); } PriceChangeJour np = new PriceChangeJour(); np.Change_log_id_UKM = 0; np.Order_no = MobilePrinterNum; np.FromTerminal = true; np.Active = true; np.TimeStamp = DateTime.Now; np.InUse = false; context.PriceChangeJours.InsertOnSubmit(np); context.SubmitChanges(); PriceJoursLinqDataSource1.DataBind(); Gridview1.DataBind(); }
protected void TermoCennicButton1_Click(object sender, EventArgs e) { int newJournalID = 0; DateTime tst = DateTime.Now; // создадим темповый журнал if (GoodsGridView1.Rows.Count != 0) { PriceChangeJour np = new PriceChangeJour(); np.Change_log_id_UKM = 0; np.Order_no = 0; np.InUse = false; np.TimeStamp = tst; np.Active = true; context.PriceChangeJours.InsertOnSubmit(np); context.SubmitChanges(); } else { return; } var journTMP = (from t in context.PriceChangeJours where t.TimeStamp == tst select t).FirstOrDefault(); newJournalID = journTMP.ID; PrintTemplateCart templCart = (PrintTemplateCart)Session["PrintTemplateCart"]; foreach (PrintTemplateCartItem item in templCart) { var good = (from g in context.Goods where g.ID == item.JourLineID select g).FirstOrDefault(); if (good == null) { continue; } PriceChangeLine nl = new PriceChangeLine(); nl.Good = good; nl.JournalID = newJournalID; nl.ItemID_UKM = good.Articul; Price price = (from p in context.Prices where p.GoodID == good.ID && p.Active == true select p).FirstOrDefault(); if (price != null) { nl.NewPrice = price.Price1.Value; } else { nl.NewPrice = 0; } nl.Active = true; nl.TimeStamp = tst; context.PriceChangeLine.InsertOnSubmit(nl); } context.SubmitChanges(); var jourlines = from j in context.PriceChangeLine where j.JournalID == newJournalID select j; foreach (PriceChangeLine ln in jourlines) { AddToCart(ln.ID); } string url = "CennicListTermo.aspx?ID=" + newJournalID.ToString() + "&q=" + QtyTermoPTextBox1.Text + "&f=" + TermPrinterDropDownList1.SelectedValue; ////string redirectScript = "<script>window.open('" + url + "');</script>"; ////Response.Write(redirectScript); Response.Redirect(url); }
protected void CennicButton1_Click(object sender, EventArgs e) { int newJournalID = 0; DateTime tst = DateTime.Now; // создадим темповый журнал if (GoodsGridView1.Rows.Count != 0) { PriceChangeJour np = new PriceChangeJour(); np.Change_log_id_UKM = 0; np.Order_no = 0; np.InUse = false; np.TimeStamp = tst; np.Active = true; context.PriceChangeJours.InsertOnSubmit(np); context.SubmitChanges(); } else { return; } var journTMP = (from t in context.PriceChangeJours where t.TimeStamp == tst select t).FirstOrDefault(); newJournalID = journTMP.ID; PrintTemplateCart templCart = (PrintTemplateCart)Session["PrintTemplateCart"]; foreach (PrintTemplateCartItem item in templCart) { var good = (from g in context.Goods where g.ID == item.JourLineID select g).FirstOrDefault(); if (good == null) { continue; } if (CheckBox1WhithoutPrice.Checked == true) { var prs = (from p in context.Prices where p.GoodID == good.ID && p.Active == true select p).FirstOrDefault(); if (prs == null) { continue; } } PriceChangeLine nl = new PriceChangeLine(); nl.Good = good; nl.JournalID = newJournalID; nl.ItemID_UKM = good.Articul; Price price = (from p in context.Prices where p.GoodID == good.ID && p.Active == true select p).FirstOrDefault(); if (price != null) { nl.NewPrice = price.Price1.Value; } else { nl.NewPrice = 0; } nl.Active = true; nl.TimeStamp = tst; context.PriceChangeLine.InsertOnSubmit(nl); } context.SubmitChanges(); //foreach (GridViewRow row in GoodsGridView1.Rows) //{ // Label GoodIDLabel1 = (Label)row.FindControl("GoodIDLabel1"); // DropDownList PrintTemplateDropDownList1 = (DropDownList)row.FindControl("PrintTemplateDropDownList1"); // int goodid = Int32.Parse(GoodIDLabel1.Text); // int printTempl = Int32.Parse(PrintTemplateDropDownList1.SelectedValue); // var good = (from g in context.Goods // where g.ID == goodid // select g).FirstOrDefault(); // if (good == null) // continue; // PriceChangeLine nl = new PriceChangeLine(); // nl.Good = good; // nl.JournalID = newJournalID; // nl.ItemID_UKM = good.Articul; // Price price = (from p in context.Prices // where p.GoodID == goodid // && p.Active == true // select p).FirstOrDefault(); // if (price != null) // nl.NewPrice = price.Price1.Value; // else // nl.NewPrice = 0; // nl.Active = true; // nl.TimeStamp = tst; // context.PriceChangeLine.InsertOnSubmit(nl); //} //context.SubmitChanges(); string url = "CennicList.aspx?ID=" + newJournalID.ToString(); ////string redirectScript = "<script>window.open('" + url + "');</script>"; ////Response.Write(redirectScript); Response.Redirect(url); }