示例#1
0
        public List <MachinesInfo> GetMachines(string NWIP, string WWIP, string JQRT, string GLY, string ZG, PagerInfo info)
        {
            if (NWIP != null && SqlInjection.GetString(NWIP))
            {
                return(null);
            }

            if (WWIP != null && SqlInjection.GetString(WWIP))
            {
                return(null);
            }

            if (JQRT != null && SqlInjection.GetString(JQRT))
            {
                return(null);
            }

            if (GLY != null && SqlInjection.GetString(GLY))
            {
                return(null);
            }

            if (ZG != null && SqlInjection.GetString(ZG))
            {
                return(null);
            }

            if (machinesDal == null)
            {
                machinesDal = baseDal as IMachines;
            }

            return(machinesDal.GetMachines(NWIP, WWIP, JQRT, GLY, ZG, info));
        }
示例#2
0
        public Int32 GetMachinesCount(string NWIP, string WWIP, string JQRT, string GLY, string ZG)
        {
            if (NWIP != null && SqlInjection.GetString(NWIP))
            {
                return(-1);
            }

            if (WWIP != null && SqlInjection.GetString(WWIP))
            {
                return(-1);
            }

            if (JQRT != null && SqlInjection.GetString(JQRT))
            {
                return(-1);
            }

            if (GLY != null && SqlInjection.GetString(GLY))
            {
                return(-1);
            }

            if (ZG != null && SqlInjection.GetString(ZG))
            {
                return(-1);
            }

            if (machinesDal == null)
            {
                machinesDal = baseDal as IMachines;
            }

            return(machinesDal.GetMachinesCount(NWIP, WWIP, JQRT, GLY, ZG));
        }
示例#3
0
        /// <summary>
        /// 获取测试数据
        /// </summary>
        /// <param name="key"></param>
        /// <param name="PageSize"></param>
        /// <param name="CurrentCount"></param>
        /// <param name="TotalCount"></param>
        /// <returns></returns>
        public List <ArticleEntity> GetArticleList(string key, int PageSize, int CurrentCount, out int TotalCount)
        {
            string tabName  = string.Format("Article");
            string strWhere = " 1=1";

            if (!string.IsNullOrEmpty(key))
            {
                //SQL关键字过滤 包含关键字则不拼接SQL
                if (!SqlInjection.GetString(key))
                {
                    strWhere += string.Format(" AND (Title LIKE '%{0}%' OR Content LIKE '%{0}%')", key);
                }
            }
            string  Order             = string.Format("ID DESC");
            DataSet ds                = SqlHelper.GetList(SqlHelper.connStr, Order, PageSize, CurrentCount, tabName, strWhere, out TotalCount);
            List <ArticleEntity> list = new List <ArticleEntity>();

            if (ds != null && ds.Tables.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    ArticleEntity model = new ArticleEntity();
                    model.ID      = Convert.ToInt32(dr["ID"]);
                    model.Title   = dr["Title"].ToString();
                    model.Content = dr["Content"].ToString();
                    list.Add(model);
                }
            }
            return(list);
        }
示例#4
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <returns></returns>
        public ActionResult GetAllResumeInfo()
        {
            string strWhere = "1=1";
            string sort     = Request["sort"] == null ? "Id" : Request["sort"];
            string order    = Request["order"] == null ? "asc" : Request["order"];

            //首先获取前台传递过来的参数
            int pageindex = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]);
            int pagesize  = Request["rows"] == null ? 10 : Convert.ToInt32(Request["rows"]);

            if (!string.IsNullOrEmpty(Request["RealName"]) && !SqlInjection.GetString(Request["RealName"]))
            {
                strWhere += " and RealName like '%" + Request["RealName"] + "%'";
            }

            if (!string.IsNullOrEmpty(Request["IdCard"]) && !SqlInjection.GetString(Request["IdCard"]))
            {
                strWhere += " and IdCard like '%" + Request["IdCard"] + "%'";
            }

            int    totalCount; //输出参数
            string strJson    = bll.GetPager("Resume_Base", "Id,RealName,Sex,Nation,IdCard,PoliticalAffiliation,Education,Major,IsMarry,IsBred,Residence,ResidenceType,Address,FillingDate ", sort + " " + order, pagesize, pageindex, strWhere, out totalCount);
            var    jsonResult = new { total = totalCount.ToString(), rows = strJson };

            return(Content("{\"total\": " + totalCount.ToString() + ",\"rows\":" + strJson + "}"));
        }
示例#5
0
        /// <summary>
        /// 获取项目的节点详情
        /// </summary>
        /// <returns></returns>
        public ActionResult GetPMNodeInfo()
        {
            //首先获取前台传递过来的参数
            string strWhere    = "1=1";
            string view        = Request["view"] == null ? "PMMaintain" : Request["view"];
            string ProjectID   = Request["ProjectID"] == null ? "" : Request["ProjectID"];
            string ProjectNo   = Request["ProjectNo"] == null ? "" : Request["ProjectNo"];
            string ProjectName = Request["ProjectName"] == null ? "" : Request["ProjectName"];

            if (ProjectID.Trim() != "" && !SqlInjection.GetString(ProjectID))   //防止sql注入
            {
                strWhere += string.Format(" and ProjectID = '{0}'", ProjectID.Trim());
            }
            string content = "";

            try
            {
                string    sqlstr  = string.Format("select * from tbMgrNodeInfo where ProjectID='{0}'", ProjectID);
                DataTable dt      = AchieveCommon.SqlHelper.GetDataTable(SqlHelper.connStr, sqlstr);
                string    strJson = AchieveCommon.JsonHelper.ToJson(dt);
                content = "{\"success\": true ,\"rows\":" + strJson + "}";
            }
            catch (Exception ex)
            {
                return(Content("{\"msg\":\"获取数据失败," + ex.Message.Trim().Replace("\r", "").Replace("\n", "") + "\",\"success\":false}"));
            }

            return(Content(content));
        }
