示例#1
0
        /// <summary>
        /// 保存按钮点击事件执行方法
        /// </summary>
        protected string PageSave(string doType, string id)
        {
            string msg = string.Empty;
            //t为false为编辑,true时为新增
            bool t = String.Equals(doType, "update", StringComparison.InvariantCultureIgnoreCase) && !string.IsNullOrEmpty(id) ? false : true;
            //联系人
            string address = Utils.GetFormValue(this.txtaddress.UniqueID);
            //合同开始时间
            string ContractStartDate = Utils.GetFormValue(this.txtContractDate_Start.UniqueID);
            //合同有到期时间
            string ContractDate = Utils.GetFormValue(this.txtContractDate.UniqueID);
            string ContactNum   = Utils.GetFormValue(this.txtContractNum.UniqueID);
            string PriceSystem  = Utils.GetFormValue(this.txtPriceSystem.UniqueID);
            string UnitPolicy   = Utils.GetFormValue(this.txtUnitPolicy.UniqueID);
            //轮船公司
            string CruiseCompany = Utils.GetFormValue(this.txtCruiseCompany.UniqueID);
            //船载电话
            string CruiseTel = Utils.GetFormValue(this.txtCruiseTel.UniqueID);
            //游轮景点
            string Scenic = Utils.GetFormValue(this.txtRoutes.UniqueID);
            //自费景点
            string OwerRoutes = Utils.GetFormValue(this.txtOwerRoutes.UniqueID);
            //开始时间
            string StarTime = Utils.GetFormValue(this.txtstarttime.UniqueID);
            //结束时间
            string EndTime = Utils.GetFormValue(this.txtendtime.UniqueID);

            if (String.IsNullOrEmpty(CruiseCompany))
            {
                msg = "{\"result\":\"0\",\"msg\":\"游轮公司不能为空!\"}";
                return(msg);
            }

            EyouSoft.BLL.SourceStructure.BSource            Bll     = new EyouSoft.BLL.SourceStructure.BSource();
            EyouSoft.Model.SourceStructure.MSourceShip      model   = new MSourceShip();
            EyouSoft.Model.SourceStructure.MSource          mModel  = new EyouSoft.Model.SourceStructure.MSource();
            IList <EyouSoft.Model.CrmStructure.MCrmLinkman> linkman = new List <EyouSoft.Model.CrmStructure.MCrmLinkman>();
            string userid = string.Empty;

            if (!string.IsNullOrEmpty(id))
            {
                model  = new EyouSoft.BLL.SourceStructure.BSource().GetShipModel(id);
                userid = model.SourceModel.UserId;
            }
            mModel.CityId     = Utils.GetInt(Utils.GetFormValue(this.ddlCity.UniqueID));
            mModel.CountryId  = Utils.GetInt(Utils.GetFormValue(this.ddlCountry.UniqueID));
            mModel.CountyId   = Utils.GetInt(Utils.GetFormValue(this.ddlArea.UniqueID));
            mModel.ProvinceId = Utils.GetInt(Utils.GetFormValue(this.ddlProvince.UniqueID));
            //合同附件(新)
            string[] visaUpload    = Utils.GetFormValues(this.UploadControl1.ClientHideID);
            string[] oldVisaUpload = Utils.GetFormValues("hideFileInfo");
            #region 合同附件
            EyouSoft.Model.ComStructure.MComAttach visaModel = new EyouSoft.Model.ComStructure.MComAttach();
            if (oldVisaUpload.Length > 0)
            {
                for (int i = 0; i < oldVisaUpload.Length; i++)
                {
                    visaModel.FilePath = oldVisaUpload[i].Split('|')[1];
                    visaModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.供应商合同附件;
                    visaModel.Name     = oldVisaUpload[i].Split('|')[0];
                    visaModel.Size     = 0;
                }
            }
            if (visaUpload.Length > 0)
            {
                for (int i = 0; i < visaUpload.Length; i++)
                {
                    if (visaUpload[i].Trim() != "")
                    {
                        if (visaUpload[i].Split('|').Length > 1)
                        {
                            visaModel.Downloads = 0;
                            visaModel.FilePath  = visaUpload[i].Split('|')[1];
                            visaModel.ItemType  = EyouSoft.Model.EnumType.ComStructure.AttachItemType.供应商合同附件;
                            visaModel.Name      = visaUpload[i].Split('|')[0];
                            visaModel.Size      = 0;
                        }
                    }
                }
            }
            #endregion
            mModel.Address             = address;
            mModel.ContractPeriodStart = String.IsNullOrEmpty(ContractStartDate) ? null : (DateTime?)DateTime.Parse(ContractStartDate);
            mModel.ContractPeriodEnd   = String.IsNullOrEmpty(ContractDate) ? null : (DateTime?)DateTime.Parse(ContractDate);
            mModel.ContractAttach      = visaModel;
            model.PriceSystem          = PriceSystem;
            mModel.UnitPolicy          = UnitPolicy;
            mModel.LastModifierId      = this.SiteUserInfo.Name;
            mModel.LastModifyTime      = DateTime.Now;
            mModel.CompanyId           = this.SiteUserInfo.CompanyId;
            mModel.OperatorId          = this.SiteUserInfo.UserId;
            mModel.DeptId       = this.SiteUserInfo.DeptId;
            mModel.IssueTime    = DateTime.Now;
            mModel.IsCommission = true;
            //是否签单
            mModel.IsPermission = false;
            if (RadSign_yes.Checked)
            {
                mModel.IsPermission = true;
            }
            //是否返佣
            mModel.IsCommission = false;
            if (radyes.Checked)
            {
                mModel.IsCommission = true;
            }
            //是否推荐
            mModel.IsRecommend = false;
            if (RadRecommend_yes.Checked)
            {
                mModel.IsRecommend = true;
            }
            //是否签订合同
            mModel.IsSignContract = false;
            if (Radio_hd_yes.Checked)
            {
                mModel.IsSignContract = true;
                mModel.ContractCode   = Utils.GetFormValue(this.txtContractNum.UniqueID);
            }
            if (!String.IsNullOrEmpty(id))
            {
                model.SourceModel.SourceId = id;
            }
            model.OwerRoutes = OwerRoutes;
            model.Routes     = Scenic;

            model.StartTime = string.IsNullOrEmpty(StarTime) ? null : (DateTime?)Convert.ToDateTime(StarTime);


            model.EndTime = string.IsNullOrEmpty(StarTime) ? null : (DateTime?)Convert.ToDateTime(StarTime);

            model.Telephone   = CruiseTel;
            model.LinkManList = UtilsCommons.GetDataList();
            model.SubShipList = this.GetDataList();
            mModel.UserId     = userid;
            mModel.Name       = CruiseCompany.Trim();
            model.SourceModel = mModel;

            int result = 0;
            if (t)
            {//新增
                result = Bll.AddShipModel(model);
                if (result == -1)
                {
                    msg = "{\"result\":\"0\",\"msg\":\"游轮名称已存在!\"}";
                    return(msg);
                }
            }
            else
            { //编辑
                result = Bll.UpdateShipModel(model);
                if (result == -1)
                {
                    msg = "{\"result\":\"0\",\"msg\":\"游轮名称已存在!\"}";
                    return(msg);
                }
            }
            string type = t ? "新增" : "修改";
            if (result > 0)
            {
                msg = "{\"result\":\"1\",\"msg\":\"" + type + "成功!\"}";
                return(msg);
            }
            else
            {
                msg = "{\"result\":\"0\",\"msg\":\"" + type + "失败!\"}";
                return(msg);
            }
        }
