Exemple #1
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="model">工作计划实体</param>
        /// <returns>true:成功 false:失败</returns>
        public bool Add(EyouSoft.Model.PersonalCenterStructure.WorkPlan model)
        {
            DbCommand dc = this._db.GetStoredProcCommand("proc_WorkPlan_Insert");

            this._db.AddInParameter(dc, "CompanyId", DbType.Int32, model.CompanyId);
            this._db.AddInParameter(dc, "Title", DbType.String, model.Title);
            this._db.AddInParameter(dc, "Description", DbType.String, model.Description);
            this._db.AddInParameter(dc, "FilePath", DbType.String, model.FilePath);
            this._db.AddInParameter(dc, "Remark", DbType.String, model.Remark);
            this._db.AddInParameter(dc, "ExpectedDate", DbType.DateTime, model.ExpectedDate);
            this._db.AddInParameter(dc, "ActualDate", DbType.DateTime, model.ActualDate);
            this._db.AddInParameter(dc, "OperatorId", DbType.Int32, model.OperatorId);
            this._db.AddInParameter(dc, "OperatorName", DbType.String, model.OperatorName);
            this._db.AddInParameter(dc, "Status", DbType.Byte, (int)model.Status);
            this._db.AddInParameter(dc, "AcceptXML", DbType.String, this.CreateAcceptXML(model.AcceptList));
            this._db.AddInParameter(dc, "PlanNO", DbType.String, model.PlanNO);
            this._db.AddOutParameter(dc, "Result", DbType.Int32, 4);
            DbHelper.RunProcedure(dc, this._db);
            object obj = this._db.GetParameterValue(dc, "Result");

            if (obj != null && int.Parse(obj.ToString()) > 0)
            {
                model.PlanId = int.Parse(obj.ToString());
            }
            return(int.Parse(obj.ToString()) > 0 ? true : false);
        }
Exemple #2
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;
             }
         }
     }
 }
Exemple #3
0
        /// <summary>
        /// 初使化修改数据
        /// </summary>
        private void Bind()
        {
            tid = EyouSoft.Common.Utils.GetInt(EyouSoft.Common.Utils.GetQueryStringValue("tid"), 0);
            wpModel = wpBll.GetModel(tid);

            GrantInit();

            if (wpModel.AcceptList.Count > 0)
            {
                string[] sid = new string[wpModel.AcceptList.Count];
                string[] sname = new string[wpModel.AcceptList.Count];
                for (int i = 0; i < wpModel.AcceptList.Count; i++)
                {
                    sid[i] = wpModel.AcceptList[i].AccetpId.ToString();
                    sname[i] = wpModel.AcceptList[i].AccetpName;
                }
                this.SOperator1.OperId = string.Join(",", sid);
                this.SOperator1.OperLblName = string.Join(",", sname);
            }
        }
Exemple #4
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="model">工作计划实体</param>
        /// <returns>true:成功 false:失败</returns>
        public bool Update(EyouSoft.Model.PersonalCenterStructure.WorkPlan model)
        {
            if (model == null)
            {
                return(false);
            }
            bool Result = idal.Update(model);

            if (Result)
            {
                HandleLogsBll.Add(
                    new EyouSoft.Model.CompanyStructure.SysHandleLogs()
                {
                    ModuleId     = EyouSoft.Model.EnumType.CompanyStructure.SysPermissionClass.个人中心_工作交流,
                    EventCode    = Model.CompanyStructure.SysHandleLogsNO.EventCode,
                    EventMessage = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "{0}在" + Model.EnumType.CompanyStructure.SysPermissionClass.个人中心_工作交流.ToString() + "修改了工作交流!编号为:" + model.PlanId,
                    EventTitle   = "修改" + Model.EnumType.CompanyStructure.SysPermissionClass.个人中心_工作交流.ToString() + "数据"
                });
            }
            return(Result);
        }
Exemple #5
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);
            }

        }
