コード例 #1
0
ファイル: CCategory2DAO.cs プロジェクト: Jusharra/RMS
        public RMS.Common.ObjectModel.CResult Cat2UpdateOrderUp(RMS.Common.ObjectModel.CCategory2 oCat, RMS.Common.ObjectModel.CCategory2 oCat2)
        {
            CResult oResult = new CResult();

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

                CCat2Rank oTempList = new CCat2Rank();

                CCat2Rank oTempList2 = new CCat2Rank();

                CResult oResult2 = GetOrderCandidateSingle(oCat);

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

                    oTempList = (CCat2Rank)oResult2.Data;
                }

                CResult oResult3 = GetOrderCandidateSingle(oCat2);

                if (oResult3.IsSuccess && oResult3.Data != null)
                {

                    oTempList2 = (CCat2Rank)oResult3.Data;
                }

                this.OpenConnectionWithTransection();

                //for (int i = 0; i < oTempList.Count; i++)
                //{
                //    CCat2Rank oTempCat2Rank = oTempList[i];

                List<CCat3Rank> oTempCat3List = oTempList.ChildCat3List;

                List<CCat4Rank> oTempCat4List = oTempList.ChildCat4List;

                if (oTempCat3List.Count > 0)
                {
                    UpdateChildCat3Rank(oTempCat3List, oCat2.Category2Order);
                }

                if (oTempCat4List.Count > 0)
                {
                    UpdateChildCat4Rank(oTempCat4List, oCat2.Category2Order);
                }

                // }

                //for (int i = 0; i < oTempList2.Count; i++)
                //{
                //CCat2Rank oTempCat2Rank = oTempList2[i];

                oTempCat3List = oTempList2.ChildCat3List;

                oTempCat4List = oTempList2.ChildCat4List;

                if (oTempCat3List.Count > 0)
                {
                    UpdateChildCat3Rank(oTempCat3List, oCat.Category2Order);
                }

                if (oTempCat4List.Count > 0)
                {
                    UpdateChildCat4Rank(oTempCat4List, oCat.Category2Order);
                }

                // }

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

                sSql = String.Format(SqlQueries.GetQuery(Query.UpdateCategory2Order), oCat2.Category2Order, oCat.Category2ID, RMSGlobal.LogInUserName, DateTime.Now.Ticks);
                this.ExecuteNonQuery(sSql);

                sSql = String.Format(SqlQueries.GetQuery(Query.UpdateCategory2Order), oCat.Category2Order, oCat2.Category2ID, 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;
        }
コード例 #2
0
ファイル: CCategory2DAO.cs プロジェクト: Jusharra/RMS
        private CResult GetOrderCandidateLower(CCategory2 oCat, int inCatOrder)
        {
            CResult oResult = new CResult();
            try
            {
                List<int> iTempList = new List<int>();

                List<CCat2Rank> oTempCat2List = new List<CCat2Rank>();

                if (oCat.Category2Order <= inCatOrder)
                {

                    oResult.Data = oTempCat2List;

                    oResult.IsSuccess = true;
                }
                else
                {

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

                                iTempList.Add(iTempInt);

                            }

                        }

                        oReader.Close();

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

                            CResult oResult2 = GetChildCat3(iTempCat2ID);

                            CCat2Rank oTempCat2Rank = new CCat2Rank();

                            oTempCat2Rank.Category2ID = iTempCat2ID;

                            if (oResult2.IsSuccess && oResult2.Data != null)
                            {
                                List<CCat3Rank> oTempChildList = (List<CCat3Rank>)oResult2.Data;

                                oTempCat2Rank.ChildCat3List = oTempChildList;

                            }

                            CResult oResult3 = GetChildCat4ByCat2(iTempCat2ID);

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

                                oTempCat2Rank.ChildCat4List = oTempChildList2;
                            }

                            oTempCat2List.Add(oTempCat2Rank);
                        }

                        oResult.Data = oTempCat2List;

                        oResult.IsSuccess = true;
                    }
                }

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

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

                List<CCat2Rank> oTempCat2List = new List<CCat2Rank>();

                this.OpenConnection();
                //string sSql = string.Format(SqlQueries.GetQuery(Query.GetCat2OrderCandidateLower), inCatOrder, oCat.Category2Order);
                // IDataReader oReader = this.ExecuteReader(sSql);

                //for (int i = 0; i < iTempList.Count; i++)
                //{
                int iTempCat2ID = oCat.Category2ID;

                CResult oResult2 = GetChildCat3(oCat.Category2ID);

                CCat2Rank oTempCat2Rank = new CCat2Rank();

                oTempCat2Rank.Category2ID = iTempCat2ID;

                if (oResult2.IsSuccess && oResult2.Data != null)
                {
                    List<CCat3Rank> oTempChildList = (List<CCat3Rank>)oResult2.Data;

                    oTempCat2Rank.ChildCat3List = oTempChildList;

                }

                CResult oResult3 = GetChildCat4ByCat2(oCat.Category2ID);

                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;
        }
コード例 #4
0
ファイル: CCategory2DAO.cs プロジェクト: Jusharra/RMS
        private CResult GetOrderCandidateSingle(CCategory2 oCat)
        {
            CResult oResult = new CResult();
            try
            {
                List<int> iTempList = new List<int>();

                List<CCat2Rank> oTempCat2List = new List<CCat2Rank>();

                this.OpenConnection();
                int iTempCat2ID = oCat.Category2ID;

                CResult oResult2 = GetChildCat3(oCat.Category2ID);

                CCat2Rank oTempCat2Rank = new CCat2Rank();

                oTempCat2Rank.Category2ID = iTempCat2ID;

                if (oResult2.IsSuccess && oResult2.Data != null)
                {
                    List<CCat3Rank> oTempChildList = (List<CCat3Rank>)oResult2.Data;
                    oTempCat2Rank.ChildCat3List = oTempChildList;
                }

                CResult oResult3 = GetChildCat4ByCat2(oCat.Category2ID);

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

                    oTempCat2Rank.ChildCat4List = oTempChildList2;
                }

                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;
        }