Example #1
0
 protected void lvwSalesType_ItemDataBound(object sender, ListViewItemEventArgs e)
 {
     using (ListViewDataItem item = (ListViewDataItem)e.Item)
     {
         if (item != null)
         {
             HiddenField hf    = (HiddenField)item.FindControl("hf_STobject");
             CSalesType  st    = (CSalesType)item.DataItem;
             string      sJson = JsonConvert.SerializeObject(st);
             hf.Value = sJson;
         }
     }
 }
Example #2
0
        protected void SalesType_Clicked(object sender, EventArgs e)
        {
            HtmlAnchor a = (HtmlAnchor)sender;
            //ListViewItem item0 = (ListViewItem)a.Parent.Parent;
            HiddenField hf0 = (HiddenField)a.FindControl("hf_STobject");
            CSalesType  st  = JsonConvert.DeserializeObject <CSalesType>(hf0.Value);

            if (!st.isEmpty)
            {
                MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);
                st.FetchListOfOrderPromos(conn, ApplicationSession.StoreID, ApplicationSession.OutletID, CSetting.GetFlagOfToday());
                ApplicationSession.SalesType = st;
                if (st.IsCatering())
                {
                    Response.Redirect("CategoryPage.aspx");
                }
                else
                {
                    if (st.IsType(CSalesType.EFlagType.TYPE_DINEIN))
                    {
                        //CreateOrder:
                        //>>input: CoverAmt & TableNo

                        CSalesMaster sm = new CSalesMaster();
                        sm.CreateNewSales(ApplicationSession.StoreID, ApplicationSession.OutletID, ApplicationSession.SalesType.ID,
                                          1, "", 0, (int)CSalesMaster.EFlagStatus.STATUS_ORDER, 0, "", "", 0, "", true);

                        if (sm.InsertRecord(conn))
                        {
                            string str = "MainMenu.aspx?qr=010101&sm=" + sm.ID.ToString();
                            Response.Redirect(str);

                            //System.Drawing.Bitmap imgQR = CMain.CreateQRCode(str);
                            //Response.ContentType = "Image/jpeg";
                            //imgQR.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);

                            //imgQR.Save(Server.MapPath("~/images/QRcode.jpg"), System.Drawing.Imaging.ImageFormat.Jpeg);

                            //imgQRcode.ImageUrl = "~/images/QRcode.jpg";
                            //aOrderNo.InnerText = str;
                            //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ModalConfirmed", "$(document).ready(function () {$('#ModalConfirmed').modal();});", true);
                            //Master.DisplayModalMessageBox("testing...");
                        }
                    }
                    else
                    {
                        Response.Redirect("ItemGroupPage.aspx");
                    }
                }
            }
        }
Example #3
0
        private bool InitFromQRCode(string sQR)
        {
            bool bln          = false;
            int  iStoreID     = 0;
            int  iOutletID    = 0;
            int  iSalesTypeID = 0;

            if (sQR.Length == 6)
            {
                //char 1&2: StoreID
                string sStoreID  = sQR.Substring(0, 2);
                bool   isNumeric = int.TryParse(sStoreID, out int storeID);
                if (isNumeric)
                {
                    iStoreID = storeID;
                }

                if (iStoreID == 0)
                {
                    iStoreID = CMain.STOREID;
                }

                CStore store = CMain.GetStoreRecord(iStoreID);
                if (store.IsEmpty())
                {
                    MessageBox.Show("Store Record is not found");
                }
                else
                {
                    ApplicationSession.DBName  = store.DBName;
                    ApplicationSession.StoreID = iStoreID;
                    ApplicationSession.member  = new CMiniMember("walk-in", 0, "");

                    //char 3&4: OutletID
                    string sOutletID = sQR.Substring(2, 2);
                    isNumeric = int.TryParse(sOutletID, out int outletID);
                    if (isNumeric)
                    {
                        iOutletID = outletID;
                    }
                    if (iOutletID == 0)
                    {
                        iOutletID = CMain.OUTLETID;
                    }
                    CMain.InitParams(iOutletID);

                    //char 5&6: SalesTypeID
                    string sSalesTypeID = sQR.Substring(4, 2);
                    isNumeric = int.TryParse(sSalesTypeID, out int stID);
                    if (isNumeric)
                    {
                        iSalesTypeID = stID;
                    }
                    if (iSalesTypeID == 0)
                    {
                        iSalesTypeID = CMain.SALESTYPEID;
                    }
                    MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);
                    ApplicationSession.SalesType = CSalesType.FetchSalesType(conn, iSalesTypeID);

                    bln = true;
                }
            }
            else
            {
                MessageBox.Show("Parameter is not in the right format");
            }

            return(bln);
        }