示例#6
0
        public ActionResult GetAllProduceInfo()
        {
            string strWhere = "1=1";
            string sort     = Request["sort"] == null ? "ID" : Request["sort"];
            string order    = Request["order"] == null ? "asc" : Request["order"];

            //首先获取前台传递过来的参数
            int    pageindex    = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]);
            int    pagesize     = Request["rows"] == null ? 10 : Convert.ToInt32(Request["rows"]);
            string userid       = Request["accountid"] == null ? "" : Request["accountid"];
            string username     = Request["username"] == null ? "" : Request["username"];
            string isable       = Request["isable"] == null ? "" : Request["isable"];
            string ifchangepwd  = Request["ifchangepwd"] == null ? "" : Request["ifchangepwd"];
            string userperson   = Request["userperson"] == null ? "" : Request["userperson"];
            string adddatestart = Request["adddatestart"] == null ? "" : Request["adddatestart"];
            string adddateend   = Request["adddateend"] == null ? "" : Request["adddateend"];

            if (userid.Trim() != "" && !SqlInjection.GetString(userid))   //防止sql注入
            {
                strWhere += string.Format(" and AccountName like '%{0}%'", userid.Trim());
            }
            if (username.Trim() != "" && !SqlInjection.GetString(username))
            {
                strWhere += string.Format(" and RealName like '%{0}%'", username.Trim());
            }
            if (isable.Trim() != "select" && isable.Trim() != "")
            {
                strWhere += " and IsAble = '" + isable.Trim() + "'";
            }
            if (ifchangepwd.Trim() != "select" && ifchangepwd.Trim() != "")
            {
                strWhere += " and IfChangePwd = '" + ifchangepwd.Trim() + "'";
            }
            if (adddatestart.Trim() != "")
            {
                strWhere += " and CreateTime > '" + adddatestart.Trim() + "'";
            }
            if (adddateend.Trim() != "")
            {
                strWhere += " and CreateTime < '" + adddateend.Trim() + "'";
            }

            int       totalCount; //输出参数
            DataTable dt = AchieveCommon.SqlPagerHelper.GetPagerK3("ICMO", "FBillNo,FStatus,FQty,FCommitQty,FPlanCommitDate,FPlanFinishDate,FStartDate,FFinishDate,FType,FWorkShop,FItemID", sort + " " + order, pagesize, pageindex, strWhere, out totalCount);

            dt.Columns.Add(new DataColumn("FModel"));
            dt.Columns.Add(new DataColumn("FName"));
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataTable dticitemcore = GetFNameByFItemID(Convert.ToInt32(dt.Rows[i]["FItemID"]));
                dt.Rows[i]["FModel"] = AchieveCommon.JsonHelper.ColumnToJson(dticitemcore, 0);
                dt.Rows[i]["FName"]  = AchieveCommon.JsonHelper.ColumnToJson(dticitemcore, 1);
            }
            string strJson = AchieveCommon.JsonHelper.ToJson(dt);

            var jsonResult = new { total = totalCount.ToString(), rows = strJson };

            return(Content("{\"total\": " + totalCount.ToString() + ",\"rows\":" + strJson + "}"));
        }
示例#7
0
        public ActionResult GetAllProduceInfo()
        {
            string strWhere = "1=1";
            string sort     = Request["sort"] == null ? "FPlanCommitDate" : Request["sort"];
            string order    = Request["order"] == null ? "desc" : Request["order"];

            //首先获取前台传递过来的参数
            int    pageindex       = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]);
            int    pagesize        = Request["rows"] == null ? 10 : Convert.ToInt32(Request["rows"]);
            string FBillNo         = Request["FBillNo"] == null ? "" : Request["FBillNo"];
            string FItemID         = Request["FItemID"] == null ? "" : Request["FItemID"];
            string isable          = Request["isable"] == null ? "" : Request["isable"];
            string ifchangepwd     = Request["ifchangepwd"] == null ? "" : Request["ifchangepwd"];
            string userperson      = Request["userperson"] == null ? "" : Request["userperson"];
            string FPlanCommitDate = Request["FPlanCommitDate"] == null ? "" : Request["FPlanCommitDate"];
            string FPlanFinishDate = Request["FPlanFinishDate"] == null ? "" : Request["FPlanFinishDate"];

            if (FBillNo.Trim() != "" && !SqlInjection.GetString(FBillNo))   //防止sql注入
            {
                strWhere += string.Format(" and FBillNo like '%{0}%'", FBillNo.Trim());
            }
            //FName为非主表字段,暂不支持直接查询;
            //后期解决思路,先根据FName在子表中查询对应的FItemID,可能有多个,则将这多个拼接成where条件;
            //例如  FItemID = id1 and FItemID = id2  and FItemID = id3...
            //if (FName.Trim() != "" && !SqlInjection.GetString(FName))
            //    strWhere += string.Format(" and FName like '%{0}%'", FName.Trim());
            if (FItemID.Trim() != "" && !SqlInjection.GetString(FItemID))
            {
                strWhere += string.Format(" and FItemID like '%{0}%'", FItemID.Trim());
            }
            if (isable.Trim() != "select" && isable.Trim() != "")
            {
                strWhere += " and IsAble = '" + isable.Trim() + "'";
            }
            if (ifchangepwd.Trim() != "select" && ifchangepwd.Trim() != "")
            {
                strWhere += " and IfChangePwd = '" + ifchangepwd.Trim() + "'";
            }
            if (FPlanCommitDate.Trim() != "")
            {
                strWhere += " and FPlanCommitDate > '" + FPlanCommitDate.Trim() + "'";
            }
            if (FPlanFinishDate.Trim() != "")
            {
                strWhere += " and FPlanFinishDate < '" + FPlanFinishDate.Trim() + "'";
            }

            //抽取主作业计划单,规则不包含-、_两种连接符
            strWhere += "and Fbillno not like '%v_%'  ESCAPE   'v'  and  Fbillno not like '%v-%' ESCAPE   'v'";

            int    totalCount; //输出参数
            string strJson = new ProjectBLL().GetJsonPager("ICMO", "FBillNo,FStatus,FQty,FCommitQty,FPlanCommitDate,FPlanFinishDate,FStartDate,FFinishDate,FType,FWorkShop,FItemID", sort + " " + order, pagesize, pageindex, strWhere, out totalCount);

            //var jsonResult = new { total = totalCount.ToString(), rows = strJson };
            return(Content("{\"total\": " + totalCount.ToString() + ",\"rows\":" + strJson + "}"));
        }
