Beispiel #1
0
        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name='model'>实体</param>
        /// <returns>bool</returns>
        public bool Update(Other_Cost model)
        {
            bool result  = false;
            var  e       = new ModelExceptions();
            int  _rseult = instance.Update(model);

            if (_rseult > 0)
            {
                result = true;
            }
            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// 获取实体数据
        /// </summary>
        /// <param name='strCondition'>条件(AND Code='11')</param>
        /// <returns>model</returns>
        public Other_Cost GetModel(string strCondition)
        {
            List <Other_Cost> list  = instance.GetListByWhere(strCondition);
            Other_Cost        model = new Other_Cost();

            if (list != null && list.Count > 0)
            {
                model = list[0];
            }
            else
            {
                model = null;
            }
            return(model);
        }
Beispiel #3
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name='model'>实体</param>
        /// <param name='model'>是否完成验证</param>
        /// <returns>bool</returns>
        public bool Insert(Other_Cost model, bool IsValid)
        {
            var  e      = new ModelExceptions();
            bool result = false;

            if (e.IsValid && IsValid)
            {
                //完成了验证,开始更新数据库了
                int _result = instance.Add(model);
                if (_result > 0)
                {
                    result = true;
                }
            }
            return(result);
        }
Beispiel #4
0
        /// <summary>
        /// 逻辑删除数据
        /// </summary>
        /// <param name='model'>model</param>
        /// <returns>bool</returns>
        public bool Delete(string Condition)
        {
            bool result            = false;
            List <Other_Cost> list = instance.GetListByWhere(Condition);

            if (list.Count > 0)
            {
                Other_Cost model = list[0];
                model.Stat = 1;
                int _rseult = instance.Update(model);
                if (_rseult > 0)
                {
                    result = true;
                }
            }
            return(result);
        }
Beispiel #5
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name='model'>实体</param>
        /// <returns>bool</returns>
        public bool Insert(Other_Cost model)
        {
            bool result = false;

            try
            {
                int _result = instance.Add(model);
                if (_result > 0)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(result);
        }
Beispiel #6
0
        /// <summary>
        /// 更新费用交纳明细(环保费用,其他费用) Other_Cost对象(即:一条记录
        /// </summary>
        public int Update(Other_Cost other_Cost)
        {
            StringBuilder sbParameter = new StringBuilder();
            StringBuilder sb          = new StringBuilder();

            sb.Append(@"UPDATE       Other_Cost       SET ");
            if (other_Cost.OtherCost_Code_IsChanged)
            {
                sbParameter.Append("OtherCost_Code=@OtherCost_Code, ");
            }
            if (other_Cost.OtherCost_Money_IsChanged)
            {
                sbParameter.Append("OtherCost_Money=@OtherCost_Money, ");
            }
            if (other_Cost.OtherCost_Date_IsChanged)
            {
                sbParameter.Append("OtherCost_Date=@OtherCost_Date, ");
            }
            if (other_Cost.OtherCost_Type_IsChanged)
            {
                sbParameter.Append("OtherCost_Type=@OtherCost_Type, ");
            }
            if (other_Cost.OtherCost_Remark_IsChanged)
            {
                sbParameter.Append("OtherCost_Remark=@OtherCost_Remark, ");
            }
            if (other_Cost.OtherCost_Usage_IsChanged)
            {
                sbParameter.Append("OtherCost_Usage=@OtherCost_Usage, ");
            }
            if (other_Cost.OtherCost_Company_IsChanged)
            {
                sbParameter.Append("OtherCost_Company=@OtherCost_Company, ");
            }
            if (other_Cost.OtherCost_Dept_IsChanged)
            {
                sbParameter.Append("OtherCost_Dept=@OtherCost_Dept, ");
            }
            if (other_Cost.OtherCost_BeginDate_IsChanged)
            {
                sbParameter.Append("OtherCost_BeginDate=@OtherCost_BeginDate, ");
            }
            if (other_Cost.OtherCost_EndDate_IsChanged)
            {
                sbParameter.Append("OtherCost_EndDate=@OtherCost_EndDate, ");
            }
            if (other_Cost.OtherCost_Operator_IsChanged)
            {
                sbParameter.Append("OtherCost_Operator=@OtherCost_Operator, ");
            }
            if (other_Cost.OtherCost_OpDate_IsChanged)
            {
                sbParameter.Append("OtherCost_OpDate=@OtherCost_OpDate, ");
            }
            if (other_Cost.OtherCost_Auditor_IsChanged)
            {
                sbParameter.Append("OtherCost_Auditor=@OtherCost_Auditor, ");
            }
            if (other_Cost.OtherCost_AuditDate_IsChanged)
            {
                sbParameter.Append("OtherCost_AuditDate=@OtherCost_AuditDate, ");
            }
            if (other_Cost.Stat_IsChanged)
            {
                sbParameter.Append("Stat=@Stat, ");
            }
            if (other_Cost.CreateDate_IsChanged)
            {
                sbParameter.Append("CreateDate=@CreateDate, ");
            }
            if (other_Cost.UpdateDate_IsChanged)
            {
                sbParameter.Append("UpdateDate=@UpdateDate, ");
            }
            if (other_Cost.DeleteDate_IsChanged)
            {
                sbParameter.Append("DeleteDate=@DeleteDate ");
            }
            sb.Append(sbParameter.ToString().Trim().TrimEnd(','));
            sb.Append(" WHERE 1=1 AND ((Stat is null) or (Stat=0))   and OtherCost_ID=@OtherCost_ID; ");
            string sql = sb.ToString();

            if (other_Cost.OtherCost_Code_IsChanged)
            {
                if (string.IsNullOrEmpty(other_Cost.OtherCost_Code))
                {
                    idb.AddParameter("@OtherCost_Code", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@OtherCost_Code", other_Cost.OtherCost_Code);
                }
            }
            if (other_Cost.OtherCost_Money_IsChanged)
            {
                if (other_Cost.OtherCost_Money == 0)
                {
                    idb.AddParameter("@OtherCost_Money", 0);
                }
                else
                {
                    idb.AddParameter("@OtherCost_Money", other_Cost.OtherCost_Money);
                }
            }
            if (other_Cost.OtherCost_Date_IsChanged)
            {
                if (other_Cost.OtherCost_Date == DateTime.MinValue)
                {
                    idb.AddParameter("@OtherCost_Date", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@OtherCost_Date", other_Cost.OtherCost_Date);
                }
            }
            if (other_Cost.OtherCost_Type_IsChanged)
            {
                if (string.IsNullOrEmpty(other_Cost.OtherCost_Type))
                {
                    idb.AddParameter("@OtherCost_Type", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@OtherCost_Type", other_Cost.OtherCost_Type);
                }
            }
            if (other_Cost.OtherCost_Remark_IsChanged)
            {
                if (string.IsNullOrEmpty(other_Cost.OtherCost_Remark))
                {
                    idb.AddParameter("@OtherCost_Remark", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@OtherCost_Remark", other_Cost.OtherCost_Remark);
                }
            }
            if (other_Cost.OtherCost_Usage_IsChanged)
            {
                if (string.IsNullOrEmpty(other_Cost.OtherCost_Usage))
                {
                    idb.AddParameter("@OtherCost_Usage", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@OtherCost_Usage", other_Cost.OtherCost_Usage);
                }
            }
            if (other_Cost.OtherCost_Company_IsChanged)
            {
                if (string.IsNullOrEmpty(other_Cost.OtherCost_Company))
                {
                    idb.AddParameter("@OtherCost_Company", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@OtherCost_Company", other_Cost.OtherCost_Company);
                }
            }
            if (other_Cost.OtherCost_Dept_IsChanged)
            {
                if (string.IsNullOrEmpty(other_Cost.OtherCost_Dept))
                {
                    idb.AddParameter("@OtherCost_Dept", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@OtherCost_Dept", other_Cost.OtherCost_Dept);
                }
            }
            if (other_Cost.OtherCost_BeginDate_IsChanged)
            {
                if (other_Cost.OtherCost_BeginDate == DateTime.MinValue)
                {
                    idb.AddParameter("@OtherCost_BeginDate", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@OtherCost_BeginDate", other_Cost.OtherCost_BeginDate);
                }
            }
            if (other_Cost.OtherCost_EndDate_IsChanged)
            {
                if (other_Cost.OtherCost_EndDate == DateTime.MinValue)
                {
                    idb.AddParameter("@OtherCost_EndDate", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@OtherCost_EndDate", other_Cost.OtherCost_EndDate);
                }
            }
            if (other_Cost.OtherCost_Operator_IsChanged)
            {
                if (string.IsNullOrEmpty(other_Cost.OtherCost_Operator))
                {
                    idb.AddParameter("@OtherCost_Operator", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@OtherCost_Operator", other_Cost.OtherCost_Operator);
                }
            }
            if (other_Cost.OtherCost_OpDate_IsChanged)
            {
                if (other_Cost.OtherCost_OpDate == DateTime.MinValue)
                {
                    idb.AddParameter("@OtherCost_OpDate", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@OtherCost_OpDate", other_Cost.OtherCost_OpDate);
                }
            }
            if (other_Cost.OtherCost_Auditor_IsChanged)
            {
                if (string.IsNullOrEmpty(other_Cost.OtherCost_Auditor))
                {
                    idb.AddParameter("@OtherCost_Auditor", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@OtherCost_Auditor", other_Cost.OtherCost_Auditor);
                }
            }
            if (other_Cost.OtherCost_AuditDate_IsChanged)
            {
                if (other_Cost.OtherCost_AuditDate == DateTime.MinValue)
                {
                    idb.AddParameter("@OtherCost_AuditDate", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@OtherCost_AuditDate", other_Cost.OtherCost_AuditDate);
                }
            }
            if (other_Cost.Stat_IsChanged)
            {
                if (other_Cost.Stat == 0)
                {
                    idb.AddParameter("@Stat", 0);
                }
                else
                {
                    idb.AddParameter("@Stat", other_Cost.Stat);
                }
            }
            if (other_Cost.CreateDate_IsChanged)
            {
                if (other_Cost.CreateDate == DateTime.MinValue)
                {
                    idb.AddParameter("@CreateDate", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@CreateDate", other_Cost.CreateDate);
                }
            }
            if (other_Cost.UpdateDate_IsChanged)
            {
                if (other_Cost.UpdateDate == DateTime.MinValue)
                {
                    idb.AddParameter("@UpdateDate", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@UpdateDate", other_Cost.UpdateDate);
                }
            }
            if (other_Cost.DeleteDate_IsChanged)
            {
                if (other_Cost.DeleteDate == DateTime.MinValue)
                {
                    idb.AddParameter("@DeleteDate", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@DeleteDate", other_Cost.DeleteDate);
                }
            }

            idb.AddParameter("@OtherCost_ID", other_Cost.OtherCost_ID);


            int Re = 0;
            //SQL日志记录
            var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();

            System.Collections.Hashtable param = new System.Collections.Hashtable();
            string Ex = "0";

            foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
            {
                param.Add(item.Key, item.Value);
            }
            try
            {
                Re = idb.ExeCmd(sql);
                Ex = Re.ToString();
            }
            catch (Exception ex)
            {
                Ex = ex.Message;
            }

            SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name, Ex);

            return(Re);
        }
Beispiel #7
0
        /// <summary>
        /// 添加费用交纳明细(环保费用,其他费用) Other_Cost对象(即:一条记录)
        /// </summary>
        public int Add(Other_Cost other_Cost)
        {
            string sql = "INSERT INTO Other_Cost (OtherCost_Code,OtherCost_Money,OtherCost_Date,OtherCost_Type,OtherCost_Remark,OtherCost_Usage,OtherCost_Company,OtherCost_Dept,OtherCost_BeginDate,OtherCost_EndDate,OtherCost_Operator,OtherCost_OpDate,OtherCost_Auditor,OtherCost_AuditDate,Stat,CreateDate,UpdateDate,DeleteDate) VALUES (@OtherCost_Code,@OtherCost_Money,@OtherCost_Date,@OtherCost_Type,@OtherCost_Remark,@OtherCost_Usage,@OtherCost_Company,@OtherCost_Dept,@OtherCost_BeginDate,@OtherCost_EndDate,@OtherCost_Operator,@OtherCost_OpDate,@OtherCost_Auditor,@OtherCost_AuditDate,@Stat,@CreateDate,@UpdateDate,@DeleteDate)";

            if (string.IsNullOrEmpty(other_Cost.OtherCost_Code))
            {
                idb.AddParameter("@OtherCost_Code", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@OtherCost_Code", other_Cost.OtherCost_Code);
            }
            if (other_Cost.OtherCost_Money == 0)
            {
                idb.AddParameter("@OtherCost_Money", 0);
            }
            else
            {
                idb.AddParameter("@OtherCost_Money", other_Cost.OtherCost_Money);
            }
            if (other_Cost.OtherCost_Date == DateTime.MinValue)
            {
                idb.AddParameter("@OtherCost_Date", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@OtherCost_Date", other_Cost.OtherCost_Date);
            }
            if (string.IsNullOrEmpty(other_Cost.OtherCost_Type))
            {
                idb.AddParameter("@OtherCost_Type", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@OtherCost_Type", other_Cost.OtherCost_Type);
            }
            if (string.IsNullOrEmpty(other_Cost.OtherCost_Remark))
            {
                idb.AddParameter("@OtherCost_Remark", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@OtherCost_Remark", other_Cost.OtherCost_Remark);
            }
            if (string.IsNullOrEmpty(other_Cost.OtherCost_Usage))
            {
                idb.AddParameter("@OtherCost_Usage", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@OtherCost_Usage", other_Cost.OtherCost_Usage);
            }
            if (string.IsNullOrEmpty(other_Cost.OtherCost_Company))
            {
                idb.AddParameter("@OtherCost_Company", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@OtherCost_Company", other_Cost.OtherCost_Company);
            }
            if (string.IsNullOrEmpty(other_Cost.OtherCost_Dept))
            {
                idb.AddParameter("@OtherCost_Dept", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@OtherCost_Dept", other_Cost.OtherCost_Dept);
            }
            if (other_Cost.OtherCost_BeginDate == DateTime.MinValue)
            {
                idb.AddParameter("@OtherCost_BeginDate", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@OtherCost_BeginDate", other_Cost.OtherCost_BeginDate);
            }
            if (other_Cost.OtherCost_EndDate == DateTime.MinValue)
            {
                idb.AddParameter("@OtherCost_EndDate", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@OtherCost_EndDate", other_Cost.OtherCost_EndDate);
            }
            if (string.IsNullOrEmpty(other_Cost.OtherCost_Operator))
            {
                idb.AddParameter("@OtherCost_Operator", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@OtherCost_Operator", other_Cost.OtherCost_Operator);
            }
            if (other_Cost.OtherCost_OpDate == DateTime.MinValue)
            {
                idb.AddParameter("@OtherCost_OpDate", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@OtherCost_OpDate", other_Cost.OtherCost_OpDate);
            }
            if (string.IsNullOrEmpty(other_Cost.OtherCost_Auditor))
            {
                idb.AddParameter("@OtherCost_Auditor", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@OtherCost_Auditor", other_Cost.OtherCost_Auditor);
            }
            if (other_Cost.OtherCost_AuditDate == DateTime.MinValue)
            {
                idb.AddParameter("@OtherCost_AuditDate", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@OtherCost_AuditDate", other_Cost.OtherCost_AuditDate);
            }
            if (other_Cost.Stat == 0)
            {
                idb.AddParameter("@Stat", 0);
            }
            else
            {
                idb.AddParameter("@Stat", other_Cost.Stat);
            }
            if (other_Cost.CreateDate == DateTime.MinValue)
            {
                idb.AddParameter("@CreateDate", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@CreateDate", other_Cost.CreateDate);
            }
            if (other_Cost.UpdateDate == DateTime.MinValue)
            {
                idb.AddParameter("@UpdateDate", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@UpdateDate", other_Cost.UpdateDate);
            }
            if (other_Cost.DeleteDate == DateTime.MinValue)
            {
                idb.AddParameter("@DeleteDate", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@DeleteDate", other_Cost.DeleteDate);
            }


            int Re = 0;
            //SQL日志记录
            var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();

            System.Collections.Hashtable param = new System.Collections.Hashtable();
            string Ex = "0";

            foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
            {
                param.Add(item.Key, item.Value);
            }
            try
            {
                Re = idb.ExeCmd(sql);
                Ex = Re.ToString();
            }
            catch (Exception ex)
            {
                Ex = ex.Message;
            }

            SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name, Ex);

            return(Re);
        }
Beispiel #8
0
        /// <summary>
        /// 获取实体数据
        /// </summary>
        /// <param name='strCondition'>条件(AND Code='11')</param>
        /// <returns>model</returns>
        public Other_Cost GetModel(int id)
        {
            Other_Cost model = instance.GetByKey(id);

            return(model);
        }