/// <summary>
        /// 保存领用单信息
        /// </summary>
        private void sbtnSave_Click(object sender, EventArgs e)
        {
            //检查用户输入是否合法、部门、人员、资产信息
            if ((cbtlDepartment.EditValue != null || cbUser.EditValue != null) && selectList.Count > 0)
            {
                model.Id      = Guid.NewGuid();
                model.ApplyNo = manager.GetNewApplyNo();


                model.Location = tlocation.Text;

                model.ApplyUserId   = clsPublic.GetObjGUID(cbUser.EditValue);
                model.ApplyUserName = cbUser.Text;
                if (cbtlDepartment.EditValue == null)
                {
                    model.ApplyDepartmentId = clsPublic.GetObjGUID(cbUser.Properties.View.GetFocusedRowCellValue("DepartmentId"));
                }
                else
                {
                    model.ApplyDepartmentId = clsPublic.GetObjGUID(cbtlDepartment.EditValue);
                }

                model.OperatorId   = clsSession._UserId;
                model.OperatorName = clsSession._FullName;
                model.Description  = tDescription.Text;
                model.Applyday     = tApplyday.DateTime;
                model.Detail       = new List <Models.ys_ApplyOrderDetail>();
                //循环获取资产数据集
                foreach (Models.ys_Assets m in selectList)
                {
                    Models.ys_ApplyOrderDetail d = new Models.ys_ApplyOrderDetail();
                    d.AssetsId    = m.Id;
                    d.ApplyId     = model.Id;
                    d.Id          = Guid.NewGuid();
                    d.OldStatusId = m.StatusId;
                    model.Detail.Add(d);
                }
                //生成新的领用单
                if (manager.AddNew(model))
                {
                    clsPublic.ShowMessage("保存成功!", Text);
                    base.DialogResult = DialogResult.OK;
                }
                else
                {
                    clsPublic.ShowMessage("保存失败!", Text);
                }
            }
            else
            {
                clsPublic.ShowMessage("部门、职员、或领用的资产信息不能为空!", Text);
            }
        }
        public void AddLyOrder()
        {
            Models.ys_ApplyOrder  lyModel           = new Models.ys_ApplyOrder();
            BLL.ApplyOrderManager applyOrderManager = new BLL.ApplyOrderManager();
            if (cbtlDepartment.EditValue != null || cbtlDepartment.EditValue != null)
            {
                lyModel.ApplyNo  = applyOrderManager.GetNewApplyNo();//生成订单号
                lyModel.Id       = Guid.NewGuid();
                lyModel.Location = cblocation.Text;

                lyModel.ApplyUserId   = Utils.cls.clsPublic.GetObjGUID(cbUser.EditValue);
                lyModel.ApplyUserName = cbUser.Text;

                if (cbtlDepartment.EditValue == null)
                {
                    lyModel.ApplyDepartmentId = Utils.cls.clsPublic.GetObjGUID(cbUser.Properties.View.GetFocusedRowCellValue("DepartmentId"));
                }
                else
                {
                    lyModel.ApplyDepartmentId = Utils.cls.clsPublic.GetObjGUID(cbtlDepartment.EditValue);
                }

                lyModel.OperatorId   = clsSession._UserId;
                lyModel.OperatorName = clsSession._FullName;
                lyModel.Description  = "登记时生成";
                lyModel.Applyday     = DateTime.Now;

                List <Models.ys_ApplyOrderDetail> details = new List <Models.ys_ApplyOrderDetail>();

                Models.ys_ApplyOrderDetail d = new Models.ys_ApplyOrderDetail();
                model         = assetsManager.GetOneById(model.Id);
                d.AssetsId    = model.Id;
                d.ApplyId     = lyModel.Id;
                d.OldStatusId = model.StatusId;
                details.Add(d);

                lyModel.Detail = details;
                //生成新的领用单
                if (applyOrderManager.AddNew(lyModel))
                {
                    clsPublic.ShowMessage("领用单生成成功!", Text);
                }
                else
                {
                    clsPublic.ShowMessage("领用单生成失败!", Text);
                }
            }
        }