Ejemplo n.º 1
0
        protected void btnCondiment_Click(object sender, EventArgs e)
        {
            if (ApplicationSession.SalesType.IsCatering())
            {
                Response.Redirect("CategoryPage.aspx");
            }
            else
            {
                CSalesDetail item = ApplicationSession.SalesMaster.CollectionSalesDetail().SelectedItem();
                if (item != null)
                {
                    lblItemName.InnerText = item.TransName;

                    lvwModalItemCond.DataSource = item.Condiments;
                    lvwModalItemCond.DataBind();

                    MySqlConnection   conn  = CMain.GetConnection(ApplicationSession.DBName);
                    List <CCondGroup> lstCG = CItemMaster.ListOfCondGroups(conn, item.TransID, ApplicationSession.StoreID, ApplicationSession.OutletID);

                    lvwModalCondGroup.DataSource = lstCG;
                    lvwModalCondGroup.DataBind();

                    lblMessage_OrderItem.Text = "";
                    ShowModalDialog_Condiment();
                }
            }
        }
Ejemplo n.º 2
0
        protected void btnSend_Click(object sender, EventArgs e)
        {
            ClearScreen();
            string sEmail = txtUserID.Text.Trim();

            if (sEmail == "")
            {
                MessageBox.Show("Please key-in email address");
            }
            else
            {
                if (!CMain.IsValidEmail(sEmail))
                {
                    MessageBox.Show("Email address is not in the right format");
                }
                else
                {
                    MySqlConnection conn   = CMain.GetConnection(ApplicationSession.DBName);
                    CMember         member = new CMember(sEmail, conn);
                    if (member.IsEmpty())
                    {
                        lblStatus.Text      = "UserID/Email has not been registered. Please Register";
                        linkBtn.Text        = "here";
                        linkBtn.CommandName = "register";
                    }
                    else
                    {
                        DoChangePassword(member.Name, sEmail);
                    }
                }
            }
        }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
0
        protected void btnSendPassword_Click(object sender, EventArgs e)
        {
            MySqlConnection conn   = CMain.GetConnection(ApplicationSession.DBName);
            string          sEmail = emailInput.Value;
            CMember         member = new CMember(sEmail, conn);

            if (member.IsEmpty())
            {
                MessageBox.Show("UserID/Email has not been registered. Please Register");
            }
            else
            {
                string errMsg = CMain.ChangePassword(member.Name, sEmail, true);
                if (errMsg == "")
                {
                    ApplicationSession.cnt += 1;
                    string msg = (ApplicationSession.cnt > 1) ? "resent" : "sent";

                    MessageBox.Show("A temporary password has been " + msg + " to " + sEmail);
                    //lblStatus.Text = "Have not received it? Please click here to";
                    //linkBtn.Text = "resend";
                }
                else
                {
                    MessageBox.Show("Fail to send email. Please try again");
                    // lblStatus.Text = "";
                    //linkBtn.Text = "";
                }
            }
        }
Ejemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string strID = Request.QueryString["id"];
         if ((strID == null) || (strID == "0"))
         {
             MySqlConnection  conn = CMain.GetConnection(ApplicationSession.DBName);
             List <CCategory> lst  = CCategory.ListOfCategoryZero(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);
             lvwCategory.DataSource = lst;
             lvwCategory.DataBind();
         }
         else
         {
             bool isNumeric = int.TryParse(strID, out int iCategoryID);
             if (isNumeric)
             {
                 MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);
                 CCategory       cat  = new CCategory(iCategoryID, conn);
                 lblTitle.Text = cat.Caption;
                 List <CCategory> lst = cat.ListOfChildren(conn);
                 lvwCategory.DataSource = lst;
                 lvwCategory.DataBind();
             }
         }
     }
 }