示例#8
0
文件: RoleBLL.cs 项目: benxuu/SYPM
        /// <summary>
        /// 获取权限下的用户(分页)
        /// </summary>
        public string GetPagerRoleUser(int roleId, string order, int pageSize, int pageIndex)
        {
            if (SqlInjection.GetString(order))   //简单的sql注入过滤
            {
                order = "CreateTime asc";
            }
            int       totalCount = dal.GetRoleUserCount(roleId);
            DataTable dt         = dal.GetPagerRoleUser(roleId, order, pageSize, pageIndex);

            string strjson = JsonHelper.ToJson(dt);

            return("{\"total\": " + totalCount.ToString() + ",\"rows\":" + strjson + "}");
        }
示例#9
0
        public DataTable GetZG(string key)
        {
            // 检查一下key是否含有不合法的字符串
            if (SqlInjection.GetString(key))
            {
                return(null);
            }

            if (machinesDal == null)
            {
                machinesDal = baseDal as IMachines;
            }
            return(machinesDal.GetZG(key));
        }
示例#10
0
        public ActionResult GetAllUserInfo()
        {
            string strWhere = "1=1";
            string sort     = Request["sort"] == null ? "ID" : Request["sort"];
            string order    = Request["order"] == null ? "asc" : Request["order"];

            //首先获取前台传递过来的参数
            int    pageindex    = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]);
            int    pagesize     = Request["rows"] == null ? 10 : Convert.ToInt32(Request["rows"]);
            string userid       = Request["accountid"] == null ? "" : Request["accountid"];
            string username     = Request["username"] == null ? "" : Request["username"];
            string isable       = Request["isable"] == null ? "" : Request["isable"];
            string ifchangepwd  = Request["ifchangepwd"] == null ? "" : Request["ifchangepwd"];
            string userperson   = Request["userperson"] == null ? "" : Request["userperson"];
            string adddatestart = Request["adddatestart"] == null ? "" : Request["adddatestart"];
            string adddateend   = Request["adddateend"] == null ? "" : Request["adddateend"];

            if (userid.Trim() != "" && !SqlInjection.GetString(userid))   //防止sql注入
            {
                strWhere += string.Format(" and AccountName like '%{0}%'", userid.Trim());
            }
            if (username.Trim() != "" && !SqlInjection.GetString(username))
            {
                strWhere += string.Format(" and RealName like '%{0}%'", username.Trim());
            }
            if (isable.Trim() != "select" && isable.Trim() != "")
            {
                strWhere += " and IsAble = '" + isable.Trim() + "'";
            }
            if (ifchangepwd.Trim() != "select" && ifchangepwd.Trim() != "")
            {
                strWhere += " and IfChangePwd = '" + ifchangepwd.Trim() + "'";
            }
            if (adddatestart.Trim() != "")
            {
                strWhere += " and CreateTime > '" + adddatestart.Trim() + "'";
            }
            if (adddateend.Trim() != "")
            {
                strWhere += " and CreateTime < '" + adddateend.Trim() + "'";
            }

            int    totalCount; //输出参数
            string strJson    = new UserBLL().GetPager("tbUser", "ID,AccountName,[Password],RealName,MobilePhone,Email,IsAble,IfChangePwd,[Description],CreateTime,CreateBy,UpdateTime,UpdateBy", sort + " " + order, pagesize, pageindex, strWhere, out totalCount);
            var    jsonResult = new { total = totalCount.ToString(), rows = strJson };

            return(Content("{\"total\": " + totalCount.ToString() + ",\"rows\":" + strJson + "}"));
        }
示例#11
0
        /// <summary>
        /// 获取部门下的用户(分页)
        /// </summary>
        public string GetPagerDepartmentUser(string departmentIds, string order, int pageSize, int pageIndex)
        {
            if (SqlInjection.GetString(departmentIds))   //简单sql防注入
            {
                departmentIds = "";
            }
            if (SqlInjection.GetString(order))
            {
                order = "CreateTime asc";
            }
            int       totalCount = dal.GetDepartmentUserCount(departmentIds);
            DataTable dt         = dal.GetPagerDepartmentUser(departmentIds, order, pageSize, pageIndex);

            string strjson = JsonHelper.ToJson(dt);

            return("{\"total\": " + totalCount.ToString() + ",\"rows\":" + strjson + "}");
        }
