示例#1
0
 public Model.Enum.HandleResult AddSlipPrintInfo(List <Model.View_SlipPrintInfo> model)
 {
     try
     {
         foreach (Model.View_SlipPrintInfo models in model)
         {
             Model.AMS_Campus       campusModel  = GetSingleCampusInfo(models.SchoolNumber, false);
             Model.AMS_SlipCustomer slipCustomer = GetSlipCustomerByNum(models.SlipCustomerNum);
             if (slipCustomer != null)
             {
                 models.CampusId       = campusModel.Id;
                 models.SlipCustomerId = slipCustomer.Id;
                 Model.AMS_SlipPrintInfo addmodel = new Model.AMS_SlipPrintInfo
                 {
                     SlipCustomerId = models.SlipCustomerId,
                     Date           = models.Date,
                     CampusId       = models.CampusId,
                     LookOverAmount = models.LookOverAmount,
                     PrintAmount    = models.PrintAmount
                 };
                 SlipPrintDal.Add(addmodel);
             }
         }
         return(HandleResult.Successed);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 /// <summary>
 /// model转换
 /// </summary>
 /// <param name="dr"></param>
 /// <returns></returns>
 private AMS.Model.AMS_SlipCustomer DataRowToAMS_SlipCustomerModel(DataRow dr)
 {
     //CustomerNo,CompanyName,CustomerLinkWay,CustomerDescribe,Id,Number,SlipName,ImageUrl
     //SlipTemplate,CouponsXml,OperatorLonginId,OperatorPwd,OperatorBranchName
     //OperatorName,OperatorRemark,SlipCustomerDescribe,IsPrint,Type,EndDate
     //EffectDate,CampusNum,CustomerImage
     AMS.Model.AMS_SlipCustomer model = new Model.AMS_SlipCustomer();
     model.Id     = int.Parse(dr["Id"].ToString());
     model.Number = dr["Number"].ToString();
     if (dr.Table.Columns.Contains("CompanyName"))
     {
         model.CustomerName = dr["CompanyName"].ToString();
     }
     model.CustomerId    = Convert.ToInt32(dr["CustomerId"]);
     model.CustomerImage = dr["CustomerImage"].ToString();
     model.EffectDate    = DateTime.Parse(dr["EffectDate"].ToString());
     model.EndDate       = DateTime.Parse(dr["EndDate"].ToString());
     model.ImageUrl      = dr["ImageUrl"].ToString();
     if (dr["IsPrint"].ToString() == "0")
     {
         model.IsPrint = false;
     }
     else
     {
         model.IsPrint = true;
     }
     model.SlipName     = dr["SlipName"].ToString();
     model.SlipTemplate = dr["SlipTemplate"].ToString();
     if (dr.Table.Columns.Contains("OperatorName"))
     {
         model.OperatorName = dr["OperatorName"].ToString();
     }
     model.CampusNum = dr["CampusNum"].ToString();
     return(model);
 }
 public string DeleteSlipCustomer(Model.AMS_SlipCustomer model)
 {
     try
     {
         if (!dal_SlipCustomer.Delete(model.Id))
         {
             return("优惠券删除失败!");
         }
         return("");
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
 public Model.AMS_SlipCustomer GetSlipCustomerByNum(string Num)
 {
     try
     {
         Model.AMS_SlipCustomer modellist = new Model.AMS_SlipCustomer();
         string  sql = string.Format(" Number='{0}'", Num);
         DataSet ds  = dal_SlipCustomerView.GetList(sql);
         for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
             modellist = DataRowToAMS_SlipCustomerModel(ds.Tables[0].Rows[i]);
         }
         return(modellist);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public string UpdateSlipCustomer(Model.AMS_SlipCustomer model)
 {
     try
     {
         Model.AMS_SlipCustomer sameModel = dal_SlipCustomer.GetModel(model.Number);
         if (sameModel != null && sameModel.Id != model.Id)
         {
             return("优惠券编号重复!");
         }
         if (!dal_SlipCustomer.Update(model))
         {
             return("优惠券修改失败!");
         }
         return("");
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
 public string AddNewSlipCustomer(Model.AMS_SlipCustomer model)
 {
     try
     {
         Model.AMS_SlipCustomer sameModel = dal_SlipCustomer.GetModel(model.Number);
         if (sameModel != null)
         {
             return("优惠券编号重复!");
         }
         if (dal_SlipCustomer.Add(model) == 0)
         {
             return("优惠券添加失败!");
         }
         return("");
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
 public Model.AMS_SlipCustomer GetSlipCustomerById(int ID)
 {
     try
     {
         Model.AMS_SlipCustomer modellist = new Model.AMS_SlipCustomer();
         string  sql = string.Format(" ID={0}", ID);
         DataSet ds  = dal_SlipReleaseCampusView.GetList(sql);
         if (ds.Tables[0].Rows.Count < 1)
         {
             return(null);
         }
         for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
             modellist = DataRowToAMS_SlipReleaseCampusModel(ds.Tables[0].Rows[i]);
         }
         return(modellist);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#8
0
        /// <summary>
        /// 根据ID获取优惠券信息
        /// </summary>
        /// <returns></returns>
        public static bool GetSlipCustomer(int num)
        {
            //TODO:未测试
            try
            {
                Model.AMS_SlipCustomer       advertModel           = AMS.ServiceProxy.ISlipCustomerService.GetSlipCustomerByID(num);
                AMS.ServiceProxy.FileOperate advertfileOperate     = new AMS.ServiceProxy.FileOperate();
                SeatManage.Bll.FileOperate   seatmanagefileOperate = new SeatManage.Bll.FileOperate();
                if (advertModel != null)
                {
                    SeatManage.ClassModel.AMS_SlipCustomer seatModel = SeatManage.Bll.AMS_SlipCustomer.GetSlipCustomerByNum(advertModel.Number);
                    if (seatModel == null)
                    {
                        //优惠券在数据库中不存在:先执行下载操作,然后更新
                        string ImageUrlFullName = string.Format(@"{0}{1}", ServiceSet.TempFilePath, advertModel.ImageUrl);
                        try
                        {
                            advertfileOperate.FileDownLoad(ImageUrlFullName, advertModel.ImageUrl, SeatManage.EnumType.SeatManageSubsystem.SlipCustomer);
                        }
                        catch (Exception ex)
                        {
                            SeatManage.SeatManageComm.WriteLog.Write(string.Format("优惠券{0}下载失败:{1}", advertModel.Number, ex.Message));
                        }
                        try
                        {
                            if (seatmanagefileOperate.UpdateFile(ImageUrlFullName, advertModel.ImageUrl, SeatManage.EnumType.SeatManageSubsystem.SlipCustomer))
                            {
                                //上传完成,执行删除操作
                                File.Delete(ImageUrlFullName);
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        catch (Exception ex)
                        {
                            SeatManage.SeatManageComm.WriteLog.Write(string.Format("优惠券{0}上传失败:{1}", advertModel.Number, ex.Message));
                        }
                        string CustomerImagefullName = string.Format(@"{0}{1}", ServiceSet.TempFilePath, advertModel.CustomerImage);
                        advertfileOperate.FileDownLoad(CustomerImagefullName, advertModel.CustomerImage, SeatManage.EnumType.SeatManageSubsystem.SlipCustomer);
                        if (seatmanagefileOperate.UpdateFile(CustomerImagefullName, advertModel.CustomerImage, SeatManage.EnumType.SeatManageSubsystem.SlipCustomer))
                        {
                            File.Delete(CustomerImagefullName);
                        }
                        else
                        {
                            return(false);
                        }
                        if (Convert.ToBoolean(advertModel.IsPrint))
                        {
                            XmlDocument Templatedoc = new XmlDocument();
                            Templatedoc.LoadXml(advertModel.SlipTemplate);
                            XmlElement  Templateroot   = Templatedoc.DocumentElement;
                            XmlNodeList Templatexnlist = ((XmlNode)Templateroot).ChildNodes;
                            for (int j = 0; j < Templatexnlist.Count; j++)
                            {
                                if (Templatexnlist[j].Name == "Pic")
                                {
                                    try
                                    {
                                        advertfileOperate.FileDownLoad((ServiceSet.TempFilePath + Templatexnlist[j].InnerText), Templatexnlist[j].InnerText, SeatManage.EnumType.SeatManageSubsystem.SlipCustomer);
                                    }
                                    catch (Exception ex)
                                    {
                                        SeatManage.SeatManageComm.WriteLog.Write(string.Format("优惠券{0}下载失败:{1}", advertModel.Number, ex.Message));
                                    }
                                    try
                                    {
                                        if (seatmanagefileOperate.UpdateFile((ServiceSet.TempFilePath + Templatexnlist[j].InnerText), Templatexnlist[j].InnerText, SeatManage.EnumType.SeatManageSubsystem.SlipCustomer))
                                        {
                                            //上传完成,执行删除操作
                                            File.Delete(ServiceSet.TempFilePath + Templatexnlist[j].InnerText);
                                        }
                                        else
                                        {
                                            return(false);
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        SeatManage.SeatManageComm.WriteLog.Write(string.Format("优惠券{0}上传失败:{1}", advertModel.Number, ex.Message));
                                    }
                                }
                            }
                        }
                    }

                    if (seatModel != null && seatModel.CampusNum == advertModel.CampusNum)
                    {
                        //获取学校数据库中的优惠券。如果存在并且校区编号相同执行更新。
                        seatModel.CampusNum    = advertModel.CampusNum;
                        seatModel.CustomerLogo = advertModel.CustomerImage;
                        seatModel.EffectDate   = Convert.ToDateTime(advertModel.EffectDate);
                        seatModel.EndDate      = Convert.ToDateTime(advertModel.EndDate);
                        seatModel.ImageName    = advertModel.ImageUrl;
                        seatModel.No           = advertModel.Number;
                        seatModel.SlipTemplate = advertModel.SlipTemplate;
                        seatModel.IsPrint      = Convert.ToBoolean(advertModel.IsPrint);
                        SeatManage.Bll.AMS_SlipCustomer.UpdateSlipCustomer(seatModel);
                    }
                    else
                    {
                        seatModel              = new SeatManage.ClassModel.AMS_SlipCustomer();
                        seatModel.CampusNum    = advertModel.CampusNum;
                        seatModel.CustomerLogo = advertModel.CustomerImage;
                        seatModel.EffectDate   = Convert.ToDateTime(advertModel.EffectDate);
                        seatModel.EndDate      = Convert.ToDateTime(advertModel.EndDate);
                        seatModel.ImageName    = advertModel.ImageUrl;
                        seatModel.No           = advertModel.Number;
                        seatModel.SlipTemplate = advertModel.SlipTemplate;
                        seatModel.IsPrint      = Convert.ToBoolean(advertModel.IsPrint);
                        seatModel.Num          = advertModel.Number;
                        SeatManage.Bll.AMS_SlipCustomer.AddSlipCustomer(seatModel);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                SeatManage.SeatManageComm.WriteLog.Write(string.Format("获取优惠券客户失败:{0}", ex.Message));
                return(false);
            }
        }
        /// <summary>
        /// 获取命令明细列表
        /// </summary>
        /// <param name="schoolId"></param>
        /// <param name="commandType"></param>
        /// <param name="handleResult"></param>
        /// <returns></returns>
        public List <Model.AMS_CommandDetail> GetCommandDetailList(string schoolId, AMS.Model.Enum.CommandType commandType, AMS.Model.Enum.CommandHandleResult handleResult)
        {
            StringBuilder str = new StringBuilder();
            List <AMS.Model.AMS_CommandDetail> commandDetailList = new List <Model.AMS_CommandDetail>();
            List <Model.View_CommandList>      commandList       = GetCommandList(schoolId, commandType, handleResult);

            foreach (AMS.Model.View_CommandList cmdModel in commandList)
            {
                AMS.Model.AMS_CommandDetail cmd = new Model.AMS_CommandDetail();
                switch (cmdModel.Command)
                {
                case Model.Enum.CommandType.Caputre:
                    cmd.ContentDescribe = "获取截图";
                    cmd.ContentName     = "获取截图";
                    break;

                case Model.Enum.CommandType.HardAd:
                    Model.AMS_HardAd hardAd = Dal_HardAd.GetModelByNum(cmdModel.CommandId.Value);
                    cmd.ContentName     = hardAd.Name;
                    cmd.ContentDescribe = hardAd.Describe;
                    cmd.ContentNumber   = hardAd.Number;
                    cmd.ContentID       = hardAd.ID;
                    break;

                case Model.Enum.CommandType.Playlist:
                    if (dal_Playlist.GetList(string.Format(" id={0}", cmdModel.CommandId.Value)).Tables[0].Rows.Count > 0)
                    {
                        Model.AMS_PlayList playList = DataRowToAMS_PlayListModel(dal_PlaylistView.GetList(string.Format(" id={0}", cmdModel.CommandId.Value)).Tables[0].Rows[0]);
                        cmd.ContentName     = playList.PlayListName;
                        cmd.ContentDescribe = playList.Describe;
                        cmd.ContentNumber   = playList.Number;
                        cmd.ContentID       = playList.Id;
                    }
                    break;

                case Model.Enum.CommandType.PrintTemplate:
                    if (dal_PrintTemplateView.GetList(string.Format(" id={0}", cmdModel.CommandId.Value)).Tables[0].Rows.Count > 0)
                    {
                        Model.AMS_PrintTemplate printTemplate = DataRowToAMS_PrintTemplateModel(dal_PrintTemplateView.GetList(string.Format(" id={0}", cmdModel.CommandId.Value)).Tables[0].Rows[0]);
                        cmd.ContentName     = printTemplate.Name;
                        cmd.ContentNumber   = printTemplate.Number;
                        cmd.ContentDescribe = printTemplate.Describe;
                        cmd.ContentID       = printTemplate.Id;
                    }
                    break;

                case Model.Enum.CommandType.ProgramUpgrade:
                    if (dal_ProgramUpgrade.GetList(string.Format(" id={0}", cmdModel.CommandId.Value)).Tables[0].Rows.Count > 0)
                    {
                        Model.ProgramUpgrade program = DataRowToAMS_ProgramUpgradeListModel(dal_ProgramUpgrade.GetList(string.Format(" id={0}", cmdModel.CommandId.Value)).Tables[0].Rows[0]);
                        cmd.ContentName     = ((AMS.Model.Enum.SeatManageSubsystem)program.Application).ToString();
                        cmd.ContentDescribe = program.Remark;
                        cmd.ContentID       = program.Id;
                    }
                    break;

                case Model.Enum.CommandType.SlipCustomer:
                    if (dal_SlipCustomer.GetList(string.Format(" id={0}", cmdModel.CommandId.Value)).Tables[0].Rows.Count > 0)
                    {
                        Model.AMS_SlipCustomer slipcustomer = DataRowToAMS_SlipCustomerModel(dal_SlipCustomerView.GetList(string.Format(" id={0}", cmdModel.CommandId.Value)).Tables[0].Rows[0]);
                        cmd.ContentName     = slipcustomer.SlipName;
                        cmd.ContentNumber   = slipcustomer.Number;
                        cmd.ContentDescribe = slipcustomer.Describe;
                        cmd.ContentID       = slipcustomer.Id;
                    }
                    break;

                case Model.Enum.CommandType.TitleAd:
                    if (Dal_TitleAd.GetList(string.Format(" id={0}", cmdModel.CommandId.Value)).Tables[0].Rows.Count > 0)
                    {
                        Model.AMS_TitleAd titleAd = DataRowToAMS_TitleAd(Dal_TitleAd.GetList(string.Format(" id={0}", cmdModel.CommandId.Value)).Tables[0].Rows[0]);
                        cmd.ContentName   = titleAd.Name;
                        cmd.ContentNumber = titleAd.Num;
                        cmd.ContentID     = titleAd.Id;
                    }
                    break;

                case Model.Enum.CommandType.RollTitles:
                    if (dal.GetModel(string.Format(" id={0}", cmdModel.CommandId.Value)).Tables[0].Rows.Count > 0)
                    {
                        Model.AMS_RollTitles titleAd = DataRowToAMS_RollTitles(dal.GetModel(string.Format(" id={0}", cmdModel.CommandId.Value)).Tables[0].Rows[0]);
                        cmd.ContentName   = titleAd.Name;
                        cmd.ContentNumber = titleAd.Num;
                        cmd.ContentID     = titleAd.ID;
                    }
                    break;
                }

                cmd.Command                = cmdModel.Command;
                cmd.FinishFlag             = cmdModel.FinishFlag;
                cmd.FinishTime             = cmdModel.FinishTime;
                cmd.ID                     = cmdModel.ID;
                cmd.OperatorBranchName     = cmdModel.OperatorBranchName;
                cmd.OperatorLoginId        = cmdModel.OperatorLoginId;
                cmd.OperatorPwd            = cmdModel.OperatorPwd;
                cmd.OperatorRemark         = cmdModel.OperatorRemark;
                cmd.OperatorName           = cmdModel.OperatorName;
                cmd.ReleaseTime            = cmdModel.ReleaseTime;
                cmd.SchoolAddress          = cmdModel.SchoolAddress;
                cmd.SchoolCardInfo         = cmdModel.SchoolCardInfo;
                cmd.SchoolConnectionString = cmdModel.SchoolConnectionString;
                cmd.SchoolDescribe         = cmdModel.SchoolDTUip;
                cmd.SchoolInterfaceInfo    = cmdModel.SchoolInterfaceInfo;
                cmd.SchoolLinkMan          = cmdModel.SchoolLinkMan;
                cmd.SchoolName             = cmdModel.SchoolName;
                cmd.SchoolNum              = cmdModel.SchoolNum;
                cmd.SchoolProvince         = cmdModel.SchoolProvince;
                commandDetailList.Add(cmd);
            }

            return(commandDetailList);
        }