/// <summary>
 /// 数据获取
 /// </summary>
 public void GetData()
 {
     try
     {
         List <AMS_SlipCustomerModel> modellist = AMS_SlipCustomerBLL.GetSlipCustomerList();
         _SlipCustomerList.Clear();
         foreach (AMS_SlipCustomerModel model in modellist)
         {
             SlipCustomerInfoViewModel SlipVM = new SlipCustomerInfoViewModel();
             SlipVM.Id              = model.Id;
             SlipVM.EffectDate      = model.EffectDate;
             SlipVM.EndDate         = model.EndDate;
             SlipVM.Number          = model.Number;
             SlipVM.IsPrint         = model.IsPrint;
             SlipVM.SlipTemplateXML = model.SlipTemplate;
             _SlipCustomerList.Add(SlipVM);
         }
     }
     catch
     {
         throw;
     }
 }
 /// <summary>
 /// 保存
 /// </summary>
 public bool AddSC()
 {
     try
     {
         if (string.IsNullOrEmpty(_Number) || _ImageUrl == null || _CustomerImage == null)
         {
             throw new Exception("信息填写不完整!");
         }
         else
         {
             if (_IsPrint && (string.IsNullOrEmpty(_SlipTemplate.MainTitleName) || string.IsNullOrEmpty(_SlipTemplate.PreferentialInfo) || string.IsNullOrEmpty(_SlipTemplate.CustomerInfo)))
             {
                 throw new Exception("信息填写不完整!");
             }
             else
             {
                 AMS_SlipCustomerModel samemodel = AMS_SlipCustomerBLL.GetSlipCustomerByNum(_Number);
                 if (samemodel != null)
                 {
                     throw new Exception("已存在相同的编号!");
                 }
                 AMS_SlipCustomerModel model = new AMS_SlipCustomerModel();
                 model.Number     = _Number;
                 model.EffectDate = _EffectDate.Date;
                 model.EndDate    = _EndDate.Date;
                 model.IsPrint    = _IsPrint;
                 model.ImageUrl   = _Number + "_" + _ImageUrl.UriSource.LocalPath.Substring(_ImageUrl.UriSource.LocalPath.LastIndexOf("\\") + 1);
                 if (_IsPrint)
                 {
                     model.SlipTemplate = _SlipTemplate.ToXml(_Number);
                 }
                 model.CustomerImage = _Number + "_" + _CustomerImage.UriSource.LocalPath.Substring(_CustomerImage.UriSource.LocalPath.LastIndexOf("\\") + 1);
                 FileOperate fo = new FileOperate();
                 if (!fo.UpdateFile(_CustomerImage.UriSource.LocalPath, model.CustomerImage, SeatManage.EnumType.SeatManageSubsystem.SlipCustomer))
                 {
                     throw new Exception("Logo上传失败!");
                 }
                 if (!fo.UpdateFile(_ImageUrl.UriSource.LocalPath, model.ImageUrl, SeatManage.EnumType.SeatManageSubsystem.SlipCustomer))
                 {
                     throw new Exception("图片上传失败!");
                 }
                 if (_IsPrint)
                 {
                     if (_SlipTemplate.LogoImage != null && !fo.UpdateFile(_SlipTemplate.LogoImage.UriSource.LocalPath, _Number + "_" + _SlipTemplate.LogoImage.UriSource.LocalPath.Substring(_SlipTemplate.LogoImage.UriSource.LocalPath.LastIndexOf("\\") + 1), SeatManage.EnumType.SeatManageSubsystem.SlipCustomer))
                     {
                         throw new Exception("凭条Logo上传失败!");
                     }
                     if (!fo.UpdateFile(_SlipTemplate.JuneberryLogo.UriSource.LocalPath, "南京智佰闻欣logo.png", SeatManage.EnumType.SeatManageSubsystem.SlipCustomer))
                     {
                         throw new Exception("公司logo上传失败!");
                     }
                 }
                 if (AMS_SlipCustomerBLL.AddSlipCustomer(model) == AdvertManage.Model.Enum.HandleResult.Failed)
                 {
                     throw new Exception("优惠劵保存失败!详情请查看日志文件!");
                 }
                 return(true);
             }
         }
     }
     catch (Exception ex)
     {
         System.Windows.Forms.MessageBox.Show(ex.Message);
         return(false);
     }
 }