示例#1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Maticsoft.Model.CustomServices model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into CustomServices(");
            strSql.Append("STID,CusID,CSTitle,CSState,CSDesc,CSCreateID,CSDueID,CSDueDate,CSDeal,CSDealDate,CSResult,CSSatisfy)");
            strSql.Append(" values (");
            strSql.Append("@STID,@CusID,@CSTitle,@CSState,@CSDesc,@CSCreateID,@CSDueID,@CSDueDate,@CSDeal,@CSDealDate,@CSResult,@CSSatisfy)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@STID",       SqlDbType.Int,         4),
                new SqlParameter("@CusID",      SqlDbType.Char,       14),
                new SqlParameter("@CSTitle",    SqlDbType.NVarChar,  100),
                new SqlParameter("@CSState",    SqlDbType.Int,         4),
                new SqlParameter("@CSDesc",     SqlDbType.NVarChar,   -1),
                new SqlParameter("@CSCreateID", SqlDbType.Int,         4),

                new SqlParameter("@CSDueID",    SqlDbType.Int,         4),
                new SqlParameter("@CSDueDate",  SqlDbType.DateTime),
                new SqlParameter("@CSDeal",     SqlDbType.NVarChar,  500),
                new SqlParameter("@CSDealDate", SqlDbType.DateTime),
                new SqlParameter("@CSResult",   SqlDbType.NVarChar,  500),
                new SqlParameter("@CSSatisfy",  SqlDbType.Int, 4)
            };
            parameters[0].Value = model.STID;
            parameters[1].Value = model.CusID;
            parameters[2].Value = model.CSTitle;
            parameters[3].Value = model.CSState;
            parameters[4].Value = model.CSDesc;
            parameters[5].Value = model.CSCreateID;

            parameters[6].Value  = model.CSDueID;
            parameters[7].Value  = model.CSDueDate;
            parameters[8].Value  = model.CSDeal;
            parameters[9].Value  = model.CSDealDate;
            parameters[10].Value = model.CSResult;
            parameters[11].Value = model.CSSatisfy;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
示例#2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.CustomServices GetModel(int CSID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 CSID,STID,CusID,CSTitle,CSState,CSDesc,CSCreateID,CSCreateDate,CSDueID,CSDueDate,CSDeal,CSDealDate,CSResult,CSSatisfy from CustomServices ");
            strSql.Append(" where CSID=@CSID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CSID", SqlDbType.Int, 4)
            };
            parameters[0].Value = CSID;

            Maticsoft.Model.CustomServices model = new Maticsoft.Model.CustomServices();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
示例#3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool UpdateFoure(Maticsoft.Model.CustomServices model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update CustomServices set ");

            strSql.Append("CSState=4,");
            strSql.Append("CSResult=@CSResult,");
            strSql.Append("CSSatisfy=@CSSatisfy");

            strSql.Append(" where CSID=@CSID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CSState",   SqlDbType.Int,        4),
                new SqlParameter("@CSResult",  SqlDbType.NVarChar, 500),
                new SqlParameter("@CSSatisfy", SqlDbType.Int,        4),

                new SqlParameter("@CSID",      SqlDbType.Int, 4)
            };

            parameters[0].Value = model.CSState;
            parameters[1].Value = model.CSResult;
            parameters[2].Value = model.CSSatisfy;
            parameters[3].Value = model.CSID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#4
0
 public List <Maticsoft.Model.CustomServices> GetAllBook(Maticsoft.Model.CustomServices book)
 {
     Maticsoft.BLL.CustomServices b = new Maticsoft.BLL.CustomServices();
     return(b.GetAllBook(book));
 }