示例#2
0
        /// <summary>
        /// 保存按钮点击事件执行方法
        /// </summary>
        protected string PageSave(string doType, string id)
        {
            string msg = string.Empty;

            if (String.IsNullOrEmpty(Utils.GetFormValue(txtteamName.UniqueID)))
            {
                msg = "{\"result\":\"0\",\"msg\":\"车队名称不能为空!\"}";
                return(msg);
            }
            //t为false为编辑,true时为新增
            bool t = String.Equals(doType, "update", StringComparison.InvariantCultureIgnoreCase) && !string.IsNullOrEmpty(id) ? false : true;

            EyouSoft.BLL.SourceStructure.BSource Bll = new EyouSoft.BLL.SourceStructure.BSource();
            MSourceMotorcade model = new MSourceMotorcade();

            EyouSoft.Model.SourceStructure.MSource            mModel  = new EyouSoft.Model.SourceStructure.MSource();
            IList <EyouSoft.Model.SourceStructure.MSourceCar> carlist = GetDataList();

            if (!string.IsNullOrEmpty(Utils.GetQueryStringValue("id")))
            {
                model = new EyouSoft.BLL.SourceStructure.BSource().GetMotorcadeModel(Utils.GetQueryStringValue("id"));
            }
            //合同附件(新)
            string[] visaUpload    = Utils.GetFormValues(this.UploadControl1.ClientHideID);
            string[] oldVisaUpload = Utils.GetFormValues("hideFileInfo");
            #region 合同附件
            EyouSoft.Model.ComStructure.MComAttach visaModel = new EyouSoft.Model.ComStructure.MComAttach();

            if (oldVisaUpload.Length > 0)
            {
                for (int i = 0; i < oldVisaUpload.Length; i++)
                {
                    visaModel.FilePath = oldVisaUpload[i].Split('|')[1];
                    visaModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.供应商合同附件;
                    visaModel.Name     = oldVisaUpload[i].Split('|')[0];
                    visaModel.Size     = 0;
                }
            }
            if (visaUpload.Length > 0)
            {
                for (int i = 0; i < visaUpload.Length; i++)
                {
                    if (visaUpload[i].Trim() != "")
                    {
                        if (visaUpload[i].Split('|').Length > 1)
                        {
                            visaModel.Downloads = 0;
                            visaModel.FilePath  = visaUpload[i].Split('|')[1];
                            visaModel.ItemType  = EyouSoft.Model.EnumType.ComStructure.AttachItemType.供应商合同附件;
                            visaModel.Name      = visaUpload[i].Split('|')[0];
                            visaModel.Size      = 0;
                        }
                    }
                }
            }

            #endregion

            mModel.ContractAttach                 = visaModel;
            mModel.Name                           = Utils.GetFormValue(txtteamName.UniqueID).Trim();
            mModel.Remark                         = Utils.GetFormValue(txtRemark.UniqueID);
            mModel.Address                        = Utils.GetFormValue(this.address.UniqueID);
            model.SourceModel                     = mModel;
            model.SourceModel.CountryId           = Utils.GetInt(Utils.GetFormValue(this.ddlCountry.UniqueID));
            model.SourceModel.ProvinceId          = Utils.GetInt(Utils.GetFormValue(this.ddlProvice.UniqueID));
            model.SourceModel.CityId              = Utils.GetInt(Utils.GetFormValue(this.ddlCity.UniqueID));
            model.SourceModel.CountyId            = Utils.GetInt(Utils.GetFormValue(this.ddlArea.UniqueID));
            model.SourceModel.LastModifierId      = this.SiteUserInfo.Name;
            model.SourceModel.LastModifyTime      = DateTime.Now;
            model.SourceModel.ContractPeriodStart = EyouSoft.Common.Utils.GetDateTimeNullable(Utils.GetFormValue(txtContractDate_Start.UniqueID));
            model.SourceModel.ContractPeriodEnd   = EyouSoft.Common.Utils.GetDateTimeNullable(Utils.GetFormValue(txtContractDate.UniqueID));
            //获取车辆信息
            model.CarList = carlist;
            //获取联系人信息
            model.LinkManList           = UtilsCommons.GetDataList();
            model.SourceModel.CompanyId = this.SiteUserInfo.CompanyId;
            model.SourceModel.IssueTime = DateTime.Now;
            if (!String.IsNullOrEmpty(id))
            {
                model.SourceModel.SourceId = id;
            }
            //是否返佣
            model.SourceModel.IsCommission = false;
            if (this.RadioButton1.Checked)
            {
                model.SourceModel.IsCommission = true;
            }
            //是否签单
            model.SourceModel.IsPermission = false;
            if (this.radyes.Checked)
            {
                model.SourceModel.IsPermission = true;
            }
            //是否推荐
            model.SourceModel.IsRecommend = false;
            if (radRecommendyes.Checked)
            {
                model.SourceModel.IsRecommend = true;
            }
            //是否签订合同
            model.SourceModel.IsSignContract = false;
            if (Radio_hd_yes.Checked)
            {
                model.SourceModel.IsSignContract = true;
                model.SourceModel.ContractCode   = Utils.GetFormValue(this.txtContractNum.UniqueID);
            }

            model.SourceModel.OperatorId = this.SiteUserInfo.UserId;
            int result = 0;
            if (t)
            {//新增
                result = Bll.AddMotorcadeModel(model);
                if (result == -1)
                {
                    msg = "{\"result\":\"0\",\"msg\":\"车辆名已存在!\"}";
                    return(msg);
                }
            }
            else
            { //编辑
                result = Bll.UpdateMotorcadeModel(model);
                if (result == -1)
                {
                    msg = "{\"result\":\"0\",\"msg\":\"车辆名已存在!\"}";
                    return(msg);
                }
            }
            string type = t ? "新增" : "修改";
            if (result > 0)
            {
                msg = "{\"result\":\"1\",\"msg\":\"" + type + "成功!\"}";
                return(msg);
            }
            else
            {
                msg = "{\"result\":\"0\",\"msg\":\"" + type + "失败!\"}";
                return(msg);
            }
        }
