コード例 #1
0
ファイル: SoMgr.cs プロジェクト: windygu/ERP-1
        public List <So> BuyerGetSoAccordingToFilter(int userId, bool includedSubs, string filterColumn, string filterString, List <int> states)

        {
            List <So> soList = new List <So>();

            if (states.Count == 0)
            {
                return(soList);
            }

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

            if (includedSubs)
            {
                AmbleAppServer.AccountMgr.AccountMgr accountMgr = new AccountMgr.AccountMgr();
                buyersIds.AddRange(accountMgr.GetAllSubsId(userId));
            }
            else
            {
                buyersIds.Add(userId);
            }

            StringBuilder sb = new StringBuilder();

            sb.Append(string.Format("select soId from So s,rfq r where(s.rfqId=r.rfqNo) and ( (r.firstPA={0} or r.secondPa={0})", buyersIds[0]));
            for (int i = 1; i < buyersIds.Count; i++)
            {
                sb.Append(string.Format(" or (firstPA={0} or secondPA={0}) ", buyersIds[i]));
            }
            sb.Append(" ) ");

            //append the filter
            if ((!string.IsNullOrWhiteSpace(filterColumn)) && (!string.IsNullOrWhiteSpace(filterString)))
            {
                sb.Append(string.Format(" and {0} like '%{1}%' ", filterColumn, filterString));
            }

            sb.Append(" and (soStates=" + states[0]);
            for (int i = 1; i < states.Count; i++)
            {
                sb.Append(" or soStates=" + states[i]);
            }
            sb.Append(" )");

            DataTable dt = db.GetDataTable(sb.ToString(), "soId");

            foreach (DataRow dr in dt.Rows)
            {
                soList.Add(GetSoAccordingToSoId(Convert.ToInt32(dr["soId"])));
            }
            return(soList);
        }
コード例 #2
0
ファイル: RfqMgr.cs プロジェクト: hongbao66/ERP
 public bool AddRfqHistory(int rfqId,int who, string action)
 {
     string strSql = "select routingHistory from rfq where rfqNo=" + rfqId;
        string history = db.GetSingleObject(strSql).ToString();
        AccountMgr.AccountMgr accountMgr=new AccountMgr.AccountMgr();
        history = DateTime.Now.ToString() + ": " + accountMgr.GetNameById(who) + " " + action+System.Environment.NewLine+history;
        strSql = string.Format("update rfq set routingHistory='{0}'", history);
        int row = db.ExecDataBySql(strSql);
        if (row == 1)
        return true;
        else
        return false;
 }
コード例 #3
0
        //for sales manager
        public int GetThePageCountOfDataTable(int itemsPerPage, int salesId, string filterColumn, string filterString, List <RfqStatesEnum> selections)
        {
            int count = 0;

            //get the subs IDs include himself
            AmbleAppServer.AccountMgr.AccountMgr accountMgr = new AccountMgr.AccountMgr();

            List <int> subIds = accountMgr.GetAllSubsId(salesId);

            foreach (int id in subIds)
            {
                count += GetThePageCountOfDataTablePerSale(itemsPerPage, id, filterColumn, filterString, selections);
            }
            return(count);
        }
コード例 #4
0
ファイル: SoMgr.cs プロジェクト: hongbao66/ERP
        public List<So> BuyerGetSoAccordingToFilter(int userId, bool includedSubs, string filterColumn, string filterString, List<int> states)
        {
            List<So> soList = new List<So>();

               if (states.Count == 0) return soList;

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

               if (includedSubs)
               {
               AmbleAppServer.AccountMgr.AccountMgr accountMgr = new AccountMgr.AccountMgr();
               buyersIds.AddRange(accountMgr.GetAllSubsId(userId));
               }
               else
               {
               buyersIds.Add(userId);
               }

               StringBuilder sb = new StringBuilder();
               sb.Append(string .Format("select soId from So s,rfq r where(s.rfqId=r.rfqNo) and ( (r.firstPA={0} or r.secondPa={0})",buyersIds[0]));
               for (int i = 1; i < buyersIds.Count; i++)
               {
               sb.Append(string.Format(" or (firstPA={0} or secondPA={0}) ",buyersIds[i]));
               }
               sb.Append(" ) ");

               //append the filter
               if ((!string.IsNullOrWhiteSpace(filterColumn)) && (!string.IsNullOrWhiteSpace(filterString)))
               {
               sb.Append(string.Format(" and {0} like '%{1}%' ", filterColumn, filterString));
               }

               sb.Append(" and (soStates=" + states[0]);
               for (int i = 1; i < states.Count; i++)
               {
               sb.Append(" or soStates=" + states[i]);

               }
               sb.Append(" )");

               DataTable dt = db.GetDataTable(sb.ToString(), "soId");

               foreach (DataRow dr in dt.Rows)
               {
               soList.Add(GetSoAccordingToSoId(Convert.ToInt32(dr["soId"])));
               }
               return soList;
        }
