Example #1
0
        /// <summary>
        /// 获取景点预控信息
        /// </summary>
        /// <param name="id">预控编号</param>
        /// <param name="companyId">公司编号</param>
        /// <returns>景点预控信息</returns>
        public MSourceSueSight GetModelBySightId(string id, string companyId)
        {
            MSourceSueSight item = null;

            if (!string.IsNullOrEmpty(id) && !string.IsNullOrEmpty(companyId))
            {
                item = dal.GetModelBySightId(id, companyId);
            }
            return(item);
        }
Example #2
0
        /// <summary>
        /// 保存
        /// </summary>
        private void Save()
        {
            var    model = new MSourceSueSight();
            string msg   = string.Empty;

            if (GetPageVal(model, ref msg))
            {
                PageResponse(UtilsCommons.AjaxReturnJson(new BSourceControl().AddSueSight(model) ? "1" : "-1", "添加失败!"));
            }
            else
            {
                PageResponse(UtilsCommons.AjaxReturnJson("-1", msg));
            }
        }
Example #3
0
        /// <summary>
        /// 添加景点预控
        /// </summary>
        /// <param name="item">景点预控实体</param>
        /// <returns>true:成功 false:失败</returns>
        public bool AddSueSight(MSourceSueSight item)
        {
            bool result = false;

            if (item != null)
            {
                item.Id = Guid.NewGuid().ToString();
                result  = dal.AddSueSight(item);
                if (result)
                {
                    EyouSoft.BLL.SysStructure.BSysLogHandle.Insert(string.Format("添加景点预控,编号为:{0}", item.Id));
                }
            }
            return(result);
        }
Example #4
0
        /// <summary>
        /// 获取页面数据
        /// </summary>
        /// <param name="model">保存数据实体</param>
        /// <param name="msg">验证提示</param>
        /// <returns>验证结果(true验证通过)</returns>
        private bool GetPageVal(MSourceSueSight model, ref string msg)
        {
            #region 实体赋值
            model.DeptId = SiteUserInfo.DeptId;
            //景点公司名称
            model.SourceName = Utils.GetFormValue(SupplierControl1.ClientText);
            //景点公司编号
            model.SourceId = Utils.GetFormValue(SupplierControl1.ClientValue);
            //景点名称
            model.SpotName = Utils.GetFormValue("CarTypeName");
            model.SpotId   = Utils.GetFormValue("CarTypeId");
            //预付金额
            model.Advance = Utils.GetInt(Utils.GetFormValue(txt_day.ClientID));
            //单价
            model.UnitPrice = Utils.GetDecimal(Utils.GetFormValue(txt_unitPrice.ClientID));
            //总价
            model.TotalPrice = Utils.GetDecimal(Utils.GetFormValue(txt_totalPrice.ClientID));
            //公司编号
            model.CompanyId = CurrentUserCompanyID;
            //操作时间
            model.IssueTime = DateTime.Now;
            //操作员
            model.OperatorId = SiteUserInfo.UserId;
            //预控数量
            model.ControlNum = Utils.GetInt(txt_quantity.Text);
            //最后保留日期
            model.LastTime = Utils.GetDateTime(Utils.GetFormValue(txt_lastTime.ClientID));
            //有效期--始
            model.SueStartTime = Utils.GetDateTime(Utils.GetFormValue(txt_sueStartTime.ClientID));
            //有效期--终
            model.SueEndTime = Utils.GetDateTime(Utils.GetFormValue(txt_sueEndTime.ClientID));
            model.Remark     = Utils.GetFormValue(txt_remark.ClientID);
            #endregion
            #region 验证
            msg += model.SourceName.Length > 0 && model.SourceId.Length > 0 ? string.Empty : "景点公司异常,请使用选用功能选取!<br/>";
            msg += model.SpotName.Length > 0 ? string.Empty : "景点不能为空!<br/>";
            msg += model.ControlNum > 0 ? string.Empty : "预控数量不能为0!<br/>";
            msg += model.LastTime != DateTime.MinValue ? string.Empty : "最后保留日期格式错误!<br/>";
            msg += model.SueStartTime != DateTime.MinValue ? string.Empty : "预控时间格式错误!<br/>";
            msg += model.SueEndTime != DateTime.MinValue ? string.Empty : "预控时间格式错误!<br/>";
            #endregion
            //预控类型
            if (Utils.GetFormValue("ControlType").Length > 0)
            {
                model.SourceControlType = (SourceControlType)Utils.GetInt(Utils.GetFormValue("ControlType"));
                switch (model.SourceControlType)
                {
                case SourceControlType.单控:
                    //单控团号
                    string[] tourList = Utils.GetFormValue("TourList").Split('|');
                    IList <MSourceSueTour> tourNoList = new List <MSourceSueTour>();
                    foreach (string item in tourList)
                    {
                        if (item.Length > 0 && item.Split(',').Length == 2)
                        {
                            tourNoList.Add(new MSourceSueTour {
                                SourceType = SourceControlCategory.景点, TourId = item.Split(',')[1]
                            });
                        }
                    }
                    model.TourNoList = tourNoList;
                    msg += model.TourNoList.Count > 0 ? string.Empty : "单控状态下请选择团号!<br/>";
                    break;

                case SourceControlType.总控:
                    //共享类型
                    if (Utils.GetIntSign(Utils.GetFormValue("ShareType"), -1) > 0)
                    {
                        model.ShareType = (ShareType)Utils.GetInt(Utils.GetFormValue("ShareType"));
                        if (model.ShareType == ShareType.共享)
                        {
                            IList <MSourceSueOperator> sourceSueOperatorList = new List <MSourceSueOperator>();
                            string[] ids = Utils.GetFormValue("Ids").Split(',');
                            foreach (string item in ids)
                            {
                                sourceSueOperatorList.Add(new MSourceSueOperator {
                                    SourceType = SourceControlCategory.景点, OperatorId = item
                                });
                            }
                            //预控人员
                            model.OperatorList = sourceSueOperatorList;
                            msg += model.OperatorList.Count > 0 ? string.Empty : "总控--不共享状态下请选择预控人员!<br/>";
                        }
                    }
                    else
                    {
                        msg += "总控状态下请选择共享类型!<br/>";
                    }

                    break;
                }
            }
            else
            {
                msg += "预控类型不能为空!<br/>";
            }
            return(msg.Length <= 0);
        }