Example #1
0
 public int ManageDelete(Guid id)
 {
     using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
     {
         try
         {
             EnterpriseBLL enterpriseBLL = new EnterpriseBLL();
             #region 企业搬出
             BaseDb.Delete(id);
             //更新流程中的企业
             enterpriseBLL.MangeDelete(id);
             //new EnterpriseUpdateRecordBLL().MangeDeleteByEnterpriseID(id);变更记录不需要删。
             new EnterpriseTaxBLL().ManageDeleteByEnterpriseID(id);
             #endregion
             scope.Complete();
         }
         catch (Exception ex)
         {
             string       path = "D://log.txt";
             StreamWriter mySw = File.AppendText(path);
             mySw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " EnterpriseAndEnterpriseTaxBLL.ManageDelete:" + ex.Message);
             //关闭日志文件
             mySw.Close();
             return(0);
         }
     }
     return(1);
 }
Example #2
0
 public int ManageAdd(RoadFlow.Data.Model.EnterpriseModel model)
 {
     using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
     {
         try
         {
             EnterpriseBLL enterpriseBLL = new EnterpriseBLL();
             #region 添加企业
             //添加流程中的企业
             enterpriseBLL.MangeAdd(model);
             //添加组合企业
             model.State = null;
             BaseDb.Add(model);
             #endregion
             scope.Complete();
         }
         catch (Exception ex)
         {
             return(0);
         }
     }
     return(1);
 }
Example #3
0
        /// <summary>
        /// 管理员直接更改。
        /// </summary>
        /// <returns></returns>
        public int ManageUpdate(RoadFlow.Data.Model.EnterpriseModel model, Guid id)
        {
            using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
            {
                try
                {
                    EnterpriseBLL enterpriseBLL = new EnterpriseBLL();
                    #region 更新企业
                    enterpriseBLL.MangeUpdate(model, id);

                    model.UpdateTime = DateTime.Now;
                    BaseDb.Update(model, new KeyValuePair <string, object>("ID", id));
                    #endregion
                    scope.Complete();
                }
                catch (Exception ex)
                {
                    //更新失败。
                    return(0);
                }
            }
            return(1);
        }