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

            if (_rseult > 0)
            {
                result = true;
            }
            return(result);
        }
Ejemplo n.º 2
0
        public bool AddContract(SD_Contract model)
        {
            model.AuditStat = OperationTypeEnum.AudtiOperaTypeEnum.Auditing.ToString();
            var node = auditInstance.GetVerifyTemplateFirstNode(OperationTypeEnum.AuditTemplateEnum.ContractAudit.ToString());
            if (node != null)
            {
                model.AuditCurAudit = node.VT_VerifyNode_Code;

                auditInstance.InsertNextAuditRecord(OperationTypeEnum.AuditTemplateEnum.ContractAudit.ToString(), node.VT_VerifyNode_Code, model.Contract_Code);
            }

            return Insert(model);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 保存合同
        /// </summary>
        /// <param name="model"></param>
        /// <param name="SDetailList"></param>
        /// <returns></returns>
        public bool SaveContract(SD_Contract model, List<SD_CDetail> SDetailList)
        {
            bool result = false;
            long ContractId = 0;
            try
            {

                List<SD_CDetail> oldList = bllCdetail.GetCDetailByContract(model.Contract_Code);

                //保存合同细目
                for (int i = 0; i < oldList.Count; i++)
                {
                    var temp = SDetailList.FirstOrDefault(o => o.CDetail_Code == oldList[i].CDetail_Code);

                    if (temp != null)
                    {
                        //var item = SDetailList[i];
                        var item = oldList[i];
                        //if (bllCdetail.CheckExist(SDetailList[i].CDetail_ContractNo, SDetailList[i].CDetail_PartNo))
                        //{
                        temp.CDetail_ID = item.CDetail_ID;
                        bllCdetail.Update(temp);
                        SDetailList.Remove(temp);

                    }
                    else
                    {
                        bllCdetail.Delete(oldList[i]);
                    }
                }

                foreach (var it in SDetailList)
                {

                    it.CDetail_Code = bllCdetail.GenerateCDetailCode();

                    bllCdetail.Insert(it);
                }

                //bllContract.instance.idb.CommitTransaction();
                result = true;
            }
            catch (Exception)
            {
                //bllContract.instance.idb.RollbackTransaction();
                throw;
            }

            return result;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取实体数据
        /// </summary>
        /// <param name='strCondition'>条件(AND Code='11')</param>
        /// <returns>model</returns>
        public SD_Contract GetModel(string strCondition)
        {
            List <SD_Contract> list  = instance.GetListByWhere(strCondition);
            SD_Contract        model = new SD_Contract();

            if (list != null && list.Count > 0)
            {
                model = list[0];
            }
            else
            {
                model = null;
            }
            return(model);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name='model'>实体</param>
        /// <param name='model'>是否完成验证</param>
        /// <returns>bool</returns>
        public bool Insert(SD_Contract 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);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 逻辑删除数据
        /// </summary>
        /// <param name='model'>model</param>
        /// <returns>bool</returns>
        public bool Delete(string Condition)
        {
            bool result             = false;
            List <SD_Contract> list = instance.GetListByWhere(Condition);

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

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

            return(result);
        }
Ejemplo n.º 8
0
 public SD_Contract GetByKey(long Id)
 {
     SD_Contract model = new SD_Contract();
     model = instance.GetByKey(Id);
     return model;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Update(SD_Contract model)
 {
     bool result = false;
     int _rseult = instance.Update(model);
     if (_rseult > 0)
     {
         result = true;
     }
     return result;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 插入数据 并返回数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public long InsertWithReturnId(SD_Contract model)
 {
     long result = 0;
     object _result = instance.AddWithReturn(model);
     if (_result != null)
     {
         long.TryParse(_result.ToString(), out result);
     }
     return result;
 }
Ejemplo n.º 11
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Insert(SD_Contract model)
        {
            bool result = false;
            try
            {
                //instance.idb.BeginTransaction();
                int _result = instance.Add(model);
                if (_result > 0)
                {
                    result = true;
                }
            }
            catch (Exception)
            {
                //instance.idb.RollbackTransaction();
            }

            return result;
        }
Ejemplo n.º 12
0
 /// <summary>
 /// 获取实体数据
 /// </summary>
 /// <param name="strCondition"></param>
 /// <returns></returns>
 public SD_Contract GetModel(string strCondition)
 {
     List<SD_Contract> list = instance.GetListByWhere(strCondition);
     SD_Contract model = new SD_Contract();
     if (list != null && list.Count > 0)
     {
         model = list[0];
     }
     return model;
 }
Ejemplo n.º 13
0
        /// <summary>
        /// 获取实体数据
        /// </summary>
        /// <param name='strCondition'>条件(AND Code='11')</param>
        /// <returns>model</returns>
        public SD_Contract GetModel(int id)
        {
            SD_Contract model = instance.GetByKey(id);

            return(model);
        }