示例#5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.CustomServices DataRowToModel(DataRow row)
        {
            Maticsoft.Model.CustomServices model = new Maticsoft.Model.CustomServices();
            if (row != null)
            {
                if (row["CSID"] != null && row["CSID"].ToString() != "")
                {
                    model.CSID = int.Parse(row["CSID"].ToString());
                }
                if (row["STID"] != null && row["STID"].ToString() != "")
                {
                    model.STID = int.Parse(row["STID"].ToString());
                }
                if (row["CusID"] != null)
                {
                    model.CusID = row["CusID"].ToString();
                }
                if (row["CSTitle"] != null)
                {
                    model.CSTitle = row["CSTitle"].ToString();
                }
                if (row["CSState"] != null && row["CSState"].ToString() != "")
                {
                    model.CSState = int.Parse(row["CSState"].ToString());
                }
                if (row["CusName"] != null && row["CusName"].ToString() != "")
                {
                    model.CusName = row["CusName"].ToString();
                }
                if (row["CSDesc"] != null)
                {
                    model.CSDesc = row["CSDesc"].ToString();
                }
                if (row["CSCreateID"] != null && row["CSCreateID"].ToString() != "")
                {
                    model.CSCreateID = int.Parse(row["CSCreateID"].ToString());
                }
                if (row["CSCreateDate"] != null && row["CSCreateDate"].ToString() != "")
                {
                    model.CSCreateDate = DateTime.Parse(row["CSCreateDate"].ToString());
                }
                if (row["CSDueID"] != null && row["CSDueID"].ToString() != "")
                {
                    model.CSDueID = int.Parse(row["CSDueID"].ToString());
                }
                if (row["CSDueDate"] != null && row["CSDueDate"].ToString() != "")
                {
                    model.CSDueDate = DateTime.Parse(row["CSDueDate"].ToString());
                }
                if (row["CSDeal"] != null)
                {
                    model.CSDeal = row["CSDeal"].ToString();
                }
                if (row["CSDealDate"] != null && row["CSDealDate"].ToString() != "")
                {
                    model.CSDealDate = DateTime.Parse(row["CSDealDate"].ToString());
                }
                if (row["CSResult"] != null)
                {
                    model.CSResult = row["CSResult"].ToString();
                }
                if (row["CSSatisfy"] != null && row["CSSatisfy"].ToString() != "")
                {
                    model.CSSatisfy = int.Parse(row["CSSatisfy"].ToString());
                }
                if (row["STName"] != null && row["STName"].ToString() != "")
                {
                    model.STName = row["STName"].ToString();
                }


                if (row["UserName"] != null && row["UserName"].ToString() != "")
                {
                    model.UserName = row["UserName"].ToString();
                }
            }
            return(model);
        }
示例#6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.CustomServices model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update CustomServices set ");
            strSql.Append("STID=@STID,");
            strSql.Append("CusID=@CusID,");
            strSql.Append("CSTitle=@CSTitle,");
            strSql.Append("CSState=@CSState,");
            strSql.Append("CSDesc=@CSDesc,");
            strSql.Append("CSCreateID=@CSCreateID,");
            strSql.Append("CSCreateDate=@CSCreateDate,");
            strSql.Append("CSDueID=@CSDueID,");
            strSql.Append("CSDueDate=@CSDueDate,");
            strSql.Append("CSDeal=@CSDeal,");
            strSql.Append("CSDealDate=@CSDealDate,");
            strSql.Append("CSResult=@CSResult,");
            strSql.Append("CSSatisfy=@CSSatisfy");
            strSql.Append(" where CSID=@CSID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@STID",         SqlDbType.Int,         4),
                new SqlParameter("@CusID",        SqlDbType.Char,       14),
                new SqlParameter("@CSTitle",      SqlDbType.NVarChar,  100),
                new SqlParameter("@CSState",      SqlDbType.Int,         4),
                new SqlParameter("@CSDesc",       SqlDbType.NVarChar,   -1),
                new SqlParameter("@CSCreateID",   SqlDbType.Int,         4),
                new SqlParameter("@CSCreateDate", SqlDbType.DateTime),
                new SqlParameter("@CSDueID",      SqlDbType.Int,         4),
                new SqlParameter("@CSDueDate",    SqlDbType.DateTime),
                new SqlParameter("@CSDeal",       SqlDbType.NVarChar,  500),
                new SqlParameter("@CSDealDate",   SqlDbType.DateTime),
                new SqlParameter("@CSResult",     SqlDbType.NVarChar,  500),
                new SqlParameter("@CSSatisfy",    SqlDbType.Int,         4),
                new SqlParameter("@CSID",         SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.STID;
            parameters[1].Value  = model.CusID;
            parameters[2].Value  = model.CSTitle;
            parameters[3].Value  = model.CSState;
            parameters[4].Value  = model.CSDesc;
            parameters[5].Value  = model.CSCreateID;
            parameters[6].Value  = model.CSCreateDate;
            parameters[7].Value  = model.CSDueID;
            parameters[8].Value  = model.CSDueDate;
            parameters[9].Value  = model.CSDeal;
            parameters[10].Value = model.CSDealDate;
            parameters[11].Value = model.CSResult;
            parameters[12].Value = model.CSSatisfy;
            parameters[13].Value = model.CSID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }