Example #1
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 = "";
                }
            }
        }
 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);
                 }
             }
         }
     }
 }
Example #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;
        }
Example #4
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);
        }
        private void DoChangePassword(string sName, string sEmail)
        {
            ClearScreen();
            string errMsg = CMain.ChangePassword(sName, sEmail, true);

            if (errMsg == "")
            {
                ApplicationSession.cnt += 1;
                string msg = (ApplicationSession.cnt > 1)? "resent" : "sent";

                lblNotif.Text           = "A temporary password has been " + msg + " to " + sEmail;
                lblStatus.Text          = "Have not received it? Please click here to";
                linkBtn.Text            = "resend";
                linkBtn.CommandName     = "resend";
                linkBtn.CommandArgument = sName;
            }
            else
            {
                lblNotif.Text           = "Fail to send email. Please try again";
                lblStatus.Text          = "";
                linkBtn.Text            = "";
                linkBtn.CommandName     = "";
                linkBtn.CommandArgument = "";
            }
        }
Example #6
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();
                }
            }
        }
 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();
             }
         }
     }
 }
        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);
                    }
                }
            }
        }
Example #9
0
        private bool PasswordInputOK(string sPswd)
        {
            bool bln = false;

            if (sPswd == "")
            {
                MessageBox.Show("Please fill in Password");
            }
            else
            {
                if (!CMain.HasLetter(sPswd))
                {
                    MessageBox.Show("Password must contain at least one letter [a-z]");
                }
                else
                {
                    if (!CMain.HasNumber(sPswd))
                    {
                        MessageBox.Show("Password must contain at least one number [0-9]");
                    }
                    else
                    {
                        bln = true;
                    }
                }
            }
            return(bln);
        }
Example #10
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);
     }
 }
Example #11
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();
     }
 }
Example #12
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);
            }
        }
Example #13
0
        protected void btnOK_CategoryInfo_Clicked(object sender, EventArgs e)
        {
            bool isNumeric = decimal.TryParse(txtQty_CategoryInfo.Text, out decimal dQty);

            if (isNumeric)
            {
                ApplicationSession.category.OrderQty  = dQty;
                ApplicationSession.category.OrderDate = CMain.ConvertString_ToDate(txtDate_CategoryInfo.Text);
                PopupWindowCatInfoClicked(null, new EventArgs());
            }
        }
Example #14
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
                }
            }
        }
Example #15
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;
        }
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string sEmail = txtUserID.Text.Trim();

            if (!CMain.IsValidEmail(sEmail))
            {
                Response.Redirect("Default.aspx?email=" + sEmail);
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
        }
Example #17
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();
        }
Example #18
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 #19
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";
                    }
                }
            }
        }
Example #20
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();
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ApplicationSession.cnt = 0;
         ClearScreen();
         string email = Request.QueryString["email"];
         if (email != null)
         {
             if (CMain.IsValidEmail(email))
             {
                 txtUserID.Text = email;
             }
         }
     }
 }
        protected void btnChange_Click(object sender, EventArgs e)
        {
            string sPswd = txtPass.Text.Trim();

            if (sPswd == "")
            {
                MessageBox.Show("Please fill in Password");
            }
            else
            {
                if (!CMain.HasLetter(sPswd))
                {
                    MessageBox.Show("Password must contain at least one letter [a-z]");
                }
                else
                {
                    if (!CMain.HasNumber(sPswd))
                    {
                        MessageBox.Show("Password must contain at least one number [0-9]");
                    }
                    else
                    {
                        string sConfirm = txtConfirm.Text.Trim();
                        if (sConfirm == "")
                        {
                            MessageBox.Show("Please confirm your new password");
                        }
                        else
                        {
                            if (sConfirm != sPswd)
                            {
                                MessageBox.Show("Confirmed password does not match");
                            }
                            else
                            {
                                string errMsg = DoChangePassword(sPswd);
                                if (errMsg == "")
                                {
                                    MessageBox.Show("Your password has been successfully changed");
                                    Response.Redirect("HomePage.aspx");
                                }
                            }
                        }
                    }
                }
            }
        }
Example #23
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);
        }
Example #24
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();
        }
Example #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                btnLogin.CausesValidation = false;

                int    iStoreID = 0;
                string strID    = Request.QueryString["id"];
                if (strID == null)
                {
                    iStoreID = ApplicationSession.StoreID;
                }
                else
                {
                    bool isNumeric = int.TryParse(strID, out int iID);
                    if (isNumeric)
                    {
                        iStoreID = iID;
                    }
                }

                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.QRcode  = "";
                    btnLogin.CausesValidation  = true;
                }

                string sEmail = Request.QueryString["email"];
                //txtUserID.Text = (sEmail == null) ? txtUserID.Text = "" : txtUserID.Text = sEmail;
                //txtPassword.Text = "";
            }

            //lblMessage.Text = "";
        }
Example #26
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();
                        }
                    }
                }
            }
        }
Example #27
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;
        }
Example #28
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);
                }
            }
        }
Example #29
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);
        }
Example #30
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;
                    }
                }
            }
        }