public string GetOrderQty(object sItemMasterID) { string s = "0"; bool bln = int.TryParse(sItemMasterID.ToString(), out int iItemMasterID); if (bln) { SalesDetailCollection col = ApplicationSession.SalesMaster.CollectionSalesDetail(ApplicationSession.QRcode == ""); CSalesDetail sd = col.ToList().Find(obj => obj.TransID == iItemMasterID); if (sd is null) { } else { if (ApplicationSession.QRcode == "") { s = sd.Qty.ToString(); } else { if (sd.IsNotSent) { s = sd.Qty.ToString(); } } } } return(s); }
public string fn_GetOrderDetailQty(object sItemDetailID) { decimal dQty = 0; bool bln = int.TryParse(sItemDetailID.ToString(), out int iItemDetailID); if (bln) { CSalesDetail sd = ApplicationSession.SalesMaster.CollectionSalesDetail().SelectedItem(); if (sd != null) { SalesDetailCollection col = sd.Children; if (col.Count > 0) { CSalesDetail sd0 = col.ToList().Find(obj => obj.TransID == iItemDetailID); if (sd0 is null) { } else { dQty = sd0.Qty; } } } } return(string.Format("{0:#,0}", dQty)); }
protected void btnItemDetail_Click(object sender, EventArgs e) { if (ApplicationSession.SalesType.IsCatering()) { Response.Redirect("CartPage.aspx"); } else { int iTempID = ApplicationSession.SalesMaster.CollectionSalesDetail().SelectedItem().TempID; if (iTempID > 0) { SalesDetailCollection col = ApplicationSession.SalesMaster.CollectionSalesDetail(ApplicationSession.QRcode == ""); CSalesDetail sd = col.ToList().Find(obj => obj.TempID == iTempID); if (sd != null) { SalesDetailCollection children = sd.Children; if (children.Count == 0) { AddAutomaticSelectionGroup(sd.Qty); } lblMessage_OrderItem.Text = ""; DisplayItemDetail(); } } } }
private decimal TotalItem_oneGroup(List <CItemDetail> lstItemDetail) { decimal dQty = 0; CSalesDetail sd = ApplicationSession.SalesMaster.CollectionSalesDetail().SelectedItem(); if (sd != null) { SalesDetailCollection col = sd.Children; if (col.Count > 0) { foreach (CItemDetail id in lstItemDetail) { CSalesDetail sd0 = col.ToList().Find(obj => obj.TransID == id.ID); if (sd0 != null) { if (sd0.Qty > 0) { if (id.Qty > 0) { decimal dReqQty = sd0.Qty / id.Qty; dQty += dReqQty; } } } } } } return(dQty); }
protected void txtQty_TextChanged(object sender, EventArgs e) { TextBox txt = (TextBox)sender; decimal dQty = decimal.Parse(txt.Text); ListViewDataItem item = (ListViewDataItem)txt.Parent; HiddenField hf = (HiddenField)item.FindControl("hf_TempID"); bool isNumeric = int.TryParse(hf.Value, out int iTempID); if (isNumeric) { SalesDetailCollection col = ApplicationSession.SalesMaster.CollectionSalesDetail(); CSalesDetail sd = col.ToList().Find(obj => obj.TempID == iTempID); if (sd != null) { sd.Qty = dQty; MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName); bool blnDetail = sd.HasDetails(conn, ApplicationSession.StoreID, ApplicationSession.OutletID); if (blnDetail) { Master.DisplayOrderItem(sd); } else { UpdateOneItem(item, sd); } } } Master.MyProperty = ApplicationSession.QtyCart; }
protected void popup_btnPlusMinus_Click(object sender, EventArgs e) { int iTempID = ApplicationSession.SalesMaster.CollectionSalesDetail().SelectedItem().TempID; if (iTempID > 0) { SalesDetailCollection col = ApplicationSession.SalesMaster.CollectionSalesDetail(); CSalesDetail sd = col.ToList().Find(obj => obj.TempID == iTempID); if (sd != null) { string sQty = popup_txtQty.Text; bool bln = decimal.TryParse(sQty, out decimal dQty); if (bln) { Button btn = (Button)sender; if (btn.CommandName == "plus") { dQty += 1; } else { if (dQty >= 1) { dQty -= 1; } } sd.Qty = dQty; lblTotal.Text = sd.TotalPrice_ToString; popup_txtQty.Text = dQty.ToString(); MyProperty = ApplicationSession.QtyCart; } /* * if (dQty > 0) * { * btnCondiment.Enabled = true; * * MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName); * bool blnDetail = sd.HasDetails(conn, ApplicationSession.StoreID, ApplicationSession.OutletID); * btnItemDetail.Enabled = blnDetail; * } */ } lblMessage_OrderItem.Text = ""; //btnPlusMinusClicked(sd, new EventArgs()); } ShowModalPopupExtender_OrderItem(); }
protected void EditItem_Click(object sender, EventArgs e) //linkItem { LinkButton btn = (LinkButton)sender; string sArg = btn.CommandArgument; bool isNumeric = int.TryParse(sArg, out int iTempID); if (isNumeric) { SalesDetailCollection col = ApplicationSession.SalesMaster.CollectionSalesDetail(); CSalesDetail sd = col.ToList().Find(obj => obj.TempID == iTempID); if (sd != null) { DisplayOrderItem(sd); } } }
protected void btnPlusMinus_Click(object sender, EventArgs e) { LinkButton btn = (LinkButton)sender; ListViewDataItem item = (ListViewDataItem)btn.Parent.Parent; Label lbl = (Label)item.FindControl("lblQty"); string sArg = Convert.ToString(btn.CommandArgument); bool isNumeric = int.TryParse(sArg, out int iItemMasterID); if (isNumeric) { SalesDetailCollection col = ApplicationSession.SalesMaster.CollectionSalesDetail(ApplicationSession.QRcode == ""); CSalesDetail sd = col.ToList().Find(obj => obj.TransID == iItemMasterID); if (btn.CommandName == "plus") { if (sd is null) { sd = AddItemToCart(iItemMasterID, 1); } else { sd.Qty += 1; } } else { if (sd is null) { } else { if (sd.Qty >= 1) { sd.Qty -= 1; } } } if (sd != null) { lbl.Text = sd.Qty_ToString; if (sd.Qty > 0) { ShowMasterModalPopup_DisplayOrderItem_IfItemHasDetail(sd); } } } Master.MyProperty = ApplicationSession.QtyCart; }
protected void EditItem_Click(object sender, EventArgs e) //linkItem { LinkButton btn = (LinkButton)sender; string sArg = btn.CommandArgument; bool isNumeric = int.TryParse(sArg, out int iTempID); if (isNumeric) { SalesDetailCollection col = ApplicationSession.SalesMaster.CollectionSalesDetail(ApplicationSession.QRcode == ""); CSalesDetail sd = col.ToList().Find(obj => obj.TempID == iTempID); if (sd != null) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "#ModalMyCart", "$('body').removeClass('modal-open');$('.modal-backdrop').remove();", true); DisplayOrderItem(sd); } } }
protected void MenuItem_Click(object sender, EventArgs e) { HtmlAnchor anchor = (HtmlAnchor)sender; string sArg = anchor.Attributes["customdata"]; bool isNumeric = int.TryParse(sArg, out int iItemMasterID); if (isNumeric) { SalesDetailCollection col = ApplicationSession.SalesMaster.CollectionSalesDetail(ApplicationSession.QRcode == ""); CSalesDetail sd = col.ToList().Find(obj => obj.TransID == iItemMasterID); if (sd is null) { sd = AddItemToCart(iItemMasterID, 0); } Master.DisplayOrderItem(sd); //ClientScript.RegisterStartupScript(typeof(Page), "autoPostback", ClientScript.GetPostBackEventReference(this, String.Empty), true); } }
protected void popup_btnPlusMinus_Click(object sender, EventArgs e) { int iTempID = ApplicationSession.SalesMaster.CollectionSalesDetail().SelectedItem().TempID; if (iTempID > 0) { SalesDetailCollection col = ApplicationSession.SalesMaster.CollectionSalesDetail(ApplicationSession.QRcode == ""); CSalesDetail sd = col.ToList().Find(obj => obj.TempID == iTempID); if (sd != null) { string sQty = popup_txtQty.Text; bool bln = decimal.TryParse(sQty, out decimal dQty); if (bln) { Button btn = (Button)sender; if (btn.CommandName == "plus") { dQty += 1; } else { if (dQty >= 1) { dQty -= 1; } } sd.Qty = dQty; lblTotal.InnerText = sd.TotalPrice_ToString; popup_txtQty.Text = dQty.ToString(); PopupWindowQtyClicked?.Invoke(sd, EventArgs.Empty); } } lblMessage_OrderItem.Text = ""; MyProperty = ApplicationSession.QtyCart; } ShowModalDialog_OrderItem(); }
protected void lvwItemDetail_ItemCommand(object sender, ListViewCommandEventArgs e) { switch (e.CommandName) { case "plus": decimal dRmnQty = GetRemainingQty_currentGroup(); if (dRmnQty > 0) { goto case "minus"; } else { ShowModalDialog_ListDetail(); break; } case "minus": ListViewItem item = e.Item; LinkButton btn = (LinkButton)item.FindControl("popup_btnMinus_Detail"); string sArg = Convert.ToString(btn.CommandArgument); bool isNumeric = int.TryParse(sArg, out int iItemDetailID); if (isNumeric) { Label lbl = (Label)item.FindControl("lblQty_Detail"); CSalesDetail sd = ApplicationSession.SalesMaster.CollectionSalesDetail().SelectedItem(); if (sd != null) { SalesDetailCollection col = sd.Children; if (col.Count > 0) { CSalesDetail sd0 = col.ToList().Find(obj => obj.TransID == iItemDetailID); if (e.CommandName == "plus") { if (sd0 is null) { decimal dQty = AddItemDetailToComboItem(iItemDetailID); lbl.Text = string.Format("{0:#,0}", dQty); } else { sd0.Qty += 1; lbl.Text = sd0.Qty_ToString; } } else { if (sd0 is null) { } else { if (sd0.Qty >= 1) { sd0.Qty -= 1; lbl.Text = sd0.Qty_ToString; } } } } else { if (e.CommandName == "plus") { decimal dQty = AddItemDetailToComboItem(iItemDetailID); lbl.Text = string.Format("{0:#,0}", dQty); } } } } lblMessage_ListDetail.Text = ""; ShowModalDialog_ListDetail(); break; } }