Ejemplo n.º 1
0
 /// <summary>
 /// 绑定查看数据
 /// </summary>
 private void ShowInit()
 {
     tid = Utils.GetInt(Utils.GetQueryStringValue("tid"));//计划ID
     if (tid > 0)
     {
         wpModel = wpBll.GetModel(tid);
         if (wpModel != null)
         {
             //计划作者是否当前用户,是的话有查看权限
             if (wpModel.OperatorId == SiteUserInfo.ID)
             {
                 isshow = true;
             }
             //接收人附值并判断当前用户是否在接收人列表中
             if (wpModel.AcceptList != null)
             {
                 if (wpModel.AcceptList.Count > 0)
                 {
                     bool temp = false;
                     foreach (EyouSoft.Model.PersonalCenterStructure.WorkPlanAccept wpa in wpModel.AcceptList)
                     {
                         if (temp)
                         {
                             acceptname.Append(",");
                         }
                         acceptname.Append(wpa.AccetpName);
                         temp = true;
                         //当前用户是否是计划的接收人,是的话有查看权限
                         if (wpa.AccetpId == SiteUserInfo.ID)
                         {
                             isshow = true;
                         }
                     }
                 }
             }
             //当前用户是否是计划作者的主管或上级,是的话有查看权限
             if (!isshow)
             {
                 isshow = dBll.JudgePermission(wpModel.OperatorId, SiteUserInfo.ID) > 0 ? true : false;
             }
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 保存新增修改信息
        /// </summary>
        private void Save()
        {
            bool res = false;//是否成功
            tid = EyouSoft.Common.Utils.GetInt(Utils.GetFormValue("tid"));//主键ID,是0为新增
            if (tid > 0)
            {
                wpModel = wpBll.GetModel(tid);
            }
            else
            {
                wpModel.OperatorName = this.SiteUserInfo.ContactInfo.ContactName;
                wpModel.CompanyId = this.CurrentUserCompanyID;
                wpModel.OperatorId = this.SiteUserInfo.ID;
                wpModel.CreateTime = DateTime.Now;
            }
            wpModel.PlanNO = Utils.GetFormValue("num");//计划编号
            wpModel.Title = Utils.GetFormValue("title");//计划标题
            wpModel.Description = Utils.EditInputText(Request.Form["description"]);//计划内容
            wpModel.LastTime = DateTime.Now;//最后修改时间
            //附件
            if (Request.Files.Count > 0)
            {
                string filepath = string.Empty;
                string oldfilename = string.Empty;
                bool result = EyouSoft.Common.Function.UploadFile.FileUpLoad(Request.Files["upfile"], "UserCenterFile", out filepath, out oldfilename);
                if (result)
                {
                    wpModel.FilePath = filepath;
                }
            }
            wpModel.Remark = Utils.GetFormValue("remark");//计划说明
            wpModel.ExpectedDate = Utils.GetDateTime(Utils.GetFormValue("expectedDate"));//计划预计完成时间
            wpModel.ActualDate = Utils.GetDateTime(Utils.GetFormValue("actualDate"));//计划实际完成时间
            wpModel.Status = (EyouSoft.Model.EnumType.PersonalCenterStructure.PlanCheckState)int.Parse(Utils.GetFormValue("status"));//计划状态


            #region 接收人
            wpModel.AcceptList = new List<EyouSoft.Model.PersonalCenterStructure.WorkPlanAccept>();
            string[] sid = this.SOperator1.OperId.Split(',');
            //string[] snmae = this.SOperator1.OperLblName.Split(',');
            for(int i =0;i<sid.Length;i++)
            {
                EyouSoft.Model.PersonalCenterStructure.WorkPlanAccept wpActModel = new EyouSoft.Model.PersonalCenterStructure.WorkPlanAccept();
                int id = Utils.GetInt(sid[i]);
                if (id > 0)
                {
                    wpActModel.AccetpId = id;
                    //wpActModel.AccetpName = snmae[i];
                    wpModel.AcceptList.Add(wpActModel);
                }
            }
            #endregion

            #region 上级部门主管和经理部评语
            GrantInit();
            //上级部门
            if (isDirector)
            {
                wpModel.DepartmentComment = Utils.GetFormValue("departmentComment");
            }
            //总经理
            if (isManager)
            {
                wpModel.ManagerComment = Utils.GetFormValue("managerComment");
            }

            #endregion

            if (tid > 0)
            {
                res = wpBll.Update(wpModel);
            }
            else
            {
                res = wpBll.Add(wpModel);
            }

            if (res)
            {
                string conti = Utils.GetFormValue("continue");
                if (conti == "continue")
                {
                    MessageBox.ShowAndRedirect(this, "操作成功!", "WorkPlanAdd.aspx");
                }
                else
                {
                    MessageBox.ShowAndRedirect(this, "操作成功!", "WorkPlan.aspx");
                }
            }
            else
            {
                MessageBox.ShowAndReturnBack(this, "操作失败!", 1);
            }

        }