Exemple #1
0
 public ActionResult Update(ItempropertyInfo itempropertyInfo)
 {
     try
     {
         itempropertyInfo.UpdatedBy   = CurrentUserInfo.UserName;
         itempropertyInfo.UpdatedDate = DateTime.Now;
         IItempropertyService itempropertyService = UnityHelper.UnityResolve <IItempropertyService>();
         var data = itempropertyService.UpdateItemproperty(itempropertyInfo);
         LogHelper.LogOperation(CurrentUserInfo.UserCode, string.Format("Update ItempropertyInfo {0},{1}", LogHelper.ChangeEntityToLog(itempropertyInfo), data));
         if (data > 0)
         {
             return(Content("OK"));
         }
         else
         {
             return(Content("Failed"));
         }
     }
     catch (BusinessException bex)
     {
         return(Content(bex.Message));
     }
     catch (Exception ex)
     {
         LogHelper.LogError(ex, "");
         return(Content(ex.Message));
     }
 }
Exemple #2
0
 /// <summary>
 /// 设置SQL参数表
 /// </summary>
 /// <param name="Itemproperty">Itemproperty对象</param>
 /// <returns>Itemproperty参数数组</returns>
 private SqlParameter[] Set_Itemproperty_Parameters(ItempropertyInfo itempropertyInfo)
 {
     SqlParameter[] paramArray = new SqlParameter[] { new SqlParameter("@ItemPropertyID", itempropertyInfo.ItemPropertyID),
                                                      new SqlParameter("@PropertyName", string.IsNullOrEmpty(itempropertyInfo.PropertyName)?"":itempropertyInfo.PropertyName),
                                                      new SqlParameter("@Descr", string.IsNullOrEmpty(itempropertyInfo.Descr)?"":itempropertyInfo.Descr),
                                                      new SqlParameter("@Remark", string.IsNullOrEmpty(itempropertyInfo.Remark)?"":itempropertyInfo.Remark),
                                                      new SqlParameter("@IsActive", string.IsNullOrEmpty(itempropertyInfo.IsActive)?"":itempropertyInfo.IsActive),
                                                      new SqlParameter("@CreatedBy", string.IsNullOrEmpty(itempropertyInfo.CreatedBy)?"":itempropertyInfo.CreatedBy),
                                                      new SqlParameter("@UpdatedBy", string.IsNullOrEmpty(itempropertyInfo.UpdatedBy)?"":itempropertyInfo.UpdatedBy) };
     return(paramArray);
 }
Exemple #3
0
        /// <summary>
        /// 更新一条Itemproperty记录
        /// </summary>
        /// <param name="db">DataBase对象</param>
        /// <param name="tran">一个有效的DbTransaction</param>
        /// <param name="itemproperty">Itemproperty对象</param>
        /// <param name="whLoginID">要查询的仓库的前缀</param>
        /// <returns>执行更新对数据库影响的行数</returns>
        public int UpdateItemproperty(Database db, DbTransaction tran, ItempropertyInfo itempropertyInfo)
        {
            int result = 0;

            SqlParameter[] paras = Set_Itemproperty_Parameters(itempropertyInfo);
            if (paras != null)
            {
                result += DBHelper.ExecuteNonQuery(db, tran, CommandType.Text, SQL_UPDATE_ITEMPROPERTY, paras);
            }
            return(result);
        }
Exemple #4
0
        /// <summary>
        /// 新增一条Itemproperty记录
        /// </summary>
        /// <param name="itemproperty">Itemproperty对象</param>
        /// <param name="whLoginID">要查询的仓库的前缀</param>
        /// <returns>执行新增对数据库影响的行数</returns>
        public int InsertItemproperty(ItempropertyInfo itempropertyInfo)
        {
            int result = 0;

            SqlParameter[] paras = Set_Itemproperty_Parameters(itempropertyInfo);
            if (paras != null)
            {
                result = DBHelper.ExecuteNonQuery(CommandType.Text, SQL_INSERT_ITEMPROPERTY, paras);
            }
            return(result);
        }
Exemple #5
0
 public ActionResult Edit(ItempropertyInfo itempropertyInfo)
 {
     if (itempropertyInfo.ItemPropertyID == 0)
     {
         return(Insert(itempropertyInfo));
     }
     else
     {
         return(Update(itempropertyInfo));
     }
 }
