/// <summary>
        /// 添加固定资产类别
        /// </summary>
        /// <param name="Model">实体</param>
        /// <returns>true 成功,false失败</returns>
        public static bool InsertAssetType(AssetTypeSettingModel Model, out int ID)
        {
            StringBuilder sql = new StringBuilder();

            sql.AppendLine("Insert into officedba.AssetTypeSetting");
            sql.AppendLine("(CompanyCD,TypeName,CountMethod,");
            sql.AppendLine("EstimateUseYear,EstiResiValue,SubjectsCD,");
            sql.AppendLine("UsedStatus,Remark)values(@CompanyCD,");
            sql.AppendLine("@TypeName,@CountMethod");
            sql.AppendLine(",@EstimateUseYear,@EstiResiValue,@SubjectsCD");
            sql.AppendLine(",@UsedStatus,@Remark)");
            sql.AppendLine("set @IntID= @@IDENTITY");

            SqlParameter[] parms = new SqlParameter[9];
            parms[0] = SqlHelper.GetParameter("@CompanyCD", Model.CompanyCD);
            parms[1] = SqlHelper.GetParameter("@TypeName", Model.TypeName);
            parms[2] = SqlHelper.GetParameter("@CountMethod", Model.CountMethod);
            parms[3] = SqlHelper.GetParameter("@EstimateUseYear", Model.EstimateUseYear);
            parms[4] = SqlHelper.GetParameter("@EstiResiValue", Model.EstiResiValue);
            parms[5] = SqlHelper.GetParameter("@SubjectsCD", Model.SubjectsCD);
            parms[6] = SqlHelper.GetParameter("@UsedStatus", Model.UsedStatus);
            parms[7] = SqlHelper.GetParameter("@Remark", Model.Remark);
            parms[8] = SqlHelper.GetOutputParameter("@IntID", SqlDbType.Int);

            SqlHelper.ExecuteTransSql(sql.ToString(), parms);
            ID = Convert.ToInt32(parms[8].Value);
            return(SqlHelper.Result.OprateCount > 0 ? true : false);
        }
        /// <summary>
        /// 修改固定资产类别
        /// </summary>
        /// <param name="Model">实体</param>
        /// <returns>true 成功,false失败</returns>
        public static bool UpdateAssetType(AssetTypeSettingModel Model)
        {
            StringBuilder sql = new StringBuilder();

            sql.AppendLine("Update officedba.AssetTypeSetting set TypeName=@TypeName");
            sql.AppendLine(",CountMethod=@CountMethod,EstimateUseYear=@EstimateUseYear");
            sql.AppendLine(",EstiResiValue=@EstiResiValue,SubjectsCD=@SubjectsCD,UsedStatus=@UsedStatus,Remark=@Remark");
            sql.AppendLine(" where CompanyCD=@CompanyCD and ID=@ID");
            SqlParameter[] parms = new SqlParameter[9];
            parms[0] = SqlHelper.GetParameter("@CompanyCD", Model.CompanyCD);
            parms[1] = SqlHelper.GetParameter("@ID", Model.ID);
            parms[2] = SqlHelper.GetParameter("@TypeName", Model.TypeName);
            parms[3] = SqlHelper.GetParameter("@CountMethod", Model.CountMethod);
            parms[4] = SqlHelper.GetParameter("@EstimateUseYear", Model.EstimateUseYear);
            parms[5] = SqlHelper.GetParameter("@EstiResiValue", Model.EstiResiValue);
            parms[6] = SqlHelper.GetParameter("@SubjectsCD", Model.SubjectsCD);
            parms[7] = SqlHelper.GetParameter("@UsedStatus", Model.UsedStatus);
            parms[8] = SqlHelper.GetParameter("@Remark", Model.Remark);
            SqlHelper.ExecuteTransSql(sql.ToString(), parms);
            return(SqlHelper.Result.OprateCount > 0 ? true : false);
        }
Esempio n. 3
0
        /// <summary>
        /// 修改固定资产类别
        /// </summary>
        /// <param name="Model">实体</param>
        /// <returns>true 成功,false失败</returns>
        public static bool UpdateAssetType(AssetTypeSettingModel Model)
        {
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];

            if (Model == null)
            {
                return(false);
            }
            if (Model.CompanyCD == null)
            {
                Model.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
            }
            try
            {
                bool         succ        = false;
                string       loginUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID;
                LogInfoModel logModel    = InitLogInfo(Model.ID.ToString());
                logModel.Element = ConstUtil.LOG_PROCESS_UPDATE;

                succ = AssetTypeSettingDBHelper.UpdateAssetType(Model);
                if (!succ)
                {
                    logModel.Remark = ConstUtil.LOG_PROCESS_FAILED;
                }
                else
                {
                    logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS;
                }
                LogDBHelper.InsertLog(logModel);
                return(succ);
            }
            catch (Exception ex)
            {
                WriteSystemLog(userInfo, ex);
                throw ex;
            }
        }