Ejemplo n.º 6
0
        public static string ChangePassword(string sName, string sEmail, bool bySystem)
        {
            string          sResult = "";
            MySqlConnection conn    = CMain.GetConnection(ApplicationSession.DBName);
            CMember         member  = new CMember(sEmail, conn);

            if (member.IsEmpty())
            {
                sResult = "UserID/Email has not been registered. Please SignUp to register.";
            }
            else
            {
                string sNewPassword = CKeyGenerator.GetUniqueKey(8);
                bool   bln          = member.ChangePassword(conn, member.ID, sEmail, sNewPassword, bySystem);
                if (bln)
                {
                    string sSubject = "DreamWeb Reset Password";
                    string sMessage = "Hi " + sName + ", ";
                    sMessage += "<br /> <br /> Here is your temporary password: "******"<br /> Please, use this password to login.";
                    sMessage += "<br /> <br /> Thanks and Regards, <br /> <br /> <br /> DreamPosWeb Support";

                    sResult = SendEmail(sName, sEmail, sSubject, sMessage);
                }
                else
                {
                    sResult = "Fail to update password. Please try again.";
                }
            }

            return(sResult);
        }
Ejemplo n.º 7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         string strID = Request.QueryString["id"];
         if (strID == null)
         {
             if (!ApplicationSession.SalesMaster.IsEmpty())
             {
                 MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);
                 CSalesMaster    sm   = new CSalesMaster(ApplicationSession.SalesMaster.ID, conn);
                 if (!sm.IsEmpty())
                 {
                     DisplayInfo(sm, conn);
                 }
             }
         }
         else
         {
             bool isNumeric = int.TryParse(strID, out int iID);
             if (isNumeric)
             {
                 MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);
                 CSalesMaster    sm   = new CSalesMaster(iID, conn);
                 if (!sm.IsEmpty())
                 {
                     DisplayInfo(sm, conn);
                 }
             }
         }
     }
 }
Ejemplo n.º 8
0
 private void ShowMasterModalPopup_DisplayOrderItem_IfItemHasDetail(CSalesDetail sd)
 {
     MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);
     bool blnDetail = sd.HasDetails(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);
     if (blnDetail)
     {
         Master.DisplayOrderItem(sd);
     }
 }
Ejemplo n.º 9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);
         List <CMiniSM>  lst  = CMember.ListOfPastOrders(conn, ApplicationSession.member.ID, ApplicationSession.StoreID);
         lvwOrderHistory.DataSource = lst;
         lvwOrderHistory.DataBind();
     }
 }
Ejemplo n.º 10
0
        public void DisplayDropdownMenu()
        {
            MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);

            if (ApplicationSession.SalesType.IsCatering())
            {
                //Category:
                List <CCategory> lst = CCategory.ListOfCategoryZero(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);
                foreach (CCategory cat in lst)
                {
                    HtmlGenericControl li = new HtmlGenericControl("li");
                    tabs.Controls.Add(li);
                    HtmlGenericControl anchor = new HtmlGenericControl("a");
                    string             url    = "CategoryPage.aspx?id=" + cat.ID.ToString();
                    anchor.Attributes.Add("href", url);
                    //anchor.Attributes.Add("runat", "server");
                    //anchor.Attributes.Add("onclick", "return MyFunction();");
                    anchor.InnerText = cat.Caption;
                    li.Controls.Add(anchor);
                }
            }
            else
            {
                //ItemGroups:
                List <CItemGroup> lst = COutlet.ListOfItemGroups(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);
                foreach (CItemGroup ig in lst)
                {
                    HtmlGenericControl li = new HtmlGenericControl("li");
                    tabs.Controls.Add(li);
                    HtmlGenericControl anchor = new HtmlGenericControl("a");
                    string             url    = "MenuItemPage.aspx?id=" + ig.ID.ToString();
                    anchor.Attributes.Add("href", url);
                    //anchor.Attributes.Add("runat", "server");
                    //anchor.Attributes.Add("onclick", "return MyFunction();");
                    anchor.InnerText = ig.Name;
                    li.Controls.Add(anchor);
                }
            }

            //DeliveryMethods:
            List <CDeliveryMode> lstDelMode = COutlet.ListOfDeliveryModes(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);

            foreach (CDeliveryMode delMode in lstDelMode)
            {
                HtmlGenericControl li = new HtmlGenericControl("li");
                delTabs.Controls.Add(li);
                HtmlGenericControl anchor = new HtmlGenericControl("a");
                //string url = "MenuItemPage.aspx?id=" + ig.ID.ToString();
                //anchor.Attributes.Add("href", url);
                //anchor.Attributes.Add("runat", "server");
                //anchor.Attributes.Add("onclick", "return MyFunction();");
                anchor.InnerText = delMode.Name;
                li.Controls.Add(anchor);
            }
        }
