コード例 #1
0
        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);
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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();
                    }
                }
            }
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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;
        }
コード例 #6
0
        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();
        }
コード例 #7
0
        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);
                }
            }
        }
コード例 #8
0
        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;
        }
コード例 #9
0
        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);
                }
            }
        }
コード例 #10
0
        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);


            }
        }
コード例 #11
0
        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();
        }
コード例 #12
0
        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;
            }
        }