Ejemplo n.º 1
0
        public RMS.Common.ObjectModel.CResult GetCategory3(int inCat3ID)
        {
            CResult oResult = new CResult();

            try
            {
                this.OpenConnection();
                string      sSql    = string.Format(SqlQueries.GetQuery(Query.GetCategory3), inCat3ID);
                IDataReader oReader = this.ExecuteReader(sSql);
                if (oReader != null)
                {
                    if (oReader.Read())
                    {
                        CCategory3 oCat = ReaderToCategory3(oReader);

                        oResult.Data = oCat;

                        oResult.IsSuccess = true;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in ItemGetById()", LogLevel.Error, "Database");

                oResult.IsException = true;
            }
            finally
            {
                this.CloseConnection();
            }
            return(oResult);
        }
Ejemplo n.º 2
0
        private bool CheckCatOrder3ForUpdate(CCategory3 inUser)
        {
            CResult oResult = new CResult();

            try
            {
                this.OpenConnection();
                string sqlCommand = String.Format(SqlQueries.GetQuery(Query.CheckCat3OrderForUpdate), inUser.Category3Order, inUser.Category2ID, inUser.Category3ID);

                IDataReader oReader = this.ExecuteReader(sqlCommand);
                if (oReader != null)
                {
                    if (oReader.Read())
                    {
                        if (oReader["cat3_id"] != null)
                        {
                            int iTemp = Int32.Parse(oReader["cat3_id"].ToString());

                            return(true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in ItemInsert() in CUserInfoDAO class", LogLevel.Error, "Database");
            }
            finally
            {
                this.CloseConnection();
            }
            return(false);
        }
Ejemplo n.º 3
0
        private bool CheckCat3(CCategory3 inUser)
        {
            CResult oResult = new CResult();

            try
            {
                this.OpenConnection();
                string sSql = String.Format(SqlQueries.GetQuery(Query.CheckDupCat3), inUser.Category3Name, inUser.Category2ID);

                IDataReader oReader = this.ExecuteReader(sSql);
                if (oReader != null)
                {
                    if (oReader.Read())
                    {
                        if (oReader["cat3_id"] != null)
                        {
                            int iTemp = Int32.Parse(oReader["cat3_id"].ToString());

                            return(true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in ItemInsert() in CUserInfoDAO class", LogLevel.Error, "Database");

                //throw new Exception("Exception occure at ItemInsert()", ex);
            }
            finally
            {
                this.CloseConnection();
            }
            return(false);
        }
Ejemplo n.º 4
0
        public RMS.Common.ObjectModel.CResult GetCategory3All()
        {
            CResult oResult = new CResult();

            try
            {
                this.OpenConnection();
                string            sqlCommand = string.Format(SqlQueries.GetQuery(Query.GetCategory3All));
                IDataReader       oReader    = this.ExecuteReader(sqlCommand);
                List <CCategory3> oCat3List  = new List <CCategory3>();
                if (oReader != null)
                {
                    while (oReader.Read())
                    {
                        CCategory3 oCat = ReaderToCategory3(oReader);
                        oCat3List.Add(oCat);
                    }
                }

                oResult.Data      = oCat3List;
                oResult.IsSuccess = true;
            }
            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in ItemGetById()", LogLevel.Error, "Database");

                oResult.IsException = true;
            }
            finally
            {
                this.CloseConnection();
            }
            return(oResult);
        }
Ejemplo n.º 5
0
        public CResult UpdateCategory3Order(CCategory3 inUser, CCategory3 inUser2, bool inUpFlag)
        {
            try
            {
                if (inUpFlag)
                {
                    //up

                    m_oResult = RMS.DataAccess.Database.Instance.Category3.Cat3UpdateOrderUp(inUser, inUser2);
                }
                else
                {
                    //down

                    m_oResult = RMS.DataAccess.Database.Instance.Category3.Cat3UpdateOrderDown(inUser, inUser2);
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("Exception occuer at DeleteItem() : " + ex.Message);
                m_oResult.IsException = true;
                m_oResult.Action      = EERRORNAME.EXCEPTION_OCCURE;
                m_oResult.SetParams(ex.Message);
                m_oResult.Message = ex.Message;
                Logger.Write("Exception : " + ex + " in DeleteItem()", LogLevel.Error, "CItemManager");
            }
            return(m_oResult);
        }
Ejemplo n.º 6
0
        private void dgvFoodItem_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }

            try
            {
                if (e.ColumnIndex == 6)
                {
                    Int32 itemID = Convert.ToInt32("0" + dgvFoodItem.Rows[e.RowIndex].Cells[0].Value);

                    UpdateFoodItemCtl objUpdate = new UpdateFoodItemCtl(itemID);
                    objUpdate.Parent = this.ParentForm;
                    UserControlManager.UserControls.Push(this);
                    Panel pnl = (Panel)this.ParentForm.Controls["pnlContext"];

                    string s = pnl.Name;

                    objUpdate.ParentForm.Controls[s].Controls.Clear();
                    objUpdate.ParentForm.Controls[s].Controls.Add(objUpdate);
                }

                else if (e.ColumnIndex == 7)
                {
                    if (MessageBox.Show("Are you sure you want to delete the selected category?", RMSGlobal.MessageBoxTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        int itemID = 0;

                        bool bTempBool = Int32.TryParse(dgvFoodItem.Rows[e.RowIndex].Cells[0].Value.ToString(), out itemID);

                        if (bTempBool)
                        {
                            CCategory3 oCat = new CCategory3();

                            oCat.Category3ID = itemID;
                            CCategoryManager oManager = new CCategoryManager();

                            CResult oResult = oManager.DeleteCat3(oCat);

                            if (oResult.IsSuccess)
                            {
                                dgvFoodItem.Rows.RemoveAt(e.RowIndex);
                            }
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Ejemplo n.º 7
0
        private CResult GetOrderCandidateSingle(CCategory3 oCat)
        {
            CResult oResult = new CResult();

            try
            {
                List <int> iTempList = new List <int>();

                //CCat3Rank oTempCat2List = new CCat3Rank();


                this.OpenConnection();


                // CResult oResult2 = GetChildCat3(iTempCat2ID);

                CCat3Rank oTempCat2Rank = new CCat3Rank();

                oTempCat2Rank.Category3ID = oCat.Category3ID;

                CResult oResult3 = GetChildCat4ByCat3(oCat.Category3ID);

                if (oResult3.IsSuccess && oResult3.Data != null)
                {
                    List <CCat4Rank> oTempChildList2 = (List <CCat4Rank>)oResult3.Data;

                    oTempCat2Rank.ChildCat4List = oTempChildList2;
                }

                //oTempCat2List.Add(oTempCat2Rank);


                oResult.Data = oTempCat2Rank;

                oResult.IsSuccess = true;
            }
            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in ItemGetById()", LogLevel.Error, "Database");

                oResult.IsException = true;
            }
            finally
            {
                this.CloseConnection();
            }
            return(oResult);
        }
Ejemplo n.º 8
0
 public CResult DeleteCat3(CCategory3 inUser)
 {
     try
     {
         m_oResult = RMS.DataAccess.Database.Instance.Category3.Cat3Delete(inUser);
     }
     catch (Exception ex)
     {
         System.Console.WriteLine("Exception occuer at DeleteItem() : " + ex.Message);
         m_oResult.IsException = true;
         m_oResult.Action      = EERRORNAME.EXCEPTION_OCCURE;
         m_oResult.SetParams(ex.Message);
         m_oResult.Message = ex.Message;
         Logger.Write("Exception : " + ex + " in DeleteItem()", LogLevel.Error, "CItemManager");
     }
     return(m_oResult);
 }
Ejemplo n.º 9
0
        public void AddPurchaseStore(CCategory3 objFoodItem, string name)
        {
            try
            {
                this.OpenConnection();
                string sqlComm = String.Format(SqlQueries.GetQuery(Query.AddPurchaseStore), objFoodItem.Category3Name,
                                               objFoodItem.UoM, objFoodItem.Category3ID, name);

                this.ExecuteNonQuery(sqlComm);
            }
            catch (Exception)
            {
            }
            finally
            {
                this.CloseConnection();
            }
        }
Ejemplo n.º 10
0
        private CCategory3 ReaderToCategory3(IDataReader oReader)
        {
            CCategory3 oItem = new CCategory3();

            if (oReader["cat3_id"] != null)
            {
                oItem.Category3ID = Int32.Parse(oReader["cat3_id"].ToString());
            }

            if (oReader["cat3_name"] != null)
            {
                oItem.Category3Name = oReader["cat3_name"].ToString();
            }

            if (oReader["cat2_id"] != null)
            {
                oItem.Category2ID = Int32.Parse(oReader["cat2_id"].ToString());
            }

            if (oReader["description"] != null)
            {
                oItem.Category3Description = oReader["description"].ToString();
            }

            if (oReader["table_price"] != null)
            {
                oItem.Category3TablePrice = Double.Parse(oReader["table_price"].ToString());
            }

            if (oReader["tw_price"] != null)
            {
                oItem.Category3TakeAwayPrice = Double.Parse(oReader["tw_price"].ToString());
            }

            if (oReader["bar_price"] != null)
            {
                oItem.Category3BarPrice = Double.Parse(oReader["bar_price"].ToString());
            }

            if (oReader["status"] != null)
            {
                oItem.Category3OrderStatus = Int32.Parse(oReader["status"].ToString());
            }

            if (oReader["cat3_order"] != null)
            {
                oItem.Category3Order = Int32.Parse(oReader["cat3_order"].ToString());
            }

            if (oReader["view_table"] != null)
            {
                oItem.Category3ViewTable = Int32.Parse(oReader["view_table"].ToString());
            }

            if (oReader["view_bar"] != null)
            {
                oItem.Category3ViewBar = Int32.Parse(oReader["view_bar"].ToString());
            }

            if (oReader["view_takeaway"] != null)
            {
                oItem.Category3ViewTakeAway = Int32.Parse(oReader["view_takeaway"].ToString());
            }

            if (oReader["food_item_stock_quantity"] != null)
            {
                oItem.InitialItemQuantity = Int32.Parse("0" + oReader["food_item_stock_quantity"]);
            }

            if (oReader["unlimited_status"] != null)
            {
                oItem.UnlimitStatus = Convert.ToInt32(oReader["unlimited_status"]);
            }

            if (oReader["selling_in"] != null)
            {
                oItem.ItemSellingIn = Convert.ToString(oReader["selling_in"]);
            }
            //Vat
            if (oReader["vat_Rate"] != null)
            {
                oItem.vatRate = Double.Parse(oReader["vat_Rate"].ToString());
            }

            if (oReader["vat_included"] != null)
            {
                oItem.vatIncluded = Convert.ToBoolean(oReader["vat_included"].ToString());
            }

            try
            {
                if (oReader["productType"] != null)
                {
                    oItem.ProductType = oReader["productType"].ToString();
                }
            }
            catch { }
            //print_area

            try
            {
                if (oReader["print_area"] != null)
                {
                    oItem.PrintArea = oReader["print_area"].ToString();
                }
            }
            catch { }

            try
            {
                if (oReader["uom"] != null)
                {
                    oItem.UoM = oReader["uom"].ToString();
                }
            }
            catch { }

            if (oReader["cat3_rank"] != null)
            {
                String sTempStr = oReader["cat3_rank"].ToString();

                if (!sTempStr.Equals(String.Empty))
                {
                    oItem.Rank = Int64.Parse(sTempStr);
                }
            }

            try
            {
                oItem.TableCost = Convert.ToDouble(oReader["tablecost"]);
            }
            catch (Exception)
            {
            }
            try
            {
                oItem.TakeAwayCost = Convert.ToDouble(oReader["takeawaycost"]);
            }
            catch (Exception)
            {
            }
            try
            {
                oItem.BarCost = Convert.ToDouble(oReader["barcost"]);
            }
            catch (Exception)
            {
            }



            return(oItem);
        }
Ejemplo n.º 11
0
        private void btnUp_Click(object sender, EventArgs e)
        {
            try
            {
                if (m_selectedIndex > 0 && dgvFoodItem.Rows.Count > m_selectedIndex)
                {
                    int iTempInt = Int32.Parse(dgvFoodItem.Rows[m_selectedIndex].Cells[0].Value.ToString());

                    int iTempInt3 = Int32.Parse(dgvFoodItem.Rows[m_selectedIndex].Cells[2].Value.ToString());

                    CCategory3 oCat = new CCategory3();

                    oCat.Category3ID = iTempInt;

                    oCat.Category3Order = iTempInt3;

                    if ((m_selectedIndex - 1) >= 0 && dgvFoodItem.Rows.Count > (m_selectedIndex - 1))
                    {
                        int iTempInt2 = Int32.Parse(dgvFoodItem.Rows[(m_selectedIndex - 1)].Cells[0].Value.ToString());

                        int iTempInt4 = Int32.Parse(dgvFoodItem.Rows[(m_selectedIndex - 1)].Cells[2].Value.ToString());

                        int iTempIndex = m_selectedIndex - 1;

                        CCategory3 oCat2 = new CCategory3();

                        oCat2.Category3ID = iTempInt2;

                        oCat2.Category3Order = iTempInt4;

                        if (cmbCategory.SelectedValue != null)
                        {
                            int iTempInt10 = Int32.Parse(cmbCategory.SelectedValue.ToString());

                            oCat2.Category2ID = iTempInt10;

                            oCat.Category2ID = iTempInt10;
                        }

                        CCategoryManager oCatManager = new CCategoryManager();

                        CResult oResult = oCatManager.UpdateCategory3Order(oCat, oCat2, true);

                        if (oResult.IsSuccess)
                        {
                            if (m_bGridFlag)
                            {
                                Int32 categoryID = Convert.ToInt32(cmbCategory.SelectedValue);
                                FillFoodItem(categoryID);

                                dgvFoodItem.Rows[0].Selected = false;

                                dgvFoodItem.Rows[iTempIndex].Selected = true;

                                m_selectedIndex = iTempIndex;

                                if (m_selectedIndex > 12)
                                {
                                    dgvFoodItem.FirstDisplayedScrollingRowIndex = m_selectedIndex - 12;
                                }
                            }
                            else
                            {
                                Int32 categoryID = Convert.ToInt32(cmbCategory.SelectedValue);
                                FillFoodItem(categoryID);

                                dgvFoodItem.Rows[0].Selected = false;

                                dgvFoodItem.Rows[iTempIndex].Selected = true;

                                m_selectedIndex = iTempIndex;

                                if (m_selectedIndex > 12)
                                {
                                    dgvFoodItem.FirstDisplayedScrollingRowIndex = m_selectedIndex - 12;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message + "Error Occured. Please contact to your administrator.", RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Saving the food item.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            CResult objResult = ValidateForm();

            if (objResult.IsSuccess)
            {
                CCategory3 objFoodItem = new CCategory3();

                objFoodItem.Category2ID = Int32.Parse(cmbCategory.SelectedValue.ToString());

                objFoodItem.Category3Name = txtProductName.Text.Trim();

                objFoodItem.Category3Description = txtDescription.Text.Trim();
                objFoodItem.PrintArea            = printareacomboBox.Text;


                if (chkTable.Checked)
                {
                    objFoodItem.Category3ViewTable = 1;
                }

                if (chkBar.Checked)
                {
                    objFoodItem.Category3ViewBar = 1;
                }

                if (chkTakeAway.Checked)
                {
                    objFoodItem.Category3ViewTakeAway = 1;
                }

                if (!txtTablePrice.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.Category3TablePrice = Double.Parse(txtTablePrice.Text.Trim());
                }

                if (!txtTakeawayPrice.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.Category3TakeAwayPrice = Double.Parse(txtTakeawayPrice.Text.Trim());
                }

                if (!txtBarPrice.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.Category3BarPrice = Double.Parse(txtBarPrice.Text.Trim());
                }

                //Add by mithu

                if (!tblCost.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.TableCost = Double.Parse(tblCost.Text.Trim());
                }

                if (!takeawayCost.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.TakeAwayCost = Double.Parse(takeawayCost.Text.Trim());
                }


                if (!barCost.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.BarCost = Double.Parse(barCost.Text.Trim());
                }



                if (rdoActive.Checked)
                {
                    objFoodItem.Category3OrderStatus = 1;
                }
                else if (rdoInactive.Checked)
                {
                    objFoodItem.Category3OrderStatus = 0;
                }

                if (chkUnlimited.Checked)
                {
                    objFoodItem.InitialItemQuantity = 0;
                    objFoodItem.UnlimitStatus       = 1;
                }
                else
                {
                    objFoodItem.InitialItemQuantity = Convert.ToInt32("0" + txtInitialQuantity.Text);
                    objFoodItem.UnlimitStatus       = 0;
                }

                objFoodItem.ItemSellingIn = cmbSellingIn.Text; //Whether the item sold in quantity or weight

                try
                {
                    objFoodItem.vatRate = Convert.ToDouble(txtVateRate.Text.ToString());
                }
                catch
                {
                    objFoodItem.vatRate = 0.00;
                }

                if (chkVateIncluded.Checked)
                {
                    objFoodItem.vatIncluded = true;
                }
                else
                {
                    objFoodItem.vatIncluded = false;
                }

                objFoodItem.ProductType = ProductType;

                // if(ProductType=="")

                try
                {
                    objFoodItem.UoM = cmbSellingIn.Text;
                }
                catch { }
                CCategoryManager oManager = new CCategoryManager();

                CResult oResult2 = oManager.AddCategory3(objFoodItem);

                if (oResult2.IsSuccess)
                {
                    if (ProductType == "RawMaterial")
                    {
                        CCategory3DAO aCategory3Dao = new CCategory3DAO();
                        objFoodItem.Category3ID = Convert.ToInt32(categorycomboBox.SelectedValue);

                        aCategory3Dao.AddPurchaseStore(objFoodItem, categorycomboBox.Text);
                    }
                    lblSaveStatus.Text    = " The product has been saved successfully.";
                    lblSaveStatus.Visible = true;
                }
                else
                {
                    lblSaveStatus.Text    = "The product can not be added. Please try again. ";
                    lblSaveStatus.Visible = true;
                }
            }
            else
            {
                lblSaveStatus.Text = objResult.Message;

                lblSaveStatus.Visible = true;
            }
        }
Ejemplo n.º 13
0
        private void LoadExistingData()
        {
            CCategoryManager oManager = new CCategoryManager();

            CResult    oResult     = oManager.GetCategory3(m_foodItemID);
            CCategory3 objFoodItem = new CCategory3();

            if (oResult.IsSuccess && oResult.Data != null)
            {
                objFoodItem         = (CCategory3)oResult.Data;
                txtProductName.Text = objFoodItem.Category3Name;
                txtOrder.Text       = objFoodItem.Category3Order.ToString();

                m_iCat3Order = objFoodItem.Category3Order;

                txtDescription.Text   = objFoodItem.Category3Description;
                txtTablePrice.Text    = objFoodItem.Category3TablePrice.ToString("F02");
                txtTakeawayPrice.Text = objFoodItem.Category3TakeAwayPrice.ToString("F02");
                txtBarPrice.Text      = objFoodItem.Category3BarPrice.ToString("F02");
                cmbSellingIn.Text     = objFoodItem.ItemSellingIn;
                txtVateRate.Text      = objFoodItem.vatRate.ToString();
                selectarealabel.Text  = objFoodItem.PrintArea;

                tblCost.Text      = objFoodItem.TableCost.ToString("F02");
                takeawayCost.Text = objFoodItem.TakeAwayCost.ToString("F02");
                barCost.Text      = objFoodItem.BarCost.ToString("F02");

                try
                {
                    chkVateIncluded.Checked = objFoodItem.vatIncluded;
                }
                catch { }
                if (objFoodItem.UnlimitStatus == 1)
                {
                    txtInitialQuantity.Clear();
                    chkUnlimited.Checked = true;
                }
                else
                {
                    txtInitialQuantity.Text = objFoodItem.InitialItemQuantity.ToString();
                }

                m_iRank = objFoodItem.Rank;

                if (objFoodItem.Category3ViewTable == 1)
                {
                    chkTable.Checked = true;
                }
                if (objFoodItem.Category3ViewBar == 1)
                {
                    chkBar.Checked = true;
                }
                if (objFoodItem.Category3ViewTakeAway == 1)
                {
                    chkTakeAway.Checked = true;
                }
            }

            oResult = oManager.GetCategoryAncestors(m_foodItemID, 3);
            CCategoryAncestor oCatAnc = (CCategoryAncestor)oResult.Data;

            if (oResult.IsSuccess && oResult.Data != null)
            {
                int tmpCat3ID      = oCatAnc.Category3ID;
                int tmpCat2ID      = oCatAnc.Category2ID;
                int tmpCat1ID      = oCatAnc.Category1ID;
                int tmpParentCatID = oCatAnc.ParentCategoryID;


                if (objFoodItem.Category3OrderStatus == 1)
                {
                    m_activeStatus    = true;
                    rdoActive.Checked = true;
                }
                else if (objFoodItem.Category3OrderStatus == 0)
                {
                    rdoInActive.Checked = true;
                    m_activeStatus      = false;
                }

                cmbParent.SelectedValue   = tmpParentCatID;
                cmbFoodType.SelectedValue = tmpCat1ID;
                cmbCategory.SelectedValue = tmpCat2ID;
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Saving the food item.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            CResult objResult = ValidateForm();

            if (objResult.IsSuccess)
            {
                CCategory3 objFoodItem = new CCategory3();

                objFoodItem.Category2ID = Int32.Parse(cmbCategory.SelectedValue.ToString());

                objFoodItem.Category3Name = txtProductName.Text.Trim();

                objFoodItem.Category3Description = txtDescription.Text.Trim();


                if (chkTable.Checked)
                {
                    objFoodItem.Category3ViewTable = 1;
                }

                if (chkBar.Checked)
                {
                    objFoodItem.Category3ViewBar = 1;
                }

                if (chkTakeAway.Checked)
                {
                    objFoodItem.Category3ViewTakeAway = 1;
                }

                if (!txtTablePrice.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.Category3TablePrice = Double.Parse(txtTablePrice.Text.Trim());
                }

                if (!txtTakeawayPrice.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.Category3TakeAwayPrice = Double.Parse(txtTakeawayPrice.Text.Trim());
                }

                if (!txtBarPrice.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.Category3BarPrice = Double.Parse(txtBarPrice.Text.Trim());
                }

                if (rdoActive.Checked)
                {
                    objFoodItem.Category3OrderStatus = 1;
                }
                else if (rdoInactive.Checked)
                {
                    objFoodItem.Category3OrderStatus = 0;
                }

                if (chkUnlimited.Checked)
                {
                    objFoodItem.InitialItemQuantity = 0;
                    objFoodItem.UnlimitStatus       = 1;
                }
                else
                {
                    objFoodItem.InitialItemQuantity = Convert.ToInt32("0" + txtInitialQuantity.Text);
                    objFoodItem.UnlimitStatus       = 0;
                }

                objFoodItem.ItemSellingIn = cmbSellingIn.Text; //Whether the item sold in quantity or weight

                CCategoryManager oManager = new CCategoryManager();

                CResult oResult2 = oManager.AddCategory3(objFoodItem);

                if (oResult2.IsSuccess)
                {
                    lblSaveStatus.Text    = " The product has been saved successfully.";
                    lblSaveStatus.Visible = true;
                }
                else
                {
                    lblSaveStatus.Text    = "The product can not be added. Please try again. ";
                    lblSaveStatus.Visible = true;
                }
            }
            else
            {
                lblSaveStatus.Text = objResult.Message;

                lblSaveStatus.Visible = true;
            }
        }
Ejemplo n.º 15
0
        private CCategory3 ReaderToCategory3(IDataReader oReader)
        {
            CCategory3 oItem = new CCategory3();

            if (oReader["cat3_id"] != null)
            {
                oItem.Category3ID = Int32.Parse(oReader["cat3_id"].ToString());
            }

            if (oReader["cat3_name"] != null)
            {
                oItem.Category3Name = oReader["cat3_name"].ToString();
            }

            if (oReader["cat2_id"] != null)
            {
                oItem.Category2ID = Int32.Parse(oReader["cat2_id"].ToString());
            }

            if (oReader["description"] != null)
            {
                oItem.Category3Description = oReader["description"].ToString();
            }

            if (oReader["table_price"] != null)
            {
                oItem.Category3TablePrice = Double.Parse(oReader["table_price"].ToString());
            }

            if (oReader["tw_price"] != null)
            {
                oItem.Category3TakeAwayPrice = Double.Parse(oReader["tw_price"].ToString());
            }

            if (oReader["bar_price"] != null)
            {
                oItem.Category3BarPrice = Double.Parse(oReader["bar_price"].ToString());
            }

            if (oReader["status"] != null)
            {
                oItem.Category3OrderStatus = Int32.Parse(oReader["status"].ToString());
            }

            if (oReader["cat3_order"] != null)
            {
                oItem.Category3Order = Int32.Parse(oReader["cat3_order"].ToString());
            }

            if (oReader["view_table"] != null)
            {
                oItem.Category3ViewTable = Int32.Parse(oReader["view_table"].ToString());
            }

            if (oReader["view_bar"] != null)
            {
                oItem.Category3ViewBar = Int32.Parse(oReader["view_bar"].ToString());
            }

            if (oReader["view_takeaway"] != null)
            {
                oItem.Category3ViewTakeAway = Int32.Parse(oReader["view_takeaway"].ToString());
            }

            if (oReader["food_item_stock_quantity"] != null)
            {
                oItem.InitialItemQuantity = Int32.Parse("0" + oReader["food_item_stock_quantity"]);
            }

            if (oReader["unlimited_status"] != null)
            {
                oItem.UnlimitStatus = Convert.ToInt32(oReader["unlimited_status"]);
            }

            if (oReader["selling_in"] != null)
            {
                oItem.ItemSellingIn = Convert.ToString(oReader["selling_in"]);
            }


            if (oReader["cat3_rank"] != null)
            {
                String sTempStr = oReader["cat3_rank"].ToString();

                if (!sTempStr.Equals(String.Empty))
                {
                    oItem.Rank = Int64.Parse(sTempStr);
                }
            }

            return(oItem);
        }
Ejemplo n.º 16
0
        private CCategory3 ReaderToCategory3(IDataReader oReader)
        {
            CCategory3 oItem = new CCategory3();

            if (oReader["cat3_id"] != null)
            {
                oItem.Category3ID = Int32.Parse(oReader["cat3_id"].ToString());
            }

            if (oReader["cat3_name"] != null)
            {
                oItem.Category3Name = oReader["cat3_name"].ToString();
            }

            if (oReader["cat2_id"] != null)
            {
                oItem.Category2ID = Int32.Parse(oReader["cat2_id"].ToString());
            }

            if (oReader["description"] != null)
            {
                oItem.Category3Description = oReader["description"].ToString();
            }

            if (oReader["table_price"] != null)
            {
                oItem.Category3TablePrice = Double.Parse(oReader["table_price"].ToString());
            }

            if (oReader["tw_price"] != null)
            {
                oItem.Category3TakeAwayPrice = Double.Parse(oReader["tw_price"].ToString());
            }

            if (oReader["bar_price"] != null)
            {
                oItem.Category3BarPrice = Double.Parse(oReader["bar_price"].ToString());
            }

            if (oReader["status"] != null)
            {
                oItem.Category3OrderStatus = Int32.Parse(oReader["status"].ToString());
            }

            if (oReader["cat3_order"] != null)
            {
                oItem.Category3Order = Int32.Parse(oReader["cat3_order"].ToString());
            }

            if (oReader["view_table"] != null)
            {
                oItem.Category3ViewTable = Int32.Parse(oReader["view_table"].ToString());
            }

            if (oReader["view_bar"] != null)
            {
                oItem.Category3ViewBar = Int32.Parse(oReader["view_bar"].ToString());
            }

            if (oReader["view_takeaway"] != null)
            {
                oItem.Category3ViewTakeAway = Int32.Parse(oReader["view_takeaway"].ToString());
            }

            //if (oReader["cat3_rank"] != null)
            //    oItem.Rank = Int64.Parse(oReader["cat3_rank"].ToString());

            if (oReader["cat3_rank"] != null)
            {
                String sTempStr = oReader["cat3_rank"].ToString();

                if (!sTempStr.Equals(String.Empty))
                {
                    oItem.Rank = Int64.Parse(sTempStr);
                }
            }

            return(oItem);
        }
Ejemplo n.º 17
0
        private CResult GetOrderCandidateLower(CCategory3 oCat, int inCatOrder)
        {
            CResult oResult = new CResult();

            try
            {
                List <int> iTempList = new List <int>();

                List <CCat3Rank> oTempCat3List = new List <CCat3Rank>();

                if (oCat.Category3Order <= inCatOrder)
                {
                    oResult.Data = oTempCat3List;

                    oResult.IsSuccess = true;
                }
                else
                {
                    this.OpenConnection();
                    string      sqlCommand = string.Format(SqlQueries.GetQuery(Query.GetCat3OrderCandidateLower), oCat.Category2ID, inCatOrder, oCat.Category3Order);
                    IDataReader oReader    = this.ExecuteReader(sqlCommand);
                    if (oReader != null)
                    {
                        while (oReader.Read())
                        {
                            if (oReader["cat3_id"] != null)
                            {
                                int iTempInt = Int32.Parse(oReader["cat3_id"].ToString());

                                iTempList.Add(iTempInt);
                            }
                        }

                        oReader.Close();

                        for (int counter = 0; counter < iTempList.Count; counter++)
                        {
                            int iTempCat2ID = iTempList[counter];

                            CCat3Rank oTempCat2Rank = new CCat3Rank();

                            oTempCat2Rank.Category3ID = iTempCat2ID;

                            CResult oResult3 = GetChildCat4ByCat3(iTempCat2ID);

                            if (oResult3.IsSuccess && oResult3.Data != null)
                            {
                                List <CCat4Rank> oTempChildList2 = (List <CCat4Rank>)oResult3.Data;

                                oTempCat2Rank.ChildCat4List = oTempChildList2;
                            }

                            oTempCat3List.Add(oTempCat2Rank);
                        }

                        oResult.Data = oTempCat3List;

                        oResult.IsSuccess = true;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in ItemGetById()", LogLevel.Error, "Database");

                oResult.IsException = true;
            }
            finally
            {
                this.CloseConnection();
            }
            return(oResult);
        }
Ejemplo n.º 18
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            CResult oResult = ValidateForm();

            if (oResult.IsSuccess)
            {
                CCategory3 objFoodItem     = new CCategory3();
                String     tempName        = txtProductName.Text;
                int        tempCat3Order   = int.Parse(txtOrder.Text);
                String     tempDescription = txtDescription.Text;
                objFoodItem.PrintArea = printareacomboBox.Text;

                if (!txtTablePrice.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.Category3TablePrice = Double.Parse(txtTablePrice.Text.Trim());
                }

                if (!txtBarPrice.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.Category3BarPrice = Double.Parse(txtBarPrice.Text.Trim());
                }

                if (!txtTakeawayPrice.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.Category3TakeAwayPrice = Double.Parse(txtTakeawayPrice.Text.Trim());
                }


                if (!tblCost.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.TableCost = Double.Parse(tblCost.Text.Trim());
                }

                if (!takeawayCost.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.TakeAwayCost = Double.Parse(takeawayCost.Text.Trim());
                }


                if (!barCost.Text.Trim().Equals(String.Empty))
                {
                    objFoodItem.BarCost = Double.Parse(barCost.Text.Trim());
                }



                int tempViewTable = chkTable.Checked == true ? 1 : 0;
                int tempViewBar   = chkBar.Checked == true ? 1 : 0;
                int tempViewTW    = chkTakeAway.Checked == true ? 1 : 0;


                objFoodItem.Category3Name = tempName;

                objFoodItem.Category3Order = tempCat3Order;

                objFoodItem.Category3Description = tempDescription;

                objFoodItem.Category3ViewTable = tempViewTable;

                objFoodItem.Category3ViewBar = tempViewBar;

                objFoodItem.Category3ViewTakeAway = tempViewTW;

                objFoodItem.Category3ID = m_foodItemID;

                if (chkUnlimited.Checked)
                {
                    objFoodItem.InitialItemQuantity = 0;
                    objFoodItem.UnlimitStatus       = 1;
                }
                else
                {
                    objFoodItem.InitialItemQuantity = Convert.ToInt32("0" + txtInitialQuantity.Text);
                    objFoodItem.UnlimitStatus       = 0;
                }
                objFoodItem.ItemSellingIn = cmbSellingIn.Text;

                objFoodItem.Category2ID = Int32.Parse(cmbCategory.SelectedValue.ToString());

                if (m_activeStatus == true)
                {
                    objFoodItem.Category3OrderStatus = 1;
                }
                else if (m_activeStatus)
                {
                    objFoodItem.Category3OrderStatus = 0;
                }

                //Vat included or not and amount of vat
                try
                {
                    objFoodItem.vatRate = Convert.ToDouble(txtVateRate.Text.ToString());
                }
                catch
                {
                    objFoodItem.vatRate = 0.00;
                }

                if (chkVateIncluded.Checked)
                {
                    objFoodItem.vatIncluded = true;
                }
                else
                {
                    objFoodItem.vatIncluded = false;
                }



                CCategoryManager oManager = new CCategoryManager();

                CResult oResult2 = oManager.UpdateCategory3(objFoodItem, m_iCat3Order);

                if (oResult2.IsSuccess)
                {
                    lblSaveStatus.Text = "Food item has been updated successfully. ";

                    lblSaveStatus.Visible = true;
                }
                else
                {
                    lblSaveStatus.Text = oResult2.Message;

                    lblSaveStatus.Visible = true;
                }
            }
            else
            {
                lblSaveStatus.Text = oResult.Message;

                lblSaveStatus.Visible = true;
            }
        }