Ejemplo n.º 11
0
        protected void btnCheckout_Click(object sender, EventArgs e)
        {
            if (ApplicationSession.QRcode == "")
            {
                Response.Redirect("Checkout.aspx");
            }
            else
            {
                MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);
                CSalesMaster    sm   = ApplicationSession.SalesMaster;
                if (sm.IsEmpty())
                {
                    sm.CreateNewSales(ApplicationSession.StoreID, ApplicationSession.OutletID, ApplicationSession.SalesType.ID,
                                      1, "", 0, (int)CSalesMaster.EFlagStatus.STATUS_ORDER, 0, "", "", 0, ApplicationSession.TableNo, false);

                    if (sm.InsertRecord(conn))
                    {
                        sm.SetSalesMasterID(sm.ID);
                    }
                    else
                    {
                        //kasih message error
                    }
                }

                sm.Recalculate(ApplicationSession.SalesType);
                sm.UpdateRecord_SalesAmounts(conn);

                List <CSalesDetail> lst = sm.GetChildrenToBeSent;

                if (lst.Count > 0)
                {
                    foreach (CSalesDetail sd in lst)
                    {
                        if (sd.isEmpty)
                        {
                            sd.SalesMasterID = sm.ID;
                            sd.InsertRecord(conn, true);
                        }
                        else
                        {
                            sd.UpdateRecord_Send(conn);
                        }
                    }

                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ModalConfirmed", "$(document).ready(function () {$('#ModalConfirmed').modal();});", true);
                }
                else
                {
                    //kasih message no record
                }
            }
        }
Ejemplo n.º 12
0
        private void DisplayItemGroups()
        {
            MySqlConnection conn   = CMain.GetConnection(ApplicationSession.DBName);
            COutlet         outlet = new COutlet(ApplicationSession.OutletID, conn);

            lblTitle.InnerText = outlet.Name;
            lblSlogan.Text     = "Welcome!";

            List <CItemGroup> lst = COutlet.ListOfItemGroups(conn, outlet.StoreID, outlet.ID);

            lvItemGroup.DataSource = lst;
            lvItemGroup.DataBind();
        }
Ejemplo n.º 13
0
        private void InitFromTableNo(string sTableNo)
        {
            MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);

            CSalesMaster sm = new CSalesMaster(ApplicationSession.StoreID, ApplicationSession.OutletID, sTableNo, conn);

            if (!sm.IsEmpty())
            {
                sm.RetrieveCollection(conn);
            }
            ApplicationSession.SalesMaster = sm;
            ApplicationSession.TableNo     = sTableNo;
        }
Ejemplo n.º 14
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");
                    }
                }
            }
        }
Ejemplo n.º 15
0
        protected void btnCheckout_Click(object sender, EventArgs e)
        {
            SalesDetailCollection col = ApplicationSession.SalesMaster.CollectionSalesDetail();

            if (col.Count == 0)
            {
                Master.DisplayModalMessageBox("Your cart is empty");
            }
            else
            {
                string s         = btnCheckout.Attributes["PayModeID"];
                bool   isNumeric = int.TryParse(btnCheckout.Attributes["PayModeID"], out int iPayModeID);
                if (isNumeric)
                {
                    CSalesMaster sm = new CSalesMaster();
                    sm.CreateNewSales(ApplicationSession.StoreID, ApplicationSession.OutletID, ApplicationSession.SalesType.ID, 1, "",
                                      ApplicationSession.member.ID, (int)CSalesMaster.EFlagStatus.STATUS_ORDER,
                                      iPayModeID, btnCheckout.Attributes["PayModeName"], "", 0, ApplicationSession.SalesMaster.TableNo, false);

                    if (ApplicationSession.SalesType.IsCatering())
                    {
                        sm.FromDate = ApplicationSession.category.OrderDate;
                    }

                    try
                    {
                        MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);
                        if (sm.InsertRecord(conn))
                        {
                            sm.SetSalesMasterID(sm.ID);
                            sm.InsertChildrenRecords(conn, false);

                            aOrderNo.InnerText          = sm.Number;
                            aOrderNo.Attributes["smid"] = sm.ID.ToString();

                            ApplicationSession.SalesMaster.RefreshCollection();
                            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ModalConfirmed", "$(document).ready(function () {$('#ModalConfirmed').modal();});", true);
                        }
                        else
                        {
                            //lblMessage.Text = "Fail to save order. Please try again";
                        }
                    }
                    catch
                    {
                        //lblMessage.Text = "Fail to save order. Please try again";
                    }
                }
            }
        }
