Example #1
0
        /// <summary>
        /// 调用存储过程修改一个
        /// </summary>
        /// <param name="info">实体对象</param>
        /// <returns>更新成功返回ture,否则返回false</returns>
        public static bool DingDanEdit(Entity.DingDan info)
        {
            SqlParameter[] prams =
            {
                SqlDB.MakeInParam("@Id",          SqlDbType.Int,        4, info.Id),
                SqlDB.MakeInParam("@State",       SqlDbType.Int,        4, info.State),
                SqlDB.MakeInParam("@DingDanHao",  SqlDbType.NVarChar, 100, info.DingDanHao),
                SqlDB.MakeInParam("@Subject",     SqlDbType.NVarChar, 200, info.Subject),
                SqlDB.MakeInParam("@Body",        SqlDbType.NText,      0, info.Body),
                SqlDB.MakeInParam("@Count",       SqlDbType.Int,        4, info.Count),
                SqlDB.MakeInParam("@DanJia",      SqlDbType.Decimal,    0, info.DanJia),
                SqlDB.MakeInParam("@DingDanJinE", SqlDbType.Decimal,    0, info.DingDanJinE),
                SqlDB.MakeInParam("@CellName",    SqlDbType.NVarChar, 100, info.CellName),
                SqlDB.MakeInParam("@CellMobile",  SqlDbType.NVarChar,  50, info.CellMobile),
                SqlDB.MakeInParam("@AddTime",     SqlDbType.DateTime,   8, info.AddTime),
                SqlDB.MakeInParam("@Memo",        SqlDbType.NText,      0, info.Memo),
                SqlDB.MakeInParam("@ProvinceId",  SqlDbType.Int,        4, info.ProvinceId),
                SqlDB.MakeInParam("@WenLi",       SqlDbType.Int,        4, info.WenLi),
                SqlDB.MakeInParam("@Address",     SqlDbType.NVarChar, 200, info.Address),
                SqlDB.MakeInParam("@Category",    SqlDbType.Int,        4, info.Category),
            };
            int intReturnValue = 0;

            intReturnValue = SqlDB.ExecuteNonQuery(CommandType.StoredProcedure, "DingDanEdit", prams);
            if (intReturnValue == 1)
            {
                return(true);
            }
            return(false);
        }
Example #2
0
        public static Entity.DingDan DingDanEntityGetByDingDanHao(string DingDanHao)
        {
            Entity.DingDan info = new Entity.DingDan();
            DataTable      dt   = SqlDB.ExecuteDataset(CommandType.Text, "SELECT * FROM [DingDan] WHERE DingDanHao = '" + DingDanHao + "'").Tables[0];

            if (dt.Rows.Count > 0)
            {
                info.Id          = Basic.Utils.StrToInt(dt.Rows[0]["Id"].ToString(), 0);
                info.State       = Basic.Utils.StrToInt(dt.Rows[0]["State"].ToString(), 0);
                info.DingDanHao  = dt.Rows[0]["DingDanHao"].ToString();
                info.Subject     = dt.Rows[0]["Subject"].ToString();
                info.Body        = dt.Rows[0]["Body"].ToString();
                info.Count       = Basic.Utils.StrToInt(dt.Rows[0]["Count"].ToString(), 0);
                info.DanJia      = Basic.Utils.StrToDecimal(dt.Rows[0]["DanJia"].ToString(), 0);
                info.DingDanJinE = Basic.Utils.StrToDecimal(dt.Rows[0]["DingDanJinE"].ToString(), 0);
                info.CellName    = dt.Rows[0]["CellName"].ToString();
                info.CellMobile  = dt.Rows[0]["CellMobile"].ToString();
                info.AddTime     = Basic.Utils.StrToDateTime(dt.Rows[0]["AddTime"].ToString());
                info.Memo        = dt.Rows[0]["Memo"].ToString();
                info.ProvinceId  = Basic.Utils.StrToInt(dt.Rows[0]["ProvinceId"].ToString(), 0);
                info.WenLi       = Basic.Utils.StrToInt(dt.Rows[0]["WenLi"].ToString(), 0);
                info.Address     = dt.Rows[0]["Address"].ToString();
                info.Category    = Basic.Utils.StrToInt(dt.Rows[0]["Category"].ToString(), 0);
                return(info);
            }
            return(null);
        }
Example #3
0
 /// <summary>
 /// 调用存储过程增加一个
 /// </summary>
 /// <param name="info">实体对象</param>
 /// <returns>正常返回大于 0 的自增id, 0代表重复,否则返回-1</returns>
 public static int DingDanAdd(Entity.DingDan info)
 {
     SqlParameter[] prams =
     {
         SqlDB.MakeInParam("@State",       SqlDbType.Int,        4, info.State),
         SqlDB.MakeInParam("@DingDanHao",  SqlDbType.NVarChar, 100, info.DingDanHao),
         SqlDB.MakeInParam("@Subject",     SqlDbType.NVarChar, 200, info.Subject),
         SqlDB.MakeInParam("@Body",        SqlDbType.NText,      0, info.Body),
         SqlDB.MakeInParam("@Count",       SqlDbType.Int,        4, info.Count),
         SqlDB.MakeInParam("@DanJia",      SqlDbType.Decimal,    0, info.DanJia),
         SqlDB.MakeInParam("@DingDanJinE", SqlDbType.Decimal,    0, info.DingDanJinE),
         SqlDB.MakeInParam("@CellName",    SqlDbType.NVarChar, 100, info.CellName),
         SqlDB.MakeInParam("@CellMobile",  SqlDbType.NVarChar,  50, info.CellMobile),
         SqlDB.MakeInParam("@AddTime",     SqlDbType.DateTime,   8, info.AddTime),
         SqlDB.MakeInParam("@Memo",        SqlDbType.NText,      0, info.Memo),
         SqlDB.MakeInParam("@ProvinceId",  SqlDbType.Int,        4, info.ProvinceId),
         SqlDB.MakeInParam("@WenLi",       SqlDbType.Int,        4, info.WenLi),
         SqlDB.MakeInParam("@Address",     SqlDbType.NVarChar, 200, info.Address),
         SqlDB.MakeInParam("@Category",    SqlDbType.Int,        4, info.Category),
     };
     return(Basic.Utils.StrToInt(SqlDB.ExecuteScalar(CommandType.StoredProcedure, "DingDanAdd", prams).ToString(), -1));
 }