示例#1
0
        public int SaveChances(List <ChanceClass> list, string strDataOwner)
        {
            DbChanceList ret = new DbChanceList();
            DbClass      db  = GlobalClass.getCurrDb();
            string       sql = string.Format("select top 0 * from {0}", strChanceTable);
            DataTable    dt  = db.getTableBySqlAndList <ChanceClass>(sql, list);

            if (dt == null)
            {
                ToLog("保存机会数据错误", "根据数据表结构和提供的列表返回的机会列表错误!");
                return(-1);
            }
            if (strDataOwner == null || strDataOwner.Trim().Length == 0)
            {
                sql = string.Format("Select * from {0} where IsEnd=0", strChanceTable);
            }
            else
            {
                sql = string.Format("Select * from {0} where IsEnd=0 and UserId='{1}'", strChanceTable, strDataOwner);
            }
            return(db.UpdateOrNewList(sql, dt));
        }
示例#2
0
        public DbChanceList getNoCloseChances(string strDataOwner)
        {
            DbChanceList ret = new DbChanceList();
            DbClass      db  = GlobalClass.getCurrDb();
            string       sql = null;

            if (strDataOwner == null || strDataOwner.Trim().Length == 0)
            {
                sql = string.Format("Select * from {0} where IsEnd=0", strChanceTable);
            }
            else
            {
                sql = string.Format("Select * from {0} where IsEnd=0 and UserId='{1}'", strChanceTable, strDataOwner);
            }
            DataSet ds = db.Query(sql);

            if (ds == null)
            {
                return(null);
            }
            //ToLog("数据库结果",string.Format("未关闭机会数量为{0}",ds.Tables[0].Rows.Count));
            ret = new DbChanceList(ds.Tables[0]);
            return(ret);
        }