Ejemplo n.º 16
0
        private void DisplayMenuItem()
        {
            int iItemGroupID = ApplicationSession.ItemGroupID;
            if (iItemGroupID > 0)
            {
                MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);

                CItemGroup ig = new CItemGroup(iItemGroupID, conn);
                lblMenu.InnerText = ig.Name;
                
                List<CItemMaster> lst = ig.ListOfItemMasters(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);
                lvwMenuItem.DataSource = lst;
                lvwMenuItem.DataBind();
            }
        }
Ejemplo n.º 17
0
        private decimal AddItemDetailToComboItem(int iItemDetailID)
        {
            decimal         dQty = 0;
            MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);
            CItemDetail     id   = new CItemDetail(iItemDetailID, conn, ApplicationSession.StoreID, ApplicationSession.OutletID);

            //masuk ke dalam child
            if (!id.IsEmpty())
            {
                ApplicationSession.idx += 1;
                dQty = id.Qty;
                CSalesDetail sd = new CSalesDetail(ApplicationSession.idx, id.ID, id.ItemCode, id.ItemName, id.SelGrp.ToString(), dQty, id.Price,
                                                   id.UnitSymbol, "", "", 0, ApplicationSession.StoreID, ApplicationSession.OutletID, 0, "");
                ApplicationSession.SalesMaster.CollectionSalesDetail().SelectedItem().Children.Add(sd);
            }
            return(dQty);
        }
Ejemplo n.º 18
0
        private void DisplayItemDetail(int grp = 1)
        {
            MySqlConnection      conn = CMain.GetConnection(ApplicationSession.DBName);
            ItemDetailCollection col  = ApplicationSession.SalesMaster.CollectionSalesDetail().SelectedItem().ItemDetails(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);
            List <CItemDetail>   lst  = col.ListBySelectionGroup(grp);

            lvwModalListDetail.DataSource = lst;
            lvwModalListDetail.DataBind();

            btnPrev.Enabled = (grp > col.LBoundIndex());
            btnPrev.Attributes.Add("idx", grp.ToString());
            btnNext.Enabled = (grp < col.UBoundIndex());
            btnNext.Attributes.Add("idx", grp.ToString());

            lblMasterName.InnerText = ApplicationSession.SalesMaster.CollectionSalesDetail().SelectedItem().TransName;
            ShowModalDialog_ListDetail();
        }
Ejemplo n.º 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string strName = Request.QueryString["name"];
            string strID   = Request.QueryString["id"];

            if (strName != null)
            {
                if (strID != null)
                {
                    bool isNumeric = int.TryParse(strID, out int iID);
                    if (isNumeric)
                    {
                        if (iID == 0)
                        {
                            if (strName == "outlet")
                            {
                                iID = ApplicationSession.OutletID;
                            }
                        }
                        MySqlConnection conn   = CMain.GetConnection(ApplicationSession.DBName);
                        byte[]          bPhoto = FetchImage(strName, iID, conn);


                        if (bPhoto == null)
                        {
                            string noImageURL = "~/images/noimage.jpg";
                            bPhoto = File.ReadAllBytes(Server.MapPath(noImageURL));
                        }


                        if (bPhoto != null)
                        {
                            Response.Buffer  = true;
                            Response.Charset = "";
                            Response.Cache.SetCacheability(HttpCacheability.NoCache);
                            Response.ContentType = "image/jpeg";
                            //Response.AddHeader("content-disposition", "attachment;filename=" + dt.Rows[0]["Name"].ToString());
                            Response.BinaryWrite(bPhoto);
                            Response.Flush();
                            Response.End();
                        }
                    }
                }
            }
        }