示例#12
0
        public ActionResult GetAllFieldsInfo()
        {
            string strWhere = "1=1";
            string sort     = Request["sort"] == null ? "Id" : Request["sort"];
            string order    = Request["order"] == null ? "asc" : Request["order"];

            if (!string.IsNullOrEmpty(Request["FieldName"]) && !SqlInjection.GetString(Request["FieldName"]))
            {
                strWhere += " and FieldName like '%" + Request["FieldName"] + "%'";
            }
            if (!string.IsNullOrEmpty(Request["FieldViewName"]) && !SqlInjection.GetString(Request["FieldViewName"]))
            {
                strWhere += " and FieldViewName like '%" + Request["FieldViewName"] + "%'";
            }
            if (!string.IsNullOrEmpty(Request["SelTabId"]))
            {
                strWhere += " and TabId = '" + Request["SelTabId"] + "'";
            }
            //首先获取前台传递过来的参数
            int    pageindex  = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]);
            int    pagesize   = Request["rows"] == null ? 10 : Convert.ToInt32(Request["rows"]);
            int    totalCount = 0;
            string strJson    = "";       //输出结果

            if (order.IndexOf(',') != -1) //如果有","就是多列排序(不能拿列判断,列名中间可能有","符号)
            {
                //多列排序:
                //sort:ParentId,Sort,AddDate
                //order:asc,desc,asc
                string   sortMulti  = "";              //拼接排序条件,例:TabId desc,Sort asc
                string[] sortArray  = sort.Split(','); //列名中间有","符号,这里也要出错。正常不会有
                string[] orderArray = order.Split(',');
                for (int i = 0; i < sortArray.Length; i++)
                {
                    sortMulti += sortArray[i] + " " + orderArray[i] + ",";
                }
                strJson = new FieldsBLL().GetPager("vw_Fields", "Id,TabId,FieldName,FieldViewName,FieldDataTypeId,IsActive,IsSearch,Sort,CreateTime,CreateBy,UpdateTime,UpdateBy,DataType,DataTypeName,TabName,TabViewName", sortMulti.Trim(','), pagesize, pageindex, strWhere, out totalCount);
            }
            else
            {
                strJson = new FieldsBLL().GetPager("vw_Fields", "Id,TabId,FieldName,FieldViewName,FieldDataTypeId,IsActive,IsSearch,Sort,CreateTime,CreateBy,UpdateTime,UpdateBy,DataType,DataTypeName,TabName,TabViewName", sort + " " + order, pagesize, pageindex, strWhere, out totalCount);
            }
            var jsonResult = new { total = totalCount.ToString(), rows = strJson };

            return(Content("{\"total\": " + totalCount.ToString() + ",\"rows\":" + strJson + "}"));
        }
示例#13
0
        public ActionResult GetAllRequestionTypeInfo()
        {
            string strWhere = "1=1";
            string sort     = Request["sort"] == null ? "id" : Request["sort"];
            string order    = Request["order"] == null ? "asc" : Request["order"];

            if (!string.IsNullOrEmpty(Request["FTypeName"]) && !SqlInjection.GetString(Request["FTypeName"]))
            {
                strWhere += " and ftypename like '%" + Request["FTypeName"] + "%'";
            }
            //首先获取前台传递过来的参数
            int    pageindex  = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]);
            int    pagesize   = Request["rows"] == null ? 10 : Convert.ToInt32(Request["rows"]);
            int    totalCount = 0; //输出参数
            string strJson    = new RequestionTypeBLL().GetPager("tbRequestionType", "[id],[ftypename],fsort,CreateTime,CreateBy,UpdateTime,UpdateBy", sort + " " + order, pagesize, pageindex, strWhere, out totalCount);

            return(Content("{\"total\": " + totalCount.ToString() + ",\"rows\":" + strJson + "}"));
        }
示例#14
0
        public ActionResult GetAllButtonInfo()
        {
            string strWhere = "1=1";
            string sort     = Request["sort"] == null ? "id" : Request["sort"];
            string order    = Request["order"] == null ? "asc" : Request["order"];

            if (!string.IsNullOrEmpty(Request["FButtonName"]) && !SqlInjection.GetString(Request["FButtonName"]))
            {
                strWhere += " and Name like '%" + Request["FButtonName"] + "%'";
            }
            //首先获取前台传递过来的参数
            int    pageindex  = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]);
            int    pagesize   = Request["rows"] == null ? 10 : Convert.ToInt32(Request["rows"]);
            int    totalCount = 0; //输出参数
            string strJson    = JsonHelper.ToJson(SqlPagerHelper.GetPager("tbButton", "Id,Name,Code,Icon,Sort,Description,CreateTime,CreateBy,UpdateTime,UpdateBy", sort + " " + order, pagesize, pageindex, strWhere, out totalCount));

            return(Content("{\"total\": " + totalCount.ToString() + ",\"rows\":" + strJson + "}"));
        }