Exemple #6
0
 /// <summary>
 /// 初始化ItempropertyInfo
 /// </summary>
 private ItempropertyInfo InitItempropertyInfoByDataReader(ItempropertyInfo itempropertyInfo, IDataReader reader)
 {
     itempropertyInfo = new ItempropertyInfo(reader["ItemPropertyID"].ToString() != "" ? Int32.Parse(reader["ItemPropertyID"].ToString()) : 0,
                                             reader["PropertyName"].ToString(),
                                             reader["Descr"].ToString(),
                                             reader["Remark"].ToString(),
                                             reader["IsActive"].ToString(),
                                             reader["CreatedBy"].ToString(),
                                             reader["CreatedDate"].ToString() != "" ? DateTime.Parse(reader["CreatedDate"].ToString()) : new DateTime(),
                                             reader["UpdatedBy"].ToString(),
                                             reader["UpdatedDate"].ToString() != "" ? DateTime.Parse(reader["UpdatedDate"].ToString()) : new DateTime());
     return(itempropertyInfo);
 }
Exemple #7
0
        /// <summary>
        /// 根据itempropertyID得到一条Itemproperty记录
        /// </summary>
        /// <param name="itempropertyID">itempropertyID</param>
        /// <param name="whLoginID">要查询的仓库的前缀</param>
        /// <returns>根据itempropertyID得到一条Itemproperty记录</returns>
        public ItempropertyInfo GetItempropertyByID(string itempropertyID)
        {
            string sql = SQL_SELECT_ALL_ITEMPROPERTY + " AND ITEMPROPERTYID = @ITEMPROPERTYID  ";

            SqlParameter[]   paras            = new SqlParameter[] { new SqlParameter("@ITEMPROPERTYID", itempropertyID) };
            ItempropertyInfo itempropertyInfo = null;

            using (IDataReader reader = DBHelper.ExecuteReader(CommandType.Text, sql, paras))
            {
                if (reader.Read())
                {
                    itempropertyInfo = InitItempropertyInfoByDataReader(itempropertyInfo, reader);
                }
            }

            return(itempropertyInfo);
        }
Exemple #8
0
        /// <summary>
        /// 根据itempropertyID得到一条Itemproperty记录
        /// </summary>
        /// <param name="db">DataBase对象</param>
        /// <param name="tran">一个有效的DbTransaction</param>
        /// <param name="itempropertyID">itempropertyID</param>
        /// <param name="whLoginID">要查询的仓库的前缀</param>
        /// <returns>根据itempropertyID得到一条Itemproperty记录</returns>
        public ItempropertyInfo GetItempropertyByID(Database db, DbTransaction tran, string itempropertyID)
        {
            string sql = SQL_SELECT_ALL_ITEMPROPERTY + " AND ITEMPROPERTYID = @ITEMPROPERTYID  ";

            SqlParameter[]   paras            = new SqlParameter[] { new SqlParameter("@ITEMPROPERTYID", itempropertyID) };
            ItempropertyInfo itempropertyInfo = null;

            IDataReader reader = DBHelper.ExecuteReader(db, tran, CommandType.Text, sql, paras);

            if (reader.Read())
            {
                itempropertyInfo = InitItempropertyInfoByDataReader(itempropertyInfo, reader);
            }
            if (!reader.IsClosed)
            {
                reader.Close();
            }

            return(itempropertyInfo);
        }
Exemple #9
0
 /// <summary>
 /// 新增一条Itemproperty记录
 /// </summary>
 /// <param name="itemproperty">Itemproperty对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行新增对数据库影响的行数</returns>
 public int InsertItemproperty(ItempropertyInfo itempropertyInfo)
 {
     return(itempropertyDA.InsertItemproperty(itempropertyInfo));
 }
Exemple #10
0
 /// <summary>
 /// 更新一条Itemproperty记录
 /// </summary>
 /// <param name="itemproperty">Itemproperty对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行更新对数据库影响的行数</returns>
 public int UpdateItemproperty(ItempropertyInfo itempropertyInfo)
 {
     return(itempropertyDA.UpdateItemproperty(itempropertyInfo));
 }