Exemple #6
0
        /// <summary>
        /// 分页工作交流集合
        /// </summary>
        /// <param name="pageSize">每页显示条数</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="RecordCount">总记录数</param>
        /// <param name="CompanyId">公司编号 =0返回所有</param>
        /// <param name="OperatorId">操作人编号</param>
        /// <param name="QueryInfo">工作计划查询实体</param>
        /// <returns></returns>
        public IList <EyouSoft.Model.PersonalCenterStructure.WorkPlan> GetList(int pageSize, int pageIndex, ref int RecordCount, int CompanyId, int OperatorId, EyouSoft.Model.PersonalCenterStructure.QueryWorkPlan QueryInfo)
        {
            IList <EyouSoft.Model.PersonalCenterStructure.WorkPlan> list = new List <EyouSoft.Model.PersonalCenterStructure.WorkPlan>();
            string        tableName  = "tbl_WorkPlan";
            string        fields     = "PlanId,PlanNO,Title,Remark,OperatorId,(select ContactName from tbl_CompanyUser where Id=tbl_WorkPlan.OperatorId) as OperatorName,Status,ExpectedDate,ActualDate,CreateTime";
            string        primaryKey = "PlanId";
            string        orderbyStr = " CreateTime DESC ";
            StringBuilder strWhere   = new StringBuilder(" IsDelete='0' ");

            if (CompanyId > 0)
            {
                strWhere.AppendFormat(" and CompanyId={0} ", CompanyId);
            }
            if (OperatorId > 0)
            {
                strWhere.AppendFormat(" and ((PlanId in(select PlanId from tbl_WorkPlanAccept where AccetpId={0})) OR (OperatorId={0}) OR (dbo.fn_ValidUserLevDepartManagers({0},OperatorId)>0))", OperatorId);
            }
            if (QueryInfo != null)
            {
                if (!string.IsNullOrEmpty(QueryInfo.Title))
                {
                    strWhere.AppendFormat(" and Title like '%{0}%' ", QueryInfo.Title);
                }
                if (!string.IsNullOrEmpty(QueryInfo.OperatorName))
                {
                    strWhere.AppendFormat(" and OperatorName like '%{0}%' ", QueryInfo.OperatorName);
                }
                if (QueryInfo.LastSTime.HasValue)
                {
                    strWhere.AppendFormat(" and datediff(dd,LastTime,'{0}')<=0 ", QueryInfo.LastSTime.Value.ToString());
                }
                if (QueryInfo.LastETime.HasValue)
                {
                    strWhere.AppendFormat(" and datediff(dd,LastTime,'{0}')>=0 ", QueryInfo.LastETime.Value.ToString());
                }
                if (QueryInfo.Status.HasValue)
                {
                    strWhere.AppendFormat(" and Status={0} ", (int)QueryInfo.Status.Value);
                }
            }
            using (IDataReader dr = DbHelper.ExecuteReader(this._db, pageSize, pageIndex, ref RecordCount, tableName, primaryKey, fields, strWhere.ToString(), orderbyStr))
            {
                while (dr.Read())
                {
                    EyouSoft.Model.PersonalCenterStructure.WorkPlan model = new EyouSoft.Model.PersonalCenterStructure.WorkPlan();
                    model.PlanId       = dr.GetInt32(dr.GetOrdinal("PlanId"));
                    model.PlanNO       = dr[dr.GetOrdinal("PlanNO")].ToString();
                    model.Title        = dr[dr.GetOrdinal("Title")].ToString();
                    model.OperatorName = dr[dr.GetOrdinal("OperatorName")].ToString();
                    model.Remark       = dr[dr.GetOrdinal("Remark")].ToString();
                    model.Status       = (EyouSoft.Model.EnumType.PersonalCenterStructure.PlanCheckState) int.Parse(dr[dr.GetOrdinal("Status")].ToString());
                    if (!dr.IsDBNull(dr.GetOrdinal("ExpectedDate")))
                    {
                        model.ExpectedDate = dr.GetDateTime(dr.GetOrdinal("ExpectedDate"));
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("ActualDate")))
                    {
                        model.ActualDate = dr.GetDateTime(dr.GetOrdinal("ActualDate"));
                    }
                    model.CreateTime = dr.GetDateTime(dr.GetOrdinal("CreateTime"));
                    if (!dr.IsDBNull(dr.GetOrdinal("OperatorId")))
                    {
                        model.OperatorId = dr.GetInt32(dr.GetOrdinal("OperatorId"));
                    }
                    list.Add(model);
                    model = null;
                }
            }
            return(list);
        }