public void Insert(int? AdsID,decimal? OrderSumLimit,decimal? AdsPoint)
        {
            SysCompanyAdsPointSetting item = new SysCompanyAdsPointSetting();

            item.AdsID = AdsID;

            item.OrderSumLimit = OrderSumLimit;

            item.AdsPoint = AdsPoint;

            item.Save(UserName);
        }
示例#2
0
 void pointGrid_OnBeforSave(SysCompanyAdsPointSetting item, out string message)
 {
     message = string.Empty;
     if (!item.AdsPoint.HasValue || item.AdsPoint <= 0)
         message = "奖励积分必须大于零";
     //if (!item.OrderSumLimit.HasValue || item.OrderSumLimit < 0)
     //    message = "上月消费限额必须大于零";
     if (item.IsNew)
         item.AdsID = (formView.SavedItem as SysCompanyAd).AdsID;
 }
        public void Update(int Id,int? AdsID,decimal? OrderSumLimit,decimal? AdsPoint)
        {
            SysCompanyAdsPointSetting item = new SysCompanyAdsPointSetting();
            item.MarkOld();
            item.IsLoaded = true;

            item.Id = Id;

            item.AdsID = AdsID;

            item.OrderSumLimit = OrderSumLimit;

            item.AdsPoint = AdsPoint;

            item.Save(UserName);
        }
示例#4
0
 public bool SaveCompanyAdForClient(DataTable dtCompanyAd, DataTable dtPointSetting, byte[] fileData, string fileName, out int adsID, out string message)
 {
     message = string.Empty;
     adsID = 0;
     TransactionScope ts = new TransactionScope();
     SharedDbConnectionScope ss = new SharedDbConnectionScope();
     try
     {
         SysCompanyAd ad = SubSonic.Utilities.EntityFormat.TableToEntity<SysCompanyAd>(dtCompanyAd);
         //SysCompanyAdsPointSetting point = SubSonic.Utilities.EntityFormat.TableToEntity<SysCompanyAdsPointSetting>(dtPointSetting);
         //SysCompanyAdsClickSetting click = SubSonic.Utilities.EntityFormat.TableToEntity<SysCompanyAdsClickSetting>(dtClickSetting);
         if (ad == null || dtPointSetting == null)
         {
             message = "参数异常";
             return false;
         }
         if (dtPointSetting.Rows.Count == 0)
         {
             message = "奖励设置的行数为零";
             return false;
         }
         ad.ValidateWhenSaving = false;
         ad.AdsDate = DateTime.Now;
         ad.AdsPic = null;
         ad.MarkNew();
         ad.Save();
         adsID = ad.AdsID;
         if (fileData != null && fileData.Length > 0 && !string.IsNullOrEmpty(fileName))
         {
             var result = FileUpload.SaveUploadFile(fileData, FileType.Image, SaveType.CompanyAds, fileName, out message, true, adsID.ToString( ));
             ad.AdsPic = result != null ? result.RelPath : string.Empty;
             ad.Save();
         }
         foreach (DataRow row in dtPointSetting.Rows)
         {
             SysCompanyAdsPointSetting p = new SysCompanyAdsPointSetting();
             p.AdsID = ad.AdsID;
             p.OrderSumLimit = Utilities.ToDecimal(row[0]);
             p.AdsPoint = Utilities.ToDecimal(row[1]);
             p.ValidateWhenSaving = false;
             p.Save();
         }
         ts.Complete();
         message = "保存成功";
         return true;
     }
     catch (Exception ex)
     {
         Logging.Log("WebRestService->SaveCompanyAdForClient", ex, true);
         message = ex.Message;
         return false;
     }
     finally
     {
         ss.Dispose();
         ts.Dispose();
     }
 }