示例#3
0
        /// <summary>
        /// 保存按钮点击事件执行方法
        /// </summary>
        private string PageSave(string doType, string id)
        {
            string msg = string.Empty;
            //t为false为编辑,true时为新增
            bool t = String.Equals(doType, "update", StringComparison.InvariantCultureIgnoreCase) && !string.IsNullOrEmpty(id) ? false : true;

            //国家
            #region 表单取值
            string country = Utils.GetFormValue(this.ddlCountry.UniqueID);
            //省份
            string provice = Utils.GetFormValue(this.ddlProvice.UniqueID);
            //城市
            string city = Utils.GetFormValue(this.ddlCity.UniqueID);
            //县区
            string area = Utils.GetFormValue(this.ddlArea.UniqueID);
            //地址
            string address = Utils.GetFormValue(this.txtaddress.UniqueID);
            //单位名称
            string UnitName = Utils.GetFormValue(this.txtUnitName.UniqueID);
            //线路特色
            string Character = Utils.GetFormValue(this.txtCharacter.UniqueID);
            //合同开始时间
            string ContractStartDate = Utils.GetFormValue(this.txtContractDate_Start.UniqueID);
            //合同有到期时间
            string ContractDate = Utils.GetFormValue(this.txtContractDate.UniqueID);
            //合同号
            string ContractNum = Utils.GetFormValue(this.txtContractNum.UniqueID);
            //法人代表
            string LegalName = Utils.GetFormValue(this.txtLegalName.UniqueID);
            //许可证号
            string PermitNum = Utils.GetFormValue(this.txtPermitNum.UniqueID);
            //返佣政策
            string Policy = Utils.GetFormValue(this.txtpolicy.UniqueID);
            //联系电话
            string Tel = Utils.GetFormValue(this.txtTel.UniqueID);
            //合同附件(新)
            string[] visaUpload    = Utils.GetFormValues(this.UploadControl1.ClientHideID);
            string[] oldVisaUpload = Utils.GetFormValues("hideFileInfo");
            #endregion

            EyouSoft.Model.CrmStructure.MCrmLinkman m = new EyouSoft.Model.CrmStructure.MCrmLinkman();
            MComUser mUser = new MComUser();
            IList <EyouSoft.Model.CrmStructure.MCrmLinkman> list = UtilsCommons.GetDataList();
            if (list != null && list.Count > 0)
            {
                mUser.ContactMobile = list[0].MobilePhone;
                mUser.ContactName   = list[0].Name;
                mUser.ContactTel    = list[0].Telephone;
                mUser.QQ            = list[0].QQ;
                m.Post = list[0].Post;
            }
            if (string.IsNullOrEmpty(UnitName))
            {
                msg = "{\"result\":\"0\",\"msg\":\"单位名称不能为空!\"}";
                return(msg);
            }
            EyouSoft.Model.SourceStructure.MSourceTravel mTravel = new EyouSoft.Model.SourceStructure.MSourceTravel();
            if (!string.IsNullOrEmpty(id))
            {
                mTravel = new EyouSoft.BLL.SourceStructure.BSource().GetTravelServiceModel(id);
            }
            EyouSoft.Model.SourceStructure.MSource mModel = new EyouSoft.Model.SourceStructure.MSource();
            mModel.Address      = this.txtaddress.Text;
            mModel.CityId       = Utils.GetInt(Utils.GetFormValue(this.ddlCity.UniqueID));
            mModel.CountryId    = Utils.GetInt(Utils.GetFormValue(this.ddlCountry.UniqueID));
            mModel.CountyId     = Utils.GetInt(Utils.GetFormValue(this.ddlArea.UniqueID));
            mModel.ProvinceId   = Utils.GetInt(Utils.GetFormValue(this.ddlProvice.UniqueID));
            mModel.Name         = Utils.GetFormValue(this.txtUnitName.UniqueID).Trim();
            mModel.CompanyId    = this.SiteUserInfo.CompanyId;
            mModel.OperatorId   = this.SiteUserInfo.UserId;
            mModel.ContractCode = ContractNum;
            mModel.DeptId       = this.SiteUserInfo.DeptId;

            mModel.ContractPeriodStart = String.IsNullOrEmpty(ContractStartDate) ? null : (DateTime?)DateTime.Parse(ContractStartDate);
            mModel.ContractPeriodEnd   = String.IsNullOrEmpty(ContractDate) ? null : (DateTime?)DateTime.Parse(ContractDate);

            //签单
            if (RadSign_no.Checked)
            {
                mModel.IsPermission = false;
            }
            else
            {
                mModel.IsPermission = true;
            }
            //推荐
            if (RadRecommend_no.Checked)
            {
                mModel.IsRecommend = false;
            }
            else
            {
                mModel.IsRecommend = true;
            }
            //返佣
            mModel.IsCommission = true;
            if (radno.Checked)
            {
                mModel.IsCommission = false;
            }
            //合同
            if (Radio_hd_no.Checked)
            {
                mModel.IsSignContract = false;
            }
            else
            {
                mModel.IsSignContract = true;
                mModel.ContractCode   = Utils.GetFormValue(this.txtContractNum.UniqueID);
            }
            mModel.LastModifierId = this.SiteUserInfo.Name;
            mModel.LastModifyTime = DateTime.Now;
            mModel.LicenseKey     = PermitNum;
            mModel.UnitPolicy     = Policy;
            mModel.Desc           = Character;
            mModel.IssueTime      = DateTime.Now;

            if (!String.IsNullOrEmpty(id))
            {
                mModel.SourceId = id;
            }

            #region 合同附件
            EyouSoft.Model.ComStructure.MComAttach visaModel = new EyouSoft.Model.ComStructure.MComAttach();
            if (oldVisaUpload.Length > 0)
            {
                for (int i = 0; i < oldVisaUpload.Length; i++)
                {
                    visaModel.FilePath = oldVisaUpload[i].Split('|')[1];
                    visaModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.供应商合同附件;
                    visaModel.Name     = oldVisaUpload[i].Split('|')[0];
                    visaModel.Size     = 0;
                }
            }
            if (visaUpload.Length > 0)
            {
                for (int i = 0; i < visaUpload.Length; i++)
                {
                    if (visaUpload[i].Trim() != "")
                    {
                        if (visaUpload[i].Split('|').Length > 1)
                        {
                            visaModel.Downloads = 0;
                            visaModel.FilePath  = visaUpload[i].Split('|')[1];
                            visaModel.ItemType  = EyouSoft.Model.EnumType.ComStructure.AttachItemType.供应商合同附件;
                            visaModel.Name      = visaUpload[i].Split('|')[0];
                            visaModel.Size      = 0;
                        }
                    }
                }
            }

            mModel.ContractAttach = visaModel;
            #endregion

            mUser.CompanyId = this.SiteUserInfo.CompanyId;
            //mUser.IsEnable = true;
            mUser.IssueTime = DateTime.Now;
            mUser.UserType  = EyouSoft.Model.EnumType.ComStructure.UserType.供应商;
            MSourceTravelInfo Traveinfo = new MSourceTravelInfo();
            Traveinfo.LegalRepresentative = LegalName;
            Traveinfo.Routes          = Character;
            Traveinfo.Telephone       = Tel;
            mTravel.SourceTravelModel = Traveinfo;
            //mTravel.UserModel = mUser;
            mTravel.SourceModel = mModel;
            mTravel.LinkManList = list;
            //mTravel.SourceTravelModel
            EyouSoft.BLL.SourceStructure.BSource bllsource = new EyouSoft.BLL.SourceStructure.BSource();
            EyouSoft.BLL.ComStructure.BComUser   blluser   = new EyouSoft.BLL.ComStructure.BComUser();

            int result = 0;
            if (t)
            {//新增
                result = bllsource.AddTravelServiceModel(mTravel);
                if (result == -1)
                {
                    msg = "{\"result\":\"0\",\"msg\":\"单位名称已存在!\"}";
                    return(msg);
                }
            }
            else
            { //编辑
                result = bllsource.UpdateTravelServiceModel(mTravel);
                if (result == -1)
                {
                    msg = "{\"result\":\"0\",\"msg\":\"单位名称已存在!\"}";
                    return(msg);
                }
            }
            string type = t ? "新增" : "修改";
            if (result > 0)
            {
                msg = "{\"result\":\"1\",\"msg\":\"" + type + "成功!\"}";
                return(msg);
            }
            else
            {
                msg = "{\"result\":\"0\",\"msg\":\"" + type + "失败!\"}";
                return(msg);
            }
        }