示例#15
0
        public ActionResult GetAllRequestionInfo()
        {
            string strWhere = "1=1";
            string sort     = Request["sort"] == null ? "id" : Request["sort"];
            string order    = Request["order"] == null ? "asc" : Request["order"];

            if (!string.IsNullOrEmpty(Request["ftitle"]) && !SqlInjection.GetString(Request["ftitle"]))
            {
                strWhere += " and ftitle like '%" + Request["ftitle"] + "%'";
            }
            if (!string.IsNullOrEmpty(Request["frequstid"]) && !SqlInjection.GetString(Request["frequstid"]))
            {
                strWhere += " and ftypeid =" + Request["frequstid"];
            }

            //首先获取前台传递过来的参数
            int    pageindex  = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]);
            int    pagesize   = Request["rows"] == null ? 10 : Convert.ToInt32(Request["rows"]);
            int    totalCount = 0;        //输出参数
            string strJson    = "";       //输出结果

            if (order.IndexOf(',') != -1) //如果有","就是多列排序(不能拿列判断,列名中间可能有","符号)
            {
                //多列排序:
                //sort:ParentId,Sort,AddDate
                //order:asc,desc,asc
                string   sortMulti  = "";              //拼接排序条件,例:ParentId desc,Sort asc
                string[] sortArray  = sort.Split(','); //列名中间有","符号,这里也要出错。正常不会有
                string[] orderArray = order.Split(',');
                for (int i = 0; i < sortArray.Length; i++)
                {
                    sortMulti += sortArray[i] + " " + orderArray[i] + ",";
                }
                strJson = JsonHelper.ToJson(SqlPagerHelper.GetPager("vw_requestion", "id,ftypeid,ftitle,fcontent,ftypename,fsort,CreateTime,CreateBy,UpdateTime,UpdateBy", sortMulti.Trim(','), pagesize, pageindex, strWhere, out totalCount));
            }
            else
            {
                strJson = JsonHelper.ToJson(SqlPagerHelper.GetPager("vw_requestion", "id,ftypeid,ftitle,fcontent,ftypename,fsort,CreateTime,CreateBy,UpdateTime,UpdateBy", sort + " " + order, pagesize, pageindex, strWhere, out totalCount));
            }
            var jsonResult = new { total = totalCount.ToString(), rows = strJson };

            return(Content("{\"total\": " + totalCount.ToString() + ",\"rows\":" + strJson + "}"));
        }
示例#16
0
        public ActionResult GetAllRoleInfo()
        {
            string strWhere = "1=1";
            string sort     = Request["sort"] == null ? "Id" : Request["sort"];
            string order    = Request["order"] == null ? "asc" : Request["order"];

            //首先获取前台传递过来的参数
            int pageindex = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]);
            int pagesize  = Request["rows"] == null ? 10 : Convert.ToInt32(Request["rows"]);

            if (!string.IsNullOrEmpty(Request["RoleName"]) && !SqlInjection.GetString(Request["RoleName"]))
            {
                strWhere += " and RoleName like '%" + Request["RoleName"] + "%'";
            }

            int    totalCount; //输出参数
            string strJson    = new RoleBLL().GetPager("tbRole", "Id,RoleName,Description,CreateTime,CreateBy,UpdateTime,UpdateBy ", sort + " " + order, pagesize, pageindex, strWhere, out totalCount);
            var    jsonResult = new { total = totalCount.ToString(), rows = strJson };

            return(Content("{\"total\": " + totalCount.ToString() + ",\"rows\":" + strJson + "}"));
        }
示例#17
0
        /// <summary>
        /// 主作业计划通用分页查询,view=Projectgrid,
        /// </summary>
        /// <returns></returns>
        public ActionResult GetPageProjectInfo()
        {
            string strWhere = "1=1";
            string sort     = Request["sort"] == null ? "FPlanCommitDate" : Request["sort"];
            string order    = Request["order"] == null ? "desc" : Request["order"];
            string view     = Request["view"] == null ? "" : Request["view"];

            //首先获取前台传递过来的参数
            int    pageindex = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]);  //输出的数据页码
            int    pagesize  = Request["rows"] == null ? 10 : Convert.ToInt32(Request["rows"]); //每页输出数量
            string FBillNo   = Request["FBillNo"] == null ? "" : Request["FBillNo"];
            string FName     = Request["FName"] == null ? "" : Request["FName"];
            //string isable = Request["isable"] == null ? "" : Request["isable"];
            string FModel          = Request["FModel"] == null ? "" : Request["FModel"];
            string FStatus         = Request["FStatus"] == null ? "" : Request["FStatus"];
            string FPlanCommitDate = Request["FPlanCommitDate"] == null ? "" : Request["FPlanCommitDate"];

            if (FBillNo.Trim() != "" && !SqlInjection.GetString(FBillNo))   //防止sql注入
            {
                strWhere += string.Format(" and FBillNo like '%{0}%'", FBillNo.Trim());
            }

            if (FName.Trim() != "" && !SqlInjection.GetString(FName))   //防止sql注入
            {
                strWhere += string.Format(" and FName like '%{0}%'", FName.Trim());
            }

            if (FModel.Trim() != "" && !SqlInjection.GetString(FModel))   //防止sql注入
            {
                strWhere += string.Format(" and FModel like '%{0}%'", FModel.Trim());
            }

            if (FStatus == "true")
            {
                strWhere += string.Format(" and FStatus > 2 ");
            }
            else
            {
                strWhere += string.Format(" and FStatus < 3 ");
            }


            if (FPlanCommitDate.Trim() != "")
            {
                strWhere += " and FPlanCommitDate > '" + FPlanCommitDate.Trim() + "'";
            }

            //抽取主作业计划单,规则不包含-、_两种连接符
            strWhere += " and Fbillno not like '%v_%'  ESCAPE   'v'  and  Fbillno not like '%v-%' ESCAPE   'v'";

            string content = "";

            if (view == "ProjectGrid")
            {
                int totalCount;   //输出参数
                //string strJson = new ProjectBLL().GetJsonPager("ICMO", "FBillNo,FStatus,FQty,FCommitQty,FPlanCommitDate,FPlanFinishDate,FStartDate,FFinishDate,FType,FWorkShop,FItemID", sort + " " + order, pagesize, pageindex, strWhere, out totalCount);
                string strJson = new ProjectBLL().GetJsonPager((pageindex - 1) * pagesize + 1, pageindex * pagesize, strWhere, out totalCount);
                content = "{\"total\": " + totalCount.ToString() + ",\"rows\":" + strJson + "}";
            }
            if (view == "ProjectGantt")
            {
                int totalCount;   //输出参数
                // pagesize = 5;//限制甘特图输出数据量
                DataTable dt      = new ProjectBLL().GetDataTablePager("ICMO", "FBillNo,FStatus,FPlanCommitDate,FPlanFinishDate,FStartDate,FFinishDate,FItemID", sort + " " + order, pagesize, pageindex, strWhere, out totalCount);
                string    strJson = ToGanttJson(dt);
                content = "{\"total\": " + totalCount.ToString() + ",\"rows\":" + strJson + "}";
            }

            return(Content(content));
        }