コード例 #5
0
        public bool AddRfqHistory(int rfqId, int who, string action)
        {
            string strSql  = "select routingHistory from rfq where rfqNo=" + rfqId;
            string history = db.GetSingleObject(strSql).ToString();

            AccountMgr.AccountMgr accountMgr = new AccountMgr.AccountMgr();
            history = DateTime.Now.ToString() + ": " + accountMgr.GetNameById(who) + " " + action + System.Environment.NewLine + history;
            strSql  = string.Format("update rfq set routingHistory='{0}'", history);
            int row = db.ExecDataBySql(strSql);

            if (row == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #6
0
        //for sale and salesManager
        public DataTable GetICanSeeRfqDataTableAccordingToPageNumber(int salesId, int pageNumber, int itemsPerPage, string filterColumn, string filterString, List <RfqStatesEnum> selections)
        {
            if (selections.Count == 0)
            {
                return(null);
            }

            AmbleAppServer.AccountMgr.AccountMgr accountMgr = new AccountMgr.AccountMgr();

            List <int> subIds = accountMgr.GetAllSubsId(salesId);

            StringBuilder sb = new StringBuilder();

            if ((!string.IsNullOrEmpty(filterColumn)) && (!(string.IsNullOrEmpty(filterString))))
            {
                sb.Append(string.Format("select * from rfq where {0} like '%{1}%' and ( salesId={2}", filterColumn, filterString, subIds[0]));
            }
            else
            {
                sb.Append("select * from rfq where ( salesId=" + subIds[0]);
            }

            if (subIds.Count() > 1)
            {
                for (int i = 1; i < subIds.Count(); i++)
                {
                    sb.Append(" or salesId=" + subIds[i]);
                }
            }
            sb.Append(" )");
            sb.Append(" and (rfqstates=" + selections[0].GetHashCode());
            for (int i = 1; i < selections.Count; i++)
            {
                sb.Append(" or rfqstates=" + selections[i].GetHashCode());
            }

            sb.Append(string.Format(")  limit {0},{1}", pageNumber * itemsPerPage, itemsPerPage));

            return(db.GetDataTable(sb.ToString(), "Table" + pageNumber));
        }
コード例 #7
0
ファイル: CustomerVendorMgr.cs プロジェクト: windygu/ERP-1
        public DataTable GetTheCustomersOrVendorsICanSee(int cvtype, int id)
        {
            //get the subs IDs include himself
            AmbleAppServer.AccountMgr.AccountMgr accountMgr = new AccountMgr.AccountMgr();

            List <int>    subIds   = accountMgr.GetAllSubsId(id);
            List <string> sqlCodes = new List <string>();


            DataTable theCustomerOrVendorICanSee = new DataTable();

            foreach (int subId in subIds)
            {
                string strSql = "select * from custVendor where cvtype=" + cvtype + " and ownerName=" + subId;

                sqlCodes.Add(strSql);
            }

            //get the whole datatable

            return(db.GetDataTable(sqlCodes, "custVendor"));
        }
コード例 #8
0
ファイル: RfqMgr.cs プロジェクト: hongbao66/ERP
        //for sales manager
        public int GetThePageCountOfDataTable(int itemsPerPage, int salesId, string filterColumn, string filterString, List<RfqStatesEnum> selections)
        {
            int count=0;
                     //get the subs IDs include himself
               AmbleAppServer.AccountMgr.AccountMgr accountMgr = new AccountMgr.AccountMgr();

               List<int> subIds = accountMgr.GetAllSubsId(salesId);

               foreach (int id in subIds)
               {
               count += GetThePageCountOfDataTablePerSale(itemsPerPage, id, filterColumn,filterString,selections);
               }
               return count;
        }
コード例 #9
0
ファイル: RfqMgr.cs プロジェクト: hongbao66/ERP
        //for sale and salesManager
        public DataTable GetICanSeeRfqDataTableAccordingToPageNumber(int salesId, int pageNumber, int itemsPerPage, string filterColumn, string filterString, List<RfqStatesEnum> selections)
        {
            if (selections.Count == 0)
                return null;

            AmbleAppServer.AccountMgr.AccountMgr accountMgr = new AccountMgr.AccountMgr();

            List<int> subIds = accountMgr.GetAllSubsId(salesId);

            StringBuilder sb = new StringBuilder();

            if ((!string.IsNullOrEmpty(filterColumn)) && (!(string.IsNullOrEmpty(filterString))))
            {
                sb.Append(string.Format("select * from rfq where {0} like '%{1}%' and ( salesId={2}",filterColumn,filterString,subIds[0]));
            }
            else
            {
                sb.Append("select * from rfq where ( salesId=" + subIds[0]);
            }

            if (subIds.Count() > 1)
            {
                for (int i = 1; i < subIds.Count(); i++)
                    sb.Append(" or salesId=" + subIds[i]);
             }
            sb.Append(" )");
            sb.Append(" and (rfqstates=" + selections[0].GetHashCode());
            for (int i = 1; i < selections.Count; i++)
            {
                sb.Append(" or rfqstates=" + selections[i].GetHashCode());
            }

            sb.Append(string.Format(")  limit {0},{1}", pageNumber*itemsPerPage, itemsPerPage));

            return db.GetDataTable(sb.ToString(), "Table" + pageNumber);
        }
コード例 #10
0
ファイル: CustomerVendorMgr.cs プロジェクト: hongbao66/ERP
        public DataTable GetTheCustomersOrVendorsICanSee(int cvtype,int id)
        {
            //get the subs IDs include himself
               AmbleAppServer.AccountMgr.AccountMgr accountMgr = new AccountMgr.AccountMgr();

               List<int> subIds = accountMgr.GetAllSubsId(id);
               List<string> sqlCodes = new List<string>();

               DataTable theCustomerOrVendorICanSee = new DataTable();

               foreach (int subId in subIds)
               {
             string  strSql = "select * from custVendor where cvtype=" + cvtype + " and ownerName=" + subId;

             sqlCodes.Add(strSql);
               }

            //get the whole datatable

               return db.GetDataTable(sqlCodes, "custVendor");
        }