Ejemplo n.º 20
0
        private CSalesDetail AddItemToCart(int iItemMasterID, decimal dQty)
        {
            CSalesDetail sd = new CSalesDetail();
            MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);
            CItemMaster im = new CItemMaster(iItemMasterID, conn);
            //masuk ke dalam cart
            if (im.Name != "")
            {
                ApplicationSession.idx += 1;
                int flg = (int)CSalesDetail.EFlagStatus.TRANS_ITEM;
                sd = new CSalesDetail(ApplicationSession.idx, im.ID, im.Code, im.Name, im.ItemGroupName, dQty, im.Price, im.UnitSymbol, 
                                     "", "", 0, ApplicationSession.StoreID, ApplicationSession.OutletID, flg, ApplicationSession.ChairNo);

                //Master.MyProperty = ApplicationSession.QtyCart;
                List<CPromo> lstPromo = CItemMaster.ListOfItemPromos(conn, ApplicationSession.SalesType.ID, iItemMasterID, im.ItemGroupID,
                                                                     ApplicationSession.StoreID, ApplicationSession.OutletID, CSetting.GetFlagOfToday());

                //auto promo:
                IEnumerable<CPromo> lstAuto = lstPromo.Where(promo => promo.IsAutoPromo());
                if (lstAuto.ToList().Count > 0)
                {
                    List<CMiniItem> lst = sd.ApplyListOfItemPromo(lstAuto.ToList());
                    foreach (CMiniItem item in lst)
                    {
                        if (item.Name == "item")
                        {
                            ApplicationSession.idx += 1;
                            CSalesDetail child = new CSalesDetail(ApplicationSession.idx, item.ID, "promo", item.Name, "", item.Qty, item.UnitPrice, 
                                                                  "", "", "", 0, ApplicationSession.StoreID, ApplicationSession.OutletID, 0, "");
                            sd.Children.Add(child);
                        }
                    }
                }

                //manual promo:
                IEnumerable<CPromo> lstManual = lstPromo.Where(promo => promo.IsAutoPromo() == false);
                if (lstManual.ToList().Count > 0)
                {
                    //show promos & add it to sd.children
                }

                ApplicationSession.SalesMaster.CollectionSalesDetail().Add(sd);
            }
            return sd;
        }
Ejemplo n.º 21
0
        private void AddAutomaticSelectionGroup(decimal dQty)
        {
            MySqlConnection      conn = CMain.GetConnection(ApplicationSession.DBName);
            ItemDetailCollection col  = ApplicationSession.SalesMaster.CollectionSalesDetail().SelectedItem().ItemDetails(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);
            List <CItemDetail>   lst  = col.AutomaticSelection();

            foreach (CItemDetail id in lst)
            {
                if (!id.IsEmpty())
                {
                    ApplicationSession.idx += 1;
                    CSalesDetail sd = new CSalesDetail(ApplicationSession.idx, id.ID, id.ItemCode, id.ItemName, id.SelGrp.ToString(), (id.Qty * dQty),
                                                       id.Price, id.UnitSymbol, "", "", 0, ApplicationSession.StoreID, ApplicationSession.OutletID,
                                                       0, "");
                    ApplicationSession.SalesMaster.CollectionSalesDetail().SelectedItem().Children.Add(sd);
                }
            }
        }
