示例#1
0
        /// <summary>
        /// 获取其他预控信息
        /// </summary>
        /// <param name="id">预控编号</param>
        /// <param name="companyId">公司编号</param>
        /// <returns>其他预控信息</returns>
        public MSourceSueOther GetModelByOtherId(string id, string companyId)
        {
            MSourceSueOther item = null;

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

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

            if (item != null)
            {
                item.Id = Guid.NewGuid().ToString();
                result  = dal.AddSueOther(item);
                if (result)
                {
                    EyouSoft.BLL.SysStructure.BSysLogHandle.Insert(string.Format("添加其他预控,编号为:{0}", item.Id));
                }
            }
            return(result);
        }
示例#4
0
        /// <summary>
        /// 获取页面数据
        /// </summary>
        /// <param name="model">保存数据实体</param>
        /// <param name="msg">验证提示</param>
        /// <returns>验证结果(true验证通过)</returns>
        private bool GetPageVal(MSourceSueOther model, ref string msg)
        {
            #region 实体赋值
            model.DeptId = SiteUserInfo.DeptId;
            //其他公司名称
            model.SourceName = Utils.GetFormValue(SupplierControl1.ClientText);
            //支出类别编号
            model.SourceId = Utils.GetFormValue(SupplierControl1.ClientValue);
            //支出名称
            model.TypeName = Utils.GetFormValue("CarTypeName");
            model.TypeId   = 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.TypeName.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);
        }