public int InsertCharge(ChargeEntity entity)
        {
            CustomDataCommand command = DataCommandManager.CreateCustomDataCommandFromConfig("InsertCharge");
            command.SetParameterValue("@Title", entity.Title);
            command.SetParameterValue("@Remark", entity.Remark);
            command.SetParameterValue("@Content", entity.Content);
            command.SetParameterValue("@Field1", entity.Field1);
            command.SetParameterValue("@Field2", entity.Field2);
            command.SetParameterValue("@Field3", entity.Field3);
            command.SetParameterValue("@Field4", entity.Field4);
            command.SetParameterValue("@Field5", entity.Field5);
            command.SetParameterValue("@Status", entity.Status);
            command.SetParameterValue("@InUser", entity.InUser);
            command.SetParameterValue("@InDate", entity.InDate);

            object obj = command.ExecuteScalar();
            if (obj != null)
            {
                int result = Convert.ToInt32(obj);
                if (result > 0)
                {
                    entity.Files.ForEach(x =>
                    {
                        x.FSysNo = result;
                        new FilesDataAccess().InsertFiles(x);
                    });
                }
                return Convert.ToInt32(obj);
            }
            else
                return 0;
        }
 public int Update(ChargeEntity entity)
 {
     if (entity.Files != null && entity.Files.Count > 0)
     {
         entity.Files.ForEach(x =>
         {
             x.InDate = DateTime.Now;
             x.InUser = WebContext.LoginUser.UserName;
             x.FSysNo = entity.SysNo;
         });
     }
     return ChargeFacade.UpdateCharge(entity);
 }
 public int Insert(ChargeEntity entity)
 {
     entity.InDate = DateTime.Now;
     entity.InUser = WebContext.LoginUser.UserName;
     if (entity.Files != null && entity.Files.Count > 0)
     {
         entity.Files.ForEach(x =>
         {
             x.InDate = DateTime.Now;
             x.InUser = WebContext.LoginUser.UserName;
         });
     }
     return ChargeFacade.InsertCharge(entity);
 }
 public int UpdateCharge(ChargeEntity entity)
 {
     CustomDataCommand command = DataCommandManager.CreateCustomDataCommandFromConfig("UpdateCharge");
     command.SetParameterValue("@SysNo", entity.SysNo);
     command.SetParameterValue("@Title", entity.Title);
     command.SetParameterValue("@Remark", entity.Remark);
     command.SetParameterValue("@Content", entity.Content);
     command.SetParameterValue("@Field1", entity.Field1);
     command.SetParameterValue("@Field2", entity.Field2);
     command.SetParameterValue("@Field3", entity.Field3);
     command.SetParameterValue("@Field4", entity.Field4);
     command.SetParameterValue("@Field5", entity.Field5);
     command.SetParameterValue("@Status", entity.Status);
     command.SetParameterValue("@InUser", entity.InUser);
     command.SetParameterValue("@InDate", entity.InDate);
     int result = command.ExecuteNonQuery();
     if (result > 0)
     {
         FilesDataAccess fda = new FilesDataAccess();
         fda.DeleteFilesByFSysNo(entity.SysNo);
         entity.Files.ForEach(x =>
         {
             new FilesDataAccess().InsertFiles(x);
         });
     }
     return result;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="log"></param>
 public static int UpdateCharge(ChargeEntity entity)
 {
     return RestClient.Post<int>("ChargeService/UpdateCharge", entity);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="log"></param>
 public static int InsertCharge(ChargeEntity entity)
 {
     return RestClient.Post<int>("ChargeService/InsertCharge", entity);
 }
 public int UpdateCharge(ChargeEntity entity)
 {
     return ObjectFactory<IChargeDataAccess>.Instance.UpdateCharge(entity);
 }