コード例 #1
0
ファイル: CCategory4DAO.cs プロジェクト: Jusharra/RMS
        public RMS.Common.ObjectModel.CResult GetCategory4(RMS.Common.ObjectModel.CCategory4 inCat)
        {
            CResult oResult = null;

            try
            {
                this.OpenConnection();
                string      sSql    = "";// string.Format(SqlQueries.GetQuery(Query), gItemId);
                IDataReader oReader = this.ExecuteReader(sSql);
                if (oReader != null)
                {
                    if (oReader.Read())
                    {
                        inCat = ReaderToCategory4(oReader);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in ItemGetById()", LogLevel.Error, "Database");

                oResult.IsException = true;
            }
            finally
            {
                this.CloseConnection();
            }
            return(oResult);
        }
コード例 #2
0
ファイル: CCategory4DAO.cs プロジェクト: Jusharra/RMS
        public CResult Cat4Delete(CCategory4 oCat)
        {
            CResult oResult = new CResult();

            try
            {
                this.OpenConnection();
                string sSql = string.Format(SqlQueries.GetQuery(Query.DeleteCategory4), oCat.Category4ID);
                this.ExecuteNonQuery(sSql);

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

                throw new Exception("Exception occure at ItemDelete()", ex);
            }
            finally
            {
                this.CloseConnection();
            }

            return oResult;
        }
コード例 #3
0
ファイル: CCategory4DAO.cs プロジェクト: Jusharra/RMS
        public RMS.Common.ObjectModel.CResult Cat4Delete(RMS.Common.ObjectModel.CCategory4 oCat)
        {
            CResult oResult = new CResult();

            try
            {
                this.OpenConnection();
                string sSql = string.Format(SqlQueries.GetQuery(Query.DeleteCategory4), oCat.Category4ID);
                this.ExecuteNonQuery(sSql);

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

                throw new Exception("Exception occure at ItemDelete()", ex);
            }
            finally
            {
                this.CloseConnection();
            }

            return(oResult);
        }
コード例 #4
0
ファイル: CCategory4DAO.cs プロジェクト: Jusharra/RMS
        public CResult AddCat4(CCategory4 inUser)
        {
            CResult oResult = new CResult();

            try
            {
                bool bTempFlag = CheckCat(inUser);

                if (bTempFlag)
                {
                    oResult.Message = "Category1 exists with this name.";
                }
                else
                {
                    bTempFlag = CheckCatOrder(inUser);

                    if (bTempFlag)
                    {
                        oResult.Message = "Category order exists. Write another order.";
                    }
                    else
                    {
                        this.OpenConnection();
                        string sSql = "";// String.Format(SqlQueries.GetQuery(Query.AddCategory1), inUser.Category1Name, inUser.Category1Order, inUser.ParentCatID);

                        this.ExecuteNonQuery(sSql);

                        oResult.IsSuccess = 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 oResult;
        }
コード例 #5
0
ファイル: CCategory4DAO.cs プロジェクト: Jusharra/RMS
        public RMS.Common.ObjectModel.CResult Cat4UpdateOrderUp(RMS.Common.ObjectModel.CCategory4 oCat, RMS.Common.ObjectModel.CCategory4 oCat2)
        {
            CResult oResult = new CResult();


            try
            {
                CCommonConstants oConstants = ConfigManager.GetConfig <CCommonConstants>();


                int iTempCat2Order = 0;

                int iTempCat3Order = 0;

                CResult oResult4 = GetCategory2Order(oCat.Category3ID);

                if (oResult4.IsSuccess && oResult4.Data != null)
                {
                    CCat4Rank oTempCat4Rank5 = (CCat4Rank)oResult4.Data;

                    iTempCat2Order = oTempCat4Rank5.Category2Order;

                    iTempCat3Order = oTempCat4Rank5.Category3Order;
                }
                else
                {
                    return(oResult);
                }

                this.OpenConnectionWithTransection();

                CCat4Rank oTempCat4Rank7 = new CCat4Rank();

                oTempCat4Rank7.Category4ID = oCat.Category4ID;

                oTempCat4Rank7.Category4Order = oCat2.Category4Order;

                UpdateCat4Rank(oTempCat4Rank7, iTempCat2Order, iTempCat3Order);


                CCat4Rank oTempCat4Rank6 = new CCat4Rank();

                oTempCat4Rank6.Category4ID = oCat2.Category4ID;

                oTempCat4Rank6.Category4Order = oCat.Category4Order;

                UpdateCat4Rank(oTempCat4Rank6, iTempCat2Order, iTempCat3Order);



                string sSql = String.Format(SqlQueries.GetQuery(Query.UpdateCategory4Order), oConstants.MaxOrderChange, oCat2.Category4ID, RMSGlobal.LogInUserName, DateTime.Now.Ticks);
                this.ExecuteNonQuery(sSql);

                sSql = String.Format(SqlQueries.GetQuery(Query.UpdateCategory4Order), oCat2.Category4Order, oCat.Category4ID, RMSGlobal.LogInUserName, DateTime.Now.Ticks);
                this.ExecuteNonQuery(sSql);

                sSql = String.Format(SqlQueries.GetQuery(Query.UpdateCategory4Order), oCat.Category4Order, oCat2.Category4ID, RMSGlobal.LogInUserName, DateTime.Now.Ticks);
                this.ExecuteNonQuery(sSql);

                oResult.IsSuccess = true;

                this.CommitTransection();
            }
            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in ItemDelete()", LogLevel.Error, "Database");

                //throw new Exception("Exception occure at ItemDelete()", ex);

                this.RollBackTransection();
            }
            finally
            {
                this.CloseConnection();
            }

            return(oResult);
        }
コード例 #6
0
ファイル: CCategory4DAO.cs プロジェクト: Jusharra/RMS
        public RMS.Common.ObjectModel.CResult Cat4Update(RMS.Common.ObjectModel.CCategory4 oCat, int inCatOrder)
        {
            CResult oResult = new CResult();

            try
            {
                bool bTempFlag = CheckCat4ForUpdate(oCat);

                if (bTempFlag)
                {
                    oResult.Message = "Category exists with this name.";
                }
                else
                {
                    int iTempCat2Order = 0;

                    int iTempCat3Order = 0;

                    CResult oResult4 = GetCategory2Order(oCat.Category3ID);

                    if (oResult4.IsSuccess && oResult4.Data != null)
                    {
                        CCat4Rank oTempCat4Rank5 = (CCat4Rank)oResult4.Data;

                        iTempCat2Order = oTempCat4Rank5.Category2Order;

                        iTempCat3Order = oTempCat4Rank5.Category3Order;
                    }
                    else
                    {
                        return(oResult);
                    }

                    List <int> oTempList = new List <int>();

                    List <int> oTempList2 = new List <int>();

                    CResult oResult2 = GetOrderCandidate(oCat);

                    if (oResult2.IsSuccess && oResult2.Data != null)
                    {
                        oTempList = (List <int>)oResult2.Data;
                    }

                    CResult oResult3 = GetOrderCandidateLower(oCat, inCatOrder);

                    if (oResult3.IsSuccess && oResult3.Data != null)
                    {
                        oTempList2 = (List <int>)oResult3.Data;
                    }

                    this.OpenConnectionWithTransection();

                    string sSql = "";

                    int iTempInt = 0;

                    int iTempInt2 = 0;

                    int iTempInt3 = 0;

                    int i = 0;

                    for (i = 0; i < oTempList.Count; i++)
                    {
                        iTempInt = oTempList[i];

                        if (iTempInt == oCat.Category4ID)
                        {
                            CCat4Rank oTempCat4Rank5 = new CCat4Rank();

                            oTempCat4Rank5.Category4ID = iTempInt;

                            oTempCat4Rank5.Category4Order = oCat.Category4Order;

                            UpdateCat4Rank(oTempCat4Rank5, iTempCat2Order, iTempCat3Order);
                        }
                        else
                        {
                            iTempInt2 = oCat.Category4Order + 1 + iTempInt3;

                            iTempInt3 = iTempInt3 + 1;

                            CCat4Rank oTempCat4Rank5 = new CCat4Rank();

                            oTempCat4Rank5.Category4ID = iTempInt;

                            oTempCat4Rank5.Category4Order = iTempInt2;

                            UpdateCat4Rank(oTempCat4Rank5, iTempCat2Order, iTempCat3Order);

                            sSql = String.Format(SqlQueries.GetQuery(Query.UpdateCategory4Order), iTempInt2, iTempInt);
                            this.ExecuteNonQuery(sSql);
                        }
                    }

                    oCat.Category4Name = oCat.Category4Name.Replace("''", "'");
                    oCat.Category4Name = oCat.Category4Name.Replace("'", "''");

                    oCat.Category4Description = oCat.Category4Description.Replace("''", "'");
                    oCat.Category4Description = oCat.Category4Description.Replace("'", "''");


                    sSql = string.Format(SqlQueries.GetQuery(Query.UpdateCategory4), oCat.Category4Name, oCat.Category3ID, oCat.Category4Description, oCat.Category4TablePrice, oCat.Category4TakeAwayPrice, oCat.Category4BarPrice, oCat.Category4OrderStatus, oCat.Category4Order, oCat.Category4ViewTable, oCat.Category4ViewBar, oCat.Category4ViewTakeAway, oCat.Category4ID, RMSGlobal.LogInUserName, DateTime.Now.Ticks, oCat.InitialItemQuantity, oCat.UnlimitStatus, oCat.vatIncluded, oCat.vatRate);
                    this.ExecuteNonQuery(sSql);

                    iTempInt3 = 1;

                    sSql = "";


                    for (i = 0; i < oTempList2.Count; i++)
                    {
                        iTempInt = oTempList2[i];

                        if (iTempInt == oCat.Category4ID)
                        {
                            CCat4Rank oTempCat4Rank5 = new CCat4Rank();

                            oTempCat4Rank5.Category4ID = iTempInt;

                            oTempCat4Rank5.Category4Order = oCat.Category4Order;

                            UpdateCat4Rank(oTempCat4Rank5, iTempCat2Order, iTempCat3Order);
                        }
                        else
                        {
                            iTempInt2 = inCatOrder + iTempInt3 - 1;

                            iTempInt3 = iTempInt3 + 1;

                            CCat4Rank oTempCat4Rank6 = new CCat4Rank();

                            oTempCat4Rank6.Category4ID = iTempInt;

                            oTempCat4Rank6.Category4Order = iTempInt2;

                            UpdateCat4Rank(oTempCat4Rank6, iTempCat2Order, iTempCat3Order);


                            sSql = String.Format(SqlQueries.GetQuery(Query.UpdateCategory4Order), iTempInt2, iTempInt);
                            this.ExecuteNonQuery(sSql);
                        }
                    }

                    this.CommitTransection();
                    oResult.IsSuccess = true;
                }

                //this.OpenConnection();
                //string sSql = string.Format(SqlQueries.GetQuery(Query.UpdateCategory4), oCat.Category4Name, oCat.Category3ID, oCat.Category4Description, oCat.Category4TablePrice, oCat.Category4TakeAwayPrice, oCat.Category4BarPrice, oCat.Category4OrderStatus, oCat.Category4Order, oCat.Category4ViewTable, oCat.Category4ViewBar, oCat.Category4ViewTakeAway, oCat.Rank, oCat.Category4ID);
                //this.ExecuteNonQuery(sSql);

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

                throw new Exception("Exception occure at ItemDelete()", ex);
            }
            finally
            {
                this.CloseConnection();
            }

            return(oResult);
        }
コード例 #7
0
ファイル: CCategory4DAO.cs プロジェクト: Jusharra/RMS
        public RMS.Common.ObjectModel.CResult AddCat4(RMS.Common.ObjectModel.CCategory4 inUser)
        {
            CResult oResult = new CResult();

            try
            {
                bool bTempFlag = CheckCat4(inUser);

                if (bTempFlag)
                {
                    oResult.Message = "Category4 exists with this name.";
                }
                else
                {
                    CResult oResult2 = GetMaxCatOrder();

                    if (oResult2.IsSuccess && oResult2.Data != null)
                    {
                        int iTempOrder = (int)oResult2.Data;

                        iTempOrder = iTempOrder + 1;

                        inUser.Category4Name = inUser.Category4Name.Replace("''", "'");
                        inUser.Category4Name = inUser.Category4Name.Replace("'", "''");

                        inUser.Category4Description = inUser.Category4Description.Replace("''", "'");
                        inUser.Category4Description = inUser.Category4Description.Replace("'", "''");


                        this.OpenConnection();
                        string sqlCommand = String.Format(SqlQueries.GetQuery(Query.AddCategory4), inUser.Category4Name, inUser.Category3ID, inUser.Category4Description, inUser.Category4TablePrice, inUser.Category4TakeAwayPrice, inUser.Category4BarPrice, inUser.Category4OrderStatus, iTempOrder, inUser.Category4ViewTable, inUser.Category4ViewBar, inUser.Category4ViewTakeAway, inUser.Rank, RMSGlobal.LogInUserName, DateTime.Now.Ticks, inUser.InitialItemQuantity, inUser.UnlimitStatus, inUser.vatIncluded, inUser.vatRate);

                        this.ExecuteNonQuery(sqlCommand);


                        #region "Added By Baruri"

                        Int32 category4_Order = 0;
                        Int32 category3_Order = 0;
                        Int32 category2_id    = 0;
                        Int32 category2_order = 0;



                        this.OpenConnection();
                        sqlCommand = "select cat4_order from category4 where cat4_id=(select max(cat4_id) from category4)";
                        IDataReader objcategory3ID = this.ExecuteReader(sqlCommand);
                        if (objcategory3ID != null)
                        {
                            if (objcategory3ID.Read())
                            {
                                category4_Order = Convert.ToInt32(objcategory3ID["cat4_order"]);
                            }
                        }

                        objcategory3ID.Close();

                        sqlCommand     = "select cat3_order,cat2_id from category3 where cat3_id=" + inUser.Category3ID;
                        objcategory3ID = this.ExecuteReader(sqlCommand);

                        if (objcategory3ID != null)
                        {
                            if (objcategory3ID.Read())
                            {
                                category3_Order = Convert.ToInt32(objcategory3ID["cat3_order"]);
                                category2_id    = Convert.ToInt32(objcategory3ID["cat2_id"]);
                            }
                        }


                        objcategory3ID.Close();

                        sqlCommand     = "select cat2_order from category2 where cat2_id=" + category2_id;
                        objcategory3ID = this.ExecuteReader(sqlCommand);

                        if (objcategory3ID != null)
                        {
                            if (objcategory3ID.Read())
                            {
                                category2_order = Convert.ToInt32(objcategory3ID["cat2_order"]);
                            }
                        }


                        CResult cresultCategoryRank = CalculateCat4Rank(category2_order, category3_Order, category4_Order);
                        Int64   cateRank            = Convert.ToInt64(cresultCategoryRank.Data);

                        objcategory3ID.Close();

                        sqlCommand = "update category4 set cat4_rank=" + cateRank + " where cat4_id=(select max(cat4_id) from category4)";
                        this.ExecuteNonQuery(sqlCommand);

                        this.CloseConnection();

                        #endregion


                        oResult.IsSuccess = 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(oResult);
        }
コード例 #8
0
ファイル: SelectionItemCtl.cs プロジェクト: Jusharra/RMS
        private void dgvSelectionItem_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }

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

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

                    string s = pnl.Name;

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

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

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

                        if (bTempBool)
                        {
                            CCategory4 objSelectItem = new CCategory4();

                            objSelectItem.Category4ID = selectItemCatId;
                            CCategoryManager oManager = new CCategoryManager();

                            CResult oResult = oManager.DeleteCat4(objSelectItem);

                            if (oResult.IsSuccess)
                            {
                                dgvSelectionItem.Rows.RemoveAt(e.RowIndex);
                            }
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
コード例 #9
0
        private void LoadExistingData()
        {
            CCategoryManager oManager = new CCategoryManager();

            CResult oResult = oManager.GetCategory4(m_selectionItemCategoryID);
            CCategory4 objSelectionOfItem = new CCategory4();

            if (oResult.IsSuccess && oResult.Data != null)
            {
                objSelectionOfItem = (CCategory4)oResult.Data;
                txtItemName.Text = objSelectionOfItem.Category4Name;
                txtOrder.Text = objSelectionOfItem.Category4Order.ToString();

                m_selectionItemOrder = objSelectionOfItem.Category4Order;

                txtDescription.Text = objSelectionOfItem.Category4Description;
                txtTablePrice.Text = objSelectionOfItem.Category4TablePrice.ToString("F02");
                txtTakeawayPrice.Text = objSelectionOfItem.Category4TakeAwayPrice.ToString("F02");
                txtBarPrice.Text = objSelectionOfItem.Category4BarPrice.ToString("F02");
                txtVateRate.Text = objSelectionOfItem.vatRate.ToString();
                chkVateIncluded.Checked = objSelectionOfItem.vatIncluded;

                if (objSelectionOfItem.UnlimitStatus >0)
                {
                    chkunlimited.Checked = true;
                    txtInitialQuantity.Clear();
                }
                else
                {
                    txtInitialQuantity.Text = objSelectionOfItem.InitialItemQuantity.ToString();
                }

                m_iRank = objSelectionOfItem.Rank;

                if (objSelectionOfItem.Category4ViewTable == 1)
                {
                    chkTable.Checked = true;
                }
                if (objSelectionOfItem.Category4ViewBar == 1)
                {
                    chkBar.Checked = true;
                }
                if (objSelectionOfItem.Category4ViewTakeAway == 1)
                {
                    chkTakeAway.Checked = true;
                }
            }

            oResult = oManager.GetCategoryAncestors(m_selectionItemCategoryID, 4);

            if (oResult.IsSuccess && oResult.Data != null)
            {
                CCategoryAncestor oCatAnc = (CCategoryAncestor)oResult.Data;

                int tmpCat4ID = oCatAnc.Category4ID;
                int tmpCat3ID = oCatAnc.Category3ID;
                int tmpCat2ID = oCatAnc.Category2ID;
                int tmpCat1ID = oCatAnc.Category1ID;
                int tmpParentCatID = oCatAnc.ParentCategoryID;

                CComboBoxItem oItem1 = new CComboBoxItem(1, "Active");

                CComboBoxItem oItem2 = new CComboBoxItem(0, "InActive");

                if (objSelectionOfItem.Category4OrderStatus == 1)
                {

                    rdoActive.Checked = true;

                }
                else if (objSelectionOfItem.Category4OrderStatus == 0)
                {
                    rdoInactive.Checked = true;

                }
                cmbParent.SelectedValue = tmpParentCatID;
                cmbFoodType.SelectedValue = tmpCat1ID;
                cmbCategory.SelectedValue = tmpCat2ID;
                cmbFoodItem.SelectedValue = tmpCat3ID;
            }
        }
コード例 #10
0
ファイル: CCategory4DAO.cs プロジェクト: Jusharra/RMS
        private bool CheckCatOrder(CCategory4 inUser)
        {
            CResult oResult = new CResult();

            try
            {
                this.OpenConnection();
                string sSql = "";// String.Format(SqlQueries.GetQuery(Query.CheckCat1Order), inUser.Category1Order, inUser.ParentCatID);

                IDataReader oReader = this.ExecuteReader(sSql);
                if (oReader != null)
                {
                    if (oReader.Read())
                    {
                        if (oReader["cat1_id"] != null)
                        {
                            int iTemp = Int32.Parse(oReader["cat1_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;
        }
コード例 #11
0
ファイル: CCategory4DAO.cs プロジェクト: Jusharra/RMS
        public CResult GetCategory4(CCategory4 inCat)
        {
            CResult oResult = null;
            try
            {
                //this.OpenConnection();
                //string sSql = string.Format(SqlQueries.GetQuery(Query.ItemGetById), gItemId);
                //IDataReader oReader = this.ExecuteReader(sSql);
                //if (oReader != null)
                //{
                //    if (oReader.Read())
                //        oItem = ReaderToCategory4(oReader);
                //}
            }
            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in ItemGetById()", LogLevel.Error, "Database");

                oResult.IsException = true;
            }
            finally
            {
                this.CloseConnection();
            }
            return oResult;
        }
コード例 #12
0
ファイル: CCategory4DAO.cs プロジェクト: Jusharra/RMS
        private CResult GetOrderCandidate(CCategory4 oCat)
        {
            CResult oResult = new CResult();
            try
            {
                List<int> iTempList = new List<int>();

                this.OpenConnection();
                string sSql = string.Format(SqlQueries.GetQuery(Query.GetCat4OrderCandidate), oCat.Category3ID, oCat.Category4Order);
                IDataReader oReader = this.ExecuteReader(sSql);
                if (oReader != null)
                {
                    while (oReader.Read())
                    {
                        if (oReader["cat4_id"] != null)
                        {
                            int iTempInt = Int32.Parse(oReader["cat4_id"].ToString());

                            iTempList.Add(iTempInt);

                        }

                    }

                    oResult.Data = iTempList;

                    oResult.IsSuccess = true;
                }

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

                oResult.IsException = true;
            }
            finally
            {
                this.CloseConnection();
            }
            return oResult;
        }
コード例 #13
0
ファイル: CCategory4DAO.cs プロジェクト: Jusharra/RMS
        private bool CheckCat4ForUpdate(CCategory4 inUser)
        {
            CResult oResult = new CResult();

            try
            {
                this.OpenConnection();
                string sSql = String.Format(SqlQueries.GetQuery(Query.CheckDupCat4ForUpdate), inUser.Category4Name, inUser.Category3ID, inUser.Category4ID);

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

                            return true;
                        }

                    }
                }

            }
            catch (Exception ex)
            {
                Logger.Write("Exception : " + ex + " in ItemInsert() in CUserInfoDAO class", LogLevel.Error, "Database");
            }
            finally
            {
                this.CloseConnection();
            }
            return false;
        }
コード例 #14
0
ファイル: CCategory4DAO.cs プロジェクト: Jusharra/RMS
        private CCategory4 ReaderToCategory4(IDataReader oReader)
        {
            CCategory4 objSelectionItem = new CCategory4();

            if (oReader["cat4_id"] != null)
                objSelectionItem.Category4ID = Int32.Parse(oReader["cat4_id"].ToString());

            if (oReader["cat4_name"] != null)
                objSelectionItem.Category4Name = oReader["cat4_name"].ToString();

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

            if (oReader["description"] != null)
                objSelectionItem.Category4Description = oReader["description"].ToString();

            if (oReader["table_price"] != null)
                objSelectionItem.Category4TablePrice = Double.Parse(oReader["table_price"].ToString());

            if (oReader["tw_price"] != null)
                objSelectionItem.Category4TakeAwayPrice = Double.Parse(oReader["tw_price"].ToString());

            if (oReader["bar_price"] != null)
                objSelectionItem.Category4BarPrice = Double.Parse(oReader["bar_price"].ToString());

            if (oReader["status"] != null)
                objSelectionItem.Category4OrderStatus = Int32.Parse(oReader["status"].ToString());

            if (oReader["cat4_order"] != null)
                objSelectionItem.Category4Order = Int32.Parse(oReader["cat4_order"].ToString());

            if (oReader["view_table"] != null)
                objSelectionItem.Category4ViewTable = Int32.Parse(oReader["view_table"].ToString());

            if (oReader["view_bar"] != null)
                objSelectionItem.Category4ViewBar = Int32.Parse(oReader["view_bar"].ToString());

            if (oReader["view_takeaway"] != null)
                objSelectionItem.Category4ViewTakeAway = Int32.Parse(oReader["view_takeaway"].ToString());

            if (oReader["slection_item_stock_quantity"] != null)
                objSelectionItem.InitialItemQuantity = Int32.Parse("0"+oReader["slection_item_stock_quantity"].ToString());

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

            //Vat
            if (oReader["vat_Rate"] != null)
                objSelectionItem.vatRate = Double.Parse(oReader["vat_Rate"].ToString());

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

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

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

            return objSelectionItem;
        }
コード例 #15
0
ファイル: SelectionItemCtl.cs プロジェクト: Jusharra/RMS
        private void btnDown_Click(object sender, EventArgs e)
        {
            try
            {
                    if (m_iSelectedIndex >= 0 && dgvSelectionItem.Rows.Count > m_iSelectedIndex)
                    {
                        int iTempInt = Int32.Parse(dgvSelectionItem.Rows[m_iSelectedIndex].Cells[0].Value.ToString());

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

                        CCategory4 oCat = new CCategory4();

                        oCat.Category4ID = iTempInt;

                        oCat.Category4Order = iTempInt3;

                        if ((m_iSelectedIndex + 1) > 0 && dgvSelectionItem.Rows.Count > (m_iSelectedIndex + 1))
                        {
                            int iTempInt2 = Int32.Parse(dgvSelectionItem.Rows[(m_iSelectedIndex + 1)].Cells[0].Value.ToString());

                            int iTempInt4 = Int32.Parse(dgvSelectionItem.Rows[(m_iSelectedIndex + 1)].Cells[2].Value.ToString());

                            int iTempIndex = m_iSelectedIndex + 1;
                            CCategory4 oCat2 = new CCategory4();

                            oCat2.Category4ID = iTempInt2;

                            oCat2.Category4Order = iTempInt4;

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

                                oCat.Category3ID = iTempInt10;

                                oCat2.Category3ID = iTempInt10;
                            }

                            CCategoryManager oCatManager = new CCategoryManager();

                            CResult oResult = oCatManager.UpdateCategory4Order(oCat, oCat2, false);

                            if (oResult.IsSuccess)
                            {

                                if (m_bGridFlag)
                                {
                                    Int32 foodItemID = Convert.ToInt32(cmbFoodItem.SelectedValue);
                                    FillSelectedItems(foodItemID);

                                    dgvSelectionItem.Rows[0].Selected = false;

                                    dgvSelectionItem.Rows[iTempIndex].Selected = true;

                                    m_iSelectedIndex = iTempIndex;

                                    if (m_iSelectedIndex > 12)
                                    {
                                        dgvSelectionItem.FirstDisplayedScrollingRowIndex = m_iSelectedIndex - 12;
                                    }
                                }
                                else
                                {

                                    Int32 foodItemID = Convert.ToInt32(cmbFoodItem.SelectedValue);
                                    FillSelectedItems(foodItemID);

                                    dgvSelectionItem.Rows[0].Selected = false;

                                    dgvSelectionItem.Rows[iTempIndex].Selected = true;

                                    m_iSelectedIndex = iTempIndex;

                                    if (m_iSelectedIndex > 12)
                                    {
                                        dgvSelectionItem.FirstDisplayedScrollingRowIndex = m_iSelectedIndex - 12;
                                    }

                                }

                            }
                        }
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message + "Error Occured. Please contact to your administrator.",
                    RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #16
0
ファイル: CCategoryManager.cs プロジェクト: Jusharra/RMS
        public CResult UpdateCategory4Order(CCategory4 inUser, CCategory4 inUser2, bool inUpFlag)
        {
            try
            {
                if (inUpFlag)
                {
                    //up

                    m_oResult = RMS.DataAccess.Database.Instance.Category4.Cat4UpdateOrderUp(inUser, inUser2);
                }
                else
                {

                    //down

                    m_oResult = RMS.DataAccess.Database.Instance.Category4.Cat4UpdateOrderDown(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;
        }
コード例 #17
0
ファイル: CCategoryManager.cs プロジェクト: Jusharra/RMS
        public CResult AddCategory4(CCategory4 inUser)
        {
            try
            {
                m_oResult = RMS.DataAccess.Database.Instance.Category4.AddCat4(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;
        }
コード例 #18
0
ファイル: CCategory4DAO.cs プロジェクト: Jusharra/RMS
        private CCategory4 ReaderToCategory4(IDataReader oReader)
        {
            CCategory4 oItem = new CCategory4();

            if (oReader["cat4_id"] != null)
                oItem.Category4ID = Int32.Parse(oReader["cat4_id"].ToString());

            if (oReader["cat4_name"] != null)
                oItem.Category4Name = oReader["cat4_name"].ToString();

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

            if (oReader["description"] != null)
                oItem.Category4Description = oReader["description"].ToString();

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

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

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

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

            if (oReader["cat4_order"] != null)
                oItem.Category4Order = Int32.Parse(oReader["cat4_order"].ToString());

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

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

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

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

            return oItem;
        }
コード例 #19
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            CResult oResult = ValidateForm();

            if (oResult.IsSuccess)
            {
                CCategory4 objSelectionofItem = new CCategory4();

                String tempName = txtItemName.Text;
                int tempCat4Order = int.Parse(txtOrder.Text);
                String tempDescription = txtDescription.Text;

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

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

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

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

                objSelectionofItem.Category4Name = tempName;

                objSelectionofItem.Category4Order = tempCat4Order;

                objSelectionofItem.Category4Description = tempDescription;

                objSelectionofItem.Category4ViewTable = tempViewTable;

                objSelectionofItem.Category4ViewBar = tempViewBar;

                objSelectionofItem.Category4ViewTakeAway = tempViewTW;

                objSelectionofItem.Category3ID = Int32.Parse(cmbFoodItem.SelectedValue.ToString());

                objSelectionofItem.Category4ID = m_selectionItemCategoryID;

                if (rdoActive.Checked)
                {
                    objSelectionofItem.Category4OrderStatus = 1;
                }
                else
                {
                objSelectionofItem.Category4OrderStatus =0;
                }

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

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

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

                CCategoryManager oManager = new CCategoryManager();

                CResult oResult2 = oManager.UpdateCategory4(objSelectionofItem, m_selectionItemOrder);

                if (oResult2.IsSuccess)
                {
                    lblSaveStatus.Text = "Item information is updated successfully. ";

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

                    lblSaveStatus.Visible = true;

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

                lblSaveStatus.Visible = true;
            }
        }
コード例 #20
0
ファイル: AddSelectionItemCtl.cs プロジェクト: Jusharra/RMS
        private void btnSave_Click(object sender, EventArgs e)
        {
            CResult oResult = ValidateForm();

            if (oResult.IsSuccess)
            {
                CCategory4 objSelectionOfItem = new CCategory4();

                objSelectionOfItem.Category4Name = txtItemName.Text.Trim();

                objSelectionOfItem.Category3ID = Int32.Parse(cmbFoodItem.SelectedValue.ToString());

                objSelectionOfItem.Category4Description = txtDesc.Text.Trim();

                if (rdoActive.Checked)
                {
                 objSelectionOfItem.Category4OrderStatus=1;
                }
                else
                {
                 objSelectionOfItem.Category4OrderStatus=0;
                }

                if (!txtTablePrice.Text.Trim().Equals(String.Empty))
                {

                    objSelectionOfItem.Category4TablePrice = Double.Parse(txtTablePrice.Text.Trim());

                }

                if (!txtTakeAwayPrice.Text.Trim().Equals(String.Empty))
                {

                    objSelectionOfItem.Category4TakeAwayPrice = Double.Parse(txtTakeAwayPrice.Text.Trim());

                }

                if (!txtBarPrice.Text.Trim().Equals(String.Empty))
                {

                    objSelectionOfItem.Category4BarPrice = Double.Parse(txtBarPrice.Text.Trim());

                }

                if (chkTable.Checked)
                {
                    objSelectionOfItem.Category4ViewTable = 1;
                }

                if (chkBar.Checked)
                {
                    objSelectionOfItem.Category4ViewBar = 1;
                }

                if (chkTakeAway.Checked)
                {
                    objSelectionOfItem.Category4ViewTakeAway = 1;
                }

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

                CCategoryManager oManager = new CCategoryManager();

                CResult oResult2 = oManager.AddCategory4(objSelectionOfItem);

                if (oResult2.IsSuccess)
                {
                    lblSaveStatus.Text = " The product has been saved successfully.";

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

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

                lblSaveStatus.Visible = true;
            }
        }