示例#18
0
        /// <summary>
        /// 项目管理甘特图的json数据
        /// </summary>
        /// <returns></returns>
        public ActionResult PMGanttJson()
        {
            string strWhere = "1=1";
            string sort     = Request["sort"] == null ? "CreateTime" : Request["sort"];
            string order    = Request["order"] == null ? "desc" : Request["order"];
            string view     = Request["view"] == null ? "" : Request["view"];

            //首先获取前台传递过来的参数
            int pageindex = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]);  //输出的数据页码
            int pagesize  = Request["rows"] == null ? 20 : Convert.ToInt32(Request["rows"]); //每页输出数量

            string ProjectNo       = Request["ProjectNo"] == null ? "": Request["ProjectNo"];
            string ProjectName     = Request["ProjectName"] == null ? "" : Request["ProjectName"];
            string ProjectManager  = Request["ProjectManager"] == null ? "" : Request["ProjectManager"];
            string ProjectClerk    = Request["ProjectClerk"] == null ? "" : Request["ProjectClerk"];
            string txtAddBeginDate = Request["txtAddBeginDate"] == null ? "" : Request["txtAddBeginDate"];
            string txtAddEndDate   = Request["txtAddEndDate"] == null ? "" : Request["txtAddEndDate"];

            if (ProjectNo.Trim() != "" && !SqlInjection.GetString(ProjectNo))   //防止sql注入
            {
                strWhere += string.Format(" and ProjectNo like '%{0}%'", ProjectNo.Trim());
            }

            if (ProjectName.Trim() != "" && !SqlInjection.GetString(ProjectName))   //防止sql注入
            {
                strWhere += string.Format(" and ProjectName like '%{0}%'", ProjectName.Trim());
            }

            if (ProjectManager.Trim() != "" && !SqlInjection.GetString(ProjectManager))   //防止sql注入
            {
                strWhere += string.Format(" and ProjectManager = '{0}'", ProjectManager.Trim());
            }

            if (txtAddBeginDate.Trim() != "")
            {
                strWhere += " and CreateTime > '" + txtAddBeginDate.Trim() + "'";
            }
            if (txtAddEndDate.Trim() != "")
            {
                strWhere += " and CreateTime < '" + txtAddEndDate.Trim() + "'";
            }

            int       totalCount; //输出参数
            DataTable projectdt = AchieveCommon.SqlPagerHelper.GetPager("tbProject", "ProjectID,ProjectNo,ProjectName,ProjectManager,ProjectClerk,CreateBy,CreateTime,UpdateTime,UpdateBy,Remark", sort + " " + order, pagesize, pageindex, strWhere, out totalCount);


            StringBuilder jsonResult = new StringBuilder();

            jsonResult.Append("[");

            // foreach (DataRow dr in projectdt.Rows)
            for (int i = 0; i < projectdt.Rows.Count; i++)
            {
                projectInfo pi = new projectInfo();
                pi.ProjectID   = projectdt.Rows[i]["ProjectID"].ToString();
                pi.ProjectNo   = projectdt.Rows[i]["ProjectNo"].ToString();
                pi.ProjectName = projectdt.Rows[i]["ProjectName"].ToString();
                //查询子表,获取项目节点信息
                string    sql2   = string.Format("select NodeID,NodeName,PSTime,PETime,RSTime,RETime from tbMgrNodeInfo where ProjectID='{0}'", projectdt.Rows[i]["ProjectID"]);
                DataTable dtnode = AchieveCommon.SqlHelper.GetDataTable(SqlHelper.connStr, sql2);
                foreach (DataRow rownode in dtnode.Rows)
                {
                    if (rownode["NodeID"].ToString() == "2")
                    {
                        pi.business.NodeName = rownode["NodeName"].ToString();
                        pi.business.PSTime   = rownode["PSTime"] is DBNull?DateTime.Now:Convert.ToDateTime(rownode["PSTime"]);
                        pi.business.PETime   = rownode["PETime"]  is DBNull ? DateTime.Now : Convert.ToDateTime(rownode["PETime"]);
                        pi.business.RSTime   = rownode["RSTime"]  is DBNull ? DateTime.Now : Convert.ToDateTime(rownode["RSTime"]);
                        pi.business.RETime   = rownode["RETime"]  is DBNull ? DateTime.Now : Convert.ToDateTime(rownode["RETime"]);
                    }
                    else if (rownode["NodeID"].ToString() == "3")
                    {
                        pi.technology.NodeName = rownode["NodeName"].ToString();
                        pi.technology.PSTime   = rownode["PSTime"]  is DBNull ? DateTime.Now : Convert.ToDateTime(rownode["PSTime"]);
                        pi.technology.PETime   = rownode["PETime"]  is DBNull ? DateTime.Now : Convert.ToDateTime(rownode["PETime"]);
                        pi.technology.RSTime   = rownode["RSTime"]  is DBNull ? DateTime.Now : Convert.ToDateTime(rownode["RSTime"]);
                        pi.technology.RETime   = rownode["RETime"]  is DBNull ? DateTime.Now : Convert.ToDateTime(rownode["RETime"]);
                    }
                    else if (rownode["NodeID"].ToString() == "4")
                    {
                        pi.design.NodeName = rownode["NodeName"].ToString();
                        pi.design.PSTime   = rownode["PSTime"]  is DBNull ? DateTime.Now : Convert.ToDateTime(rownode["PSTime"]);
                        pi.design.PETime   = rownode["PETime"]  is DBNull ? DateTime.Now : Convert.ToDateTime(rownode["PETime"]);
                        pi.design.RSTime   = rownode["RSTime"]  is DBNull ? DateTime.Now : Convert.ToDateTime(rownode["RSTime"]);
                        pi.design.RETime   = rownode["RETime"]  is DBNull ? DateTime.Now : Convert.ToDateTime(rownode["RETime"]);
                    }
                    else if (rownode["NodeID"].ToString() == "5")
                    {
                        pi.manufacture.NodeName = rownode["NodeName"].ToString();
                        pi.manufacture.PSTime   = rownode["PSTime"]  is DBNull ? DateTime.Now : Convert.ToDateTime(rownode["PSTime"]);
                        pi.manufacture.PETime   = rownode["PETime"]  is DBNull ? DateTime.Now : Convert.ToDateTime(rownode["PETime"]);
                        pi.manufacture.RSTime   = rownode["RSTime"]  is DBNull ? DateTime.Now : Convert.ToDateTime(rownode["RSTime"]);
                        pi.manufacture.RETime   = rownode["RETime"]  is DBNull ? DateTime.Now : Convert.ToDateTime(rownode["RETime"]);
                    }
                    else if (rownode["NodeID"].ToString() == "6")
                    {
                        pi.construction.NodeName = rownode["NodeName"].ToString();
                        pi.construction.PSTime   = rownode["PSTime"]  is DBNull ? DateTime.Now : Convert.ToDateTime(rownode["PSTime"]);
                        pi.construction.PETime   = rownode["PETime"]  is DBNull ? DateTime.Now : Convert.ToDateTime(rownode["PETime"]);
                        pi.construction.RSTime   = rownode["RSTime"]  is DBNull ? DateTime.Now : Convert.ToDateTime(rownode["RSTime"]);
                        pi.construction.RETime   = rownode["RETime"]  is DBNull ? DateTime.Now : Convert.ToDateTime(rownode["RETime"]);
                    }
                }
                //根据项目对象拼接字符串

                jsonResult.Append("{\"name\":");
                jsonResult.AppendFormat("\"{0}\",", pi.ProjectName);
                //jsonResult.AppendFormat("\"{0} {1}\",", pi.ProjectNo, pi.ProjectName);
                jsonResult.AppendFormat("\"desc\": \"{0}\",", "计划时间");
                jsonResult.AppendFormat("\"values\":[");

                //商务计划时间
                jsonResult.AppendFormat("{{\"from\": \"{0}\",", DateHelper.DateTimeToMilliseconds(pi.business.PSTime).ToString());
                jsonResult.AppendFormat("\"to\": \"{0}\",", DateHelper.DateTimeToMilliseconds(pi.business.PETime).ToString());
                jsonResult.Append("\"label\":\"商务\",\"desc\":\"商务计划\",\"customClass\": \"ganttRed\"},");
                //技术方案计划时间
                jsonResult.AppendFormat("{{\"from\": \"{0}\",", DateHelper.DateTimeToMilliseconds(pi.technology.PSTime).ToString());
                jsonResult.AppendFormat("\"to\": \"{0}\",", DateHelper.DateTimeToMilliseconds(pi.technology.PETime).ToString());
                jsonResult.Append("\"label\":\"技术\",\"desc\":\"技术方案计划\",\"customClass\": \"ganttGreen\"},");
                //设计计划时间
                jsonResult.AppendFormat("{{\"from\": \"{0}\",", DateHelper.DateTimeToMilliseconds(pi.design.PSTime).ToString());
                jsonResult.AppendFormat("\"to\": \"{0}\",", DateHelper.DateTimeToMilliseconds(pi.design.PETime).ToString());
                jsonResult.Append("\"label\":\"设计\",\"desc\":\"设计计划\",\"customClass\": \"ganttOrange\"},");
                //生产管理计划时间
                jsonResult.AppendFormat("{{\"from\": \"{0}\",", DateHelper.DateTimeToMilliseconds(pi.manufacture.PSTime).ToString());
                jsonResult.AppendFormat("\"to\": \"{0}\",", DateHelper.DateTimeToMilliseconds(pi.manufacture.PETime).ToString());
                jsonResult.Append("\"label\":\"生产\",\"desc\":\"生产计划\",\"customClass\": \"ganttRed\"},");
                //施工计划时间
                jsonResult.AppendFormat("{{\"from\": \"{0}\",", DateHelper.DateTimeToMilliseconds(pi.construction.PSTime).ToString());
                jsonResult.AppendFormat("\"to\": \"{0}\",", DateHelper.DateTimeToMilliseconds(pi.construction.PETime).ToString());
                jsonResult.Append("\"label\":\"施工\",\"desc\":\"施工计划\",\"customClass\": \"ganttGreen\"}");
                jsonResult.Append("]},");
                //实际时间
                jsonResult.Append("{\"name\":");
                jsonResult.AppendFormat("\"{0}\",", pi.ProjectNo);
                jsonResult.AppendFormat("\"desc\": \"{0}\",", "实际时间");
                jsonResult.AppendFormat("\"values\":[");
                //商务实际时间
                jsonResult.AppendFormat("{{\"from\": \"{0}\",", DateHelper.DateTimeToMilliseconds(pi.business.RSTime).ToString());
                jsonResult.AppendFormat("\"to\": \"{0}\",", DateHelper.DateTimeToMilliseconds(pi.business.RETime).ToString());
                jsonResult.Append("\"label\":\"商务\",\"desc\":\"商务实际\",\"customClass\": \"ganttRed\"},");
                //技术方案实际时间
                jsonResult.AppendFormat("{{\"from\": \"{0}\",", DateHelper.DateTimeToMilliseconds(pi.technology.RSTime).ToString());
                jsonResult.AppendFormat("\"to\": \"{0}\",", DateHelper.DateTimeToMilliseconds(pi.technology.RETime).ToString());
                jsonResult.Append("\"label\":\"技术\",\"desc\":\"技术方案实际\",\"customClass\": \"ganttGreen\"},");
                //设计实际时间
                jsonResult.AppendFormat("{{\"from\": \"{0}\",", DateHelper.DateTimeToMilliseconds(pi.design.RSTime).ToString());
                jsonResult.AppendFormat("\"to\": \"{0}\",", DateHelper.DateTimeToMilliseconds(pi.design.RETime).ToString());
                jsonResult.Append("\"label\":\"设计\",\"desc\":\"设计实际\",\"customClass\": \"ganttOrange\"},");
                //生产管理实际时间
                jsonResult.AppendFormat("{{\"from\": \"{0}\",", DateHelper.DateTimeToMilliseconds(pi.manufacture.RSTime).ToString());
                jsonResult.AppendFormat("\"to\": \"{0}\",", DateHelper.DateTimeToMilliseconds(pi.manufacture.RETime).ToString());
                jsonResult.Append("\"label\":\"生产\",\"desc\":\"生产实际\",\"customClass\": \"ganttRed\"},");
                //施工实际时间
                jsonResult.AppendFormat("{{\"from\": \"{0}\",", DateHelper.DateTimeToMilliseconds(pi.construction.RSTime).ToString());
                jsonResult.AppendFormat("\"to\": \"{0}\",", DateHelper.DateTimeToMilliseconds(pi.construction.RETime).ToString());
                jsonResult.Append("\"label\":\"施工\",\"desc\":\"施工实际\",\"customClass\": \"ganttGreen\"}");

                if (i < projectdt.Rows.Count - 1)//判断是否最后行
                {
                    jsonResult.Append("]},");
                }
                else
                {
                    jsonResult.Append("]}]");
                }
            }
            return(Content("{\"total\": " + totalCount + ",\"rows\":" + jsonResult.ToString() + "}"));
        }