Ejemplo n.º 22
0
        private decimal GetRemainingQty_currentGroup()
        {
            List <CItemDetail> lst = new List <CItemDetail>();

            string sGrp      = btnNext.Attributes["idx"];
            bool   isNumeric = int.TryParse(sGrp, out int iGrp);

            if (isNumeric)
            {
                MySqlConnection      conn = CMain.GetConnection(ApplicationSession.DBName);
                ItemDetailCollection col  = ApplicationSession.SalesMaster.CollectionSalesDetail().SelectedItem().ItemDetails(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);
                lst = col.ListBySelectionGroup(iGrp);
            }

            decimal dTotItem = TotalItem_oneGroup(lst);
            decimal dRmnQty  = ApplicationSession.SalesMaster.CollectionSalesDetail().SelectedItem().Qty - dTotItem;

            return(dRmnQty);
        }
Ejemplo n.º 23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                _isDirty = false;
                ClearScreen();
                string sStatus = Request.QueryString["status"];
                if (sStatus != null)
                {
                    switch (sStatus)
                    {
                    case "new":
                        string email = Request.QueryString["email"];
                        if (email != null)
                        {
                            if (CMain.IsValidEmail(email))
                            {
                                txtEmail.Text = email;
                            }
                        }
                        lblTitle.InnerText     = "Account Registration";
                        btnReg.Text            = "Create Account";
                        btnReg.CommandName     = "create";
                        btnReg.CommandArgument = "0";
                        txtPass.Visible        = true;
                        break;

                    case "member":
                        MySqlConnection conn   = CMain.GetConnection(ApplicationSession.DBName);
                        CMember         member = new CMember(ApplicationSession.member.Email, conn);
                        DisplayMember(member);

                        lblTitle.InnerText     = "Member Info";
                        btnReg.Text            = "Update Info";
                        btnReg.CommandName     = "update";
                        btnReg.CommandArgument = member.ID.ToString();

                        txtPass.Visible = false;
                        break;
                    }
                }
            }
        }
Ejemplo n.º 24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string sOutletID = Request.QueryString["oid"];
                if (sOutletID != null)
                {
                    bool isNumeric = int.TryParse(sOutletID, out int iOutletID);
                    if (isNumeric)
                    {
                        CMain.InitParams(iOutletID);
                    }
                }

                MySqlConnection   conn = CMain.GetConnection(ApplicationSession.DBName);
                List <CSalesType> lst  = COutlet.ListOfSalesTypes(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);
                lvwSalesType.DataSource = lst;
                lvwSalesType.DataBind();
            }
        }
Ejemplo n.º 25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                btnCheckout.Attributes["PayModeID"]   = "";
                btnCheckout.Attributes["PayModeName"] = "";

                CSalesMaster    sm   = ApplicationSession.SalesMaster;
                MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);
                lvwOrder.DataSource = sm.CollectionSalesDetail(true, conn);
                lvwOrder.DataBind();

                lblSubtotal.Text      = sm.Subtotal_ToString;
                lblTaxName.Text       = (ApplicationSession.SalesType.TaxName == "") ? "Tax" : ApplicationSession.SalesType.TaxName;
                lblTaxAmt.Text        = sm.Tax_ToString;
                lblTotal.Text         = sm.SalesTotal_ToString;
                btnCheckout.InnerText = "PAY ";
                checkoutAmt.InnerText = sm.SalesTotal_ToString;
            }
        }
Ejemplo n.º 26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                //ApplicationSession.SalesMaster.CollectionSalesDetail() = new SalesDetailCollection();
                CStore store = CMain.GetStoreRecord(ApplicationSession.StoreID);
                if (store.IsEmpty())
                {
                    MessageBox.Show("Fail to retrieve Store Record");
                }
                else
                {
                    MySqlConnection conn = CMain.GetConnection(ApplicationSession.DBName);

                    List <COutlet> lst = store.ListOfOutlets(conn);
                    lvwOutlet.DataSource = lst;
                    lvwOutlet.DataBind();
                }
            }
        }