示例#19
0
        /// <summary>
        /// 项目清单的查询处理
        /// </summary>
        /// <returns></returns>
        public ActionResult GetAllPMInfo()
        {
            string strWhere = "1=1";
            string sort     = Request["sort"] == null ? "ProjectID" : Request["sort"];
            string order    = Request["order"] == null ? "desc" : Request["order"];
            string view     = Request["view"] == null ? "PMMaintain" : Request["view"];

            //首先获取前台传递过来的参数
            int pageindex = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]);  //输出的数据页码
            int pagesize  = Request["rows"] == null ? 10 : Convert.ToInt32(Request["rows"]); //每页输出数量

            string ProjectID   = Request["ProjectID"] == null ? "" : Request["ProjectID"];
            string ProjectNo   = Request["ProjectNo"] == null ? "" : Request["ProjectNo"];
            string ProjectName = Request["ProjectName"] == null ? "" : Request["ProjectName"];

            string CreateTimeS = Request["CreateTime"] == null ? "" : Request["CreateTime"];
            string CreateTimeE = Request["CreateTime"] == null ? "" : Request["CreateTime"];

            if (ProjectID.Trim() != "" && !SqlInjection.GetString(ProjectID))   //防止sql注入
            {
                strWhere += string.Format(" and ProjectID = '{0}'", ProjectID.Trim());
            }
            if (ProjectNo.Trim() != "" && !SqlInjection.GetString(ProjectNo))
            {
                strWhere += string.Format(" and ProjectNo like '%{0}%'", ProjectNo.Trim());
            }
            if (ProjectName.Trim() != "" && !SqlInjection.GetString(ProjectName))
            {
                strWhere += string.Format(" and ProjectName like '%{0}%'", ProjectName.Trim());
            }

            if (CreateTimeS.Trim() != "")
            {
                strWhere += " and CreateTime > '" + CreateTimeS.Trim() + "'";
            }
            if (CreateTimeE.Trim() != "")
            {
                strWhere += " and CreateTime < '" + CreateTimeE.Trim() + "'";
            }

            string content = "";

            if (view == "PMMaintain")
            {
                int       totalCount; //输出参数
                DataTable dt = AchieveCommon.SqlPagerHelper.GetPager("tbProject", "ProjectID,ProjectNo,ProjectName,ProjectManager,ProjectClerk,CreateBy,CreateTime,UpdateTime,UpdateBy,Remark", sort + " " + order, pagesize, pageindex, strWhere, out totalCount);
                //string strJson = new ProjectBLL().GetJsonPager("ICMO", "FBillNo,FStatus,FQty,FCommitQty,FPlanCommitDate,FPlanFinishDate,FStartDate,FFinishDate,FType,FWorkShop,FItemID", sort + " " + order, pagesize, pageindex, strWhere, out totalCount);
                string strJson = AchieveCommon.JsonHelper.ToJson(dt);
                content = "{\"total\": " + totalCount.ToString() + ",\"rows\":" + strJson + "}";
            }
            if (view == "PMGantt")
            {
                int totalCount;   //输出参数
                // pagesize = 5;//限制甘特图输出数据量
                //DataTable dt = new ProjectBLL().GetDataTablePager("ICMO", "FBillNo,FStatus,FPlanCommitDate,FPlanFinishDate,FStartDate,FFinishDate,FItemID", sort + " " + order, pagesize, pageindex, strWhere, out totalCount);
                //string strJson = ToGanttJson(dt);
                //content = "{\"total\": " + totalCount.ToString() + ",\"rows\":" + strJson + "}";
            }

            return(Content(content));
        }