Ejemplo n.º 27
0
        private void ShowModalPopupExtender_OrderItem()
        {
            CSalesDetail sd = ApplicationSession.SalesMaster.CollectionSalesDetail().SelectedItem();

            if (ApplicationSession.SalesType.IsCatering())
            {
                btnCondiment.Text         = "Continue Ordering";
                btnCondiment.CommandName  = "menu";
                btnItemDetail.Text        = "Checkout";
                btnItemDetail.CommandName = "checkout";
                btnOK.Text        = "Cancel";
                btnOK.CommandName = "cancel";
            }
            else
            {
                btnCondiment.Text         = "Condiments";
                btnCondiment.CommandName  = "condiment";
                btnItemDetail.Text        = "Choose Options";
                btnItemDetail.CommandName = "option";

                btnCondiment.Enabled  = false;
                btnItemDetail.Enabled = false;

                if (sd != null)
                {
                    if (sd.Qty > 0)
                    {
                        btnCondiment.Enabled = true;

                        MySqlConnection conn      = CMain.GetConnection(ApplicationSession.DBName);
                        bool            blnDetail = sd.HasDetails(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);
                        btnItemDetail.Enabled = blnDetail;
                    }
                }
            }


            PanelPopup_OrderItem.Width  = browser.IsMobileDevice == true ? CONST_POPUP_WIDTH_MOBILE : CONST_POPUP_WIDTH;
            PanelPopup_OrderItem.Height = browser.IsMobileDevice == true ? CONST_POPUP_HEIGHT_MOBILE : CONST_POPUP_HEIGHT;
            ModalPopupExtender_OrderItem.Show();
        }
        private string DoChangePassword(string sPswd)
        {
            string          errMsg = "";
            MySqlConnection conn   = CMain.GetConnection(ApplicationSession.DBName);
            string          sEmail = ApplicationSession.member.Email;
            CMember         member = new CMember(sEmail, conn);

            if (member.IsEmpty())
            {
                errMsg = "UserID/Email has not been registered. Please SignUp to register";
            }
            else
            {
                bool bln = member.ChangePassword(conn, member.ID, sEmail, sPswd, false);
                if (!bln)
                {
                    errMsg = "Fail to update password. Please try again.";
                }
            }
            return(errMsg);
        }
Ejemplo n.º 29
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string sUserID = txtUserID.Value;

            if (sUserID == "")
            {
                //lblMessage.Text = "Please Fill In UserID";
            }
            else
            {
                string          sPswd  = txtPswd.Value;
                MySqlConnection conn   = CMain.GetConnection(ApplicationSession.DBName);
                CMember         member = new CMember(sUserID, conn);
                if (member.IsEmpty())
                {
                    //lblMessage.Text = "UserID/Email has not been registered. Please SignUp to register.";
                }
                else
                {
                    if (member.IsPasswordValid(sUserID, sPswd))
                    {
                        ApplicationSession.member = new CMiniMember(member.Name, member.ID, sUserID);

                        if (member.IsUsingTemporaryPassword())
                        {
                            Response.Redirect("ChangePasswordPage.aspx");
                        }
                        else
                        {
                            GoToOptionPages(conn);
                        }
                    }
                    else
                    {
                        //lblMessage.Text = "Wrong password! Try again or click Forget Password to reset your password.";
                    }
                }
            }
        }
Ejemplo n.º 30
0
        private CMiniItem CheckIfAnyItemDetailMissing()
        {
            CMiniItem            miniItem = new CMiniItem();
            MySqlConnection      conn     = CMain.GetConnection(ApplicationSession.DBName);
            ItemDetailCollection col      = ApplicationSession.SalesMaster.CollectionSalesDetail().SelectedItem().ItemDetails(conn, ApplicationSession.StoreID, ApplicationSession.OutletID);
            int lbound = col.LBoundIndex();
            int ubound = col.UBoundIndex();

            for (int grp = lbound; grp <= ubound; grp++)
            {
                List <CItemDetail> lst      = col.ListBySelectionGroup(grp);
                decimal            dTotItem = TotalItem_oneGroup(lst);
                decimal            dRmnQty  = ApplicationSession.SalesMaster.CollectionSalesDetail().SelectedItem().Qty - dTotItem;
                if (dRmnQty > 0)
                {
                    miniItem = new CMiniItem(grp, "", dRmnQty, 0);
                    break;
                }
            }

            return(miniItem);
        }