Example #1
0
        public static UIDataTable getEquipGrid(int a_intPageSize, int a_intPageIndex, string where, string order, string unit)
        {
            UIDataTable instData = new UIDataTable();

            SqlParameter[] sqlPar = new SqlParameter[]
            {
                new SqlParameter("@PageSize", a_intPageSize.ToString()),
                new SqlParameter("@StartIndex", (a_intPageSize * a_intPageIndex).ToString()),
                new SqlParameter("@Where", where),
                new SqlParameter("@Order", order),
                new SqlParameter("@UnitID", unit)
            };

            DataSet DO_Order = SQLBase.FillDataSet("getEquipNew", CommandType.StoredProcedure, sqlPar, "SupplyCnn");

            if (DO_Order == null)
            {
                instData.DtData        = null;
                instData.IntRecords    = 0;
                instData.IntTotalPages = 0;
                return(instData);
            }

            DataTable  dtOrder = DO_Order.Tables[0];
            DataColumn c       = new DataColumn();

            c.ColumnName = "xu";
            dtOrder.Columns.Add(c);
            for (int i = 0; i < dtOrder.Rows.Count; i++)
            {
                dtOrder.Rows[i]["xu"] = (i + 1);
            }
            instData.IntRecords = GFun.SafeToInt32(DO_Order.Tables[1].Rows[0][0]);
            if (instData.IntRecords > 0)
            {
                if (instData.IntRecords % a_intPageSize == 0)
                {
                    instData.IntTotalPages = instData.IntRecords / a_intPageSize;
                }
                else
                {
                    instData.IntTotalPages = instData.IntRecords / a_intPageSize + 1;
                }
            }
            else
            {
                instData.IntTotalPages = 0;
            }

            instData.DtData = dtOrder;
            return(instData);
        }
Example #2
0
        // 检测对比图-加载检测表列表
        public static UIDataTable LoadDetecList(int a_intPageSize, int a_intPageIndex, string where)
        {
            UIDataTable instData = new UIDataTable();

            SqlParameter[] sqlPar = new SqlParameter[]
            {
                new SqlParameter("@PageSize", a_intPageSize.ToString()),
                new SqlParameter("@StartIndex", (a_intPageSize * a_intPageIndex).ToString()),
                new SqlParameter("@Where", where)
            };
            DataSet DO_Order = SQLBase.FillDataSet("GetDetecList", CommandType.StoredProcedure, sqlPar, "FlowMeterDBCnn");

            //
            if (DO_Order == null)
            {
                instData.DtData        = null;
                instData.IntRecords    = 0;
                instData.IntTotalPages = 0;
                return(instData);
            }
            DataTable dtOrder = DO_Order.Tables[0];

            instData.IntRecords = GFun.SafeToInt32(DO_Order.Tables[1].Rows[0][0]);
            if (instData.IntRecords > 0)
            {
                if (instData.IntRecords % a_intPageSize == 0)
                {
                    instData.IntTotalPages = instData.IntRecords / a_intPageSize;
                }
                else
                {
                    instData.IntTotalPages = instData.IntRecords / a_intPageSize + 1;
                }
            }
            else
            {
                instData.IntTotalPages = 0;
            }

            //
            if (dtOrder != null && dtOrder.Rows.Count > 0)
            {
                for (int i = 0; i < dtOrder.Rows.Count; i++)
                {
                    dtOrder.Rows[i]["RowNumber"] = i + 1;
                }
            }

            instData.DtData = dtOrder;
            return(instData);
        }
Example #3
0
        public static UIDataTable getConditionGrid(int a_intPageSize, int a_intPageIndex, string where, string folderBack)
        {
            string[]    arr      = folderBack.Split('/');
            UIDataTable instData = new UIDataTable();

            SqlParameter[] sqlPar = new SqlParameter[]
            {
                new SqlParameter("@PageSize", a_intPageSize.ToString()),
                new SqlParameter("@StartIndex", (a_intPageSize * a_intPageIndex).ToString()),
                new SqlParameter("@Data", arr[0]),
                new SqlParameter("@Table", arr[1]),
                new SqlParameter("@Where", where)
            };

            DataSet DO_Order = SQLBase.FillDataSet("getCondition", CommandType.StoredProcedure, sqlPar, "AccountCnn");

            if (DO_Order == null)
            {
                instData.DtData        = null;
                instData.IntRecords    = 0;
                instData.IntTotalPages = 0;
                return(instData);
            }

            DataTable dtOrder = DO_Order.Tables[0];

            instData.IntRecords = GFun.SafeToInt32(DO_Order.Tables[1].Rows[0][0]);
            if (instData.IntRecords > 0)
            {
                if (instData.IntRecords % a_intPageSize == 0)
                {
                    instData.IntTotalPages = instData.IntRecords / a_intPageSize;
                }
                else
                {
                    instData.IntTotalPages = instData.IntRecords / a_intPageSize + 1;
                }
            }
            else
            {
                instData.IntTotalPages = 0;
            }

            instData.DtData = dtOrder;
            return(instData);
        }
Example #4
0
        public static UIDataTable getAptitudeGrid(int a_intPageSize, int a_intPageIndex, string where, string unitid)
        {
            UIDataTable instData = new UIDataTable();

            SqlParameter[] sqlPar = new SqlParameter[]
            {
                new SqlParameter("@PageSize", a_intPageSize.ToString()),
                new SqlParameter("@StartIndex", (a_intPageSize * a_intPageIndex).ToString()),
                new SqlParameter("@Where", where),
                new SqlParameter("@UnitID", unitid)
            };

            DataSet DO_Order = SQLBase.FillDataSet("getAptitude", CommandType.StoredProcedure, sqlPar, "SupplyCnn");

            if (DO_Order == null)
            {
                instData.DtData        = null;
                instData.IntRecords    = 0;
                instData.IntTotalPages = 0;
                return(instData);
            }

            DataTable dtOrder = DO_Order.Tables[0];

            instData.IntRecords = GFun.SafeToInt32(DO_Order.Tables[1].Rows[0][0]);
            if (instData.IntRecords > 0)
            {
                if (instData.IntRecords % a_intPageSize == 0)
                {
                    instData.IntTotalPages = instData.IntRecords / a_intPageSize;
                }
                else
                {
                    instData.IntTotalPages = instData.IntRecords / a_intPageSize + 1;
                }
            }
            else
            {
                instData.IntTotalPages = 0;
            }

            instData.DtData = dtOrder;
            return(instData);
        }
Example #5
0
        public static UIDataTable GetPayGrid(int a_intPageSize, int a_intPageIndex, string where)
        {
            UIDataTable instData = new UIDataTable();

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@PageSize", a_intPageSize),
                new SqlParameter("@StartIndex", (a_intPageIndex * a_intPageSize).ToString()),
                new SqlParameter("@Where", where)
            };
            DataSet DO_Order = SQLBase.FillDataSet("GetPayGrid", CommandType.StoredProcedure, para);

            if (DO_Order == null)
            {
                instData.DtData        = null;
                instData.IntRecords    = 0;
                instData.IntTotalPages = 0;
                return(instData);
            }
            DataTable dtOrder = DO_Order.Tables[0];

            instData.IntRecords = GFun.SafeToInt32(DO_Order.Tables[1].Rows[0][0]);
            if (instData.IntRecords > 0)
            {
                if (instData.IntRecords % a_intPageSize == 0)
                {
                    instData.IntTotalPages = instData.IntRecords / a_intPageSize;
                }
                else
                {
                    instData.IntTotalPages = instData.IntRecords / a_intPageSize + 1;
                }
            }
            else
            {
                instData.IntTotalPages = 0;
            }
            instData.DtData = dtOrder;
            return(instData);
        }
Example #6
0
        public static Acc_Account ValidateUser(string a_strUserName, string a_strPwd)
        {
            string      strError    = "";
            DataRow     oRow        = null;
            Acc_Account instAccount = new Acc_Account();
            DataTable   dt          = GetAccount(a_strUserName, GAccount.SystemID, ref strError);

            if (dt != null && dt.Rows.Count > 0)
            {
                oRow = dt.Rows[0];
                //instAccount.UserID = GFun.SafeToInt32(oRow[0]);
                //instAccount.UserName = GFun.SafeToString(oRow[1]);
                //instAccount.UnitID = GFun.SafeToString(oRow[2]);
                //instAccount.Rights = GFun.SafeToString(oRow[3]);
                //instAccount.UnitCode = GFun.SafeToString(oRow[4]);
                //instAccount.UnitName = GFun.SafeToString(oRow[5]);
                //instAccount.UnitBrief = GFun.SafeToString(oRow[6]);
                //instAccount.HigherUnitID = GFun.SafeToString(oRow[7]);
                //instAccount.Functions = GFun.SafeToString(oRow[8]);
                //instAccount.UserRole = GFun.SafeToString(oRow[9]);
                //instAccount.FunctionsCode = GFun.SafeToString(oRow[12]);
                //instAccount.BranchID = GFun.SafeToString(oRow[13]);
                //instAccount.BranchPCD = GFun.SafeToString(oRow[14]);
                //instAccount.BranchName = GFun.SafeToString(oRow[15]);

                instAccount.UserID        = GFun.SafeToInt32(oRow[0]);
                instAccount.UserName      = GFun.SafeToString(oRow[1]);
                instAccount.UnitID        = GFun.SafeToString(oRow[2]);
                instAccount.Rights        = GFun.SafeToString(oRow[3]);
                instAccount.UnitName      = GFun.SafeToString(oRow[4]);
                instAccount.FunctionsCode = GFun.SafeToString(oRow[5]);
                instAccount.UserRole      = GFun.SafeToString(oRow[6]);
                instAccount.UserMobile    = GFun.SafeToString(oRow[7]);
                instAccount.RoleNames     = GFun.SafeToString(oRow[8]);
                instAccount.Path          = GFun.SafeToString(oRow[9]);
                instAccount.Exjob         = GFun.SafeToString(oRow[10]);
            }
            return(instAccount);
        }
Example #7
0
        public static UIDataTable GetProductPlan(int a_intPageSize, int a_intPageIndex, string JHID)
        {
            UIDataTable instData    = new UIDataTable();
            string      strSelCount = "select COUNT(*) from [BGOI_Produce].[dbo].[tk_Product_PlanDetail] where JHID='" + JHID + "'";

            instData.IntRecords = GFun.SafeToInt32(SQLBase.ExecuteScalar(strSelCount));

            if (instData.IntRecords > 0)
            {
                instData.IntTotalPages = instData.IntRecords % a_intPageSize == 0 ? instData.IntRecords / a_intPageSize : instData.IntRecords / a_intPageSize + 1;
            }
            else
            {
                instData.IntTotalPages = 0;
            }
            string strFilter  = "JHID='" + JHID + "'";
            string strOrderBy = "JHID ";
            String strTable   = "[BGOI_Produce].[dbo].[tk_Product_PlanDetail]";
            String strField   = "JHID,DID,Name,Specifications,Finishedproduct,finishingproduct,Spareparts,notavailable,Total,plannumber,demandnumber,Remarks,OnlineCount";

            instData.DtData = SQLBase.FillTable(strField, strTable, strOrderBy, strFilter, a_intPageSize, a_intPageIndex);
            return(instData);
        }
Example #8
0
        public static Acc_Account GetAccountInfo(HttpContextBase httpContext)
        {
            String      strLoginName;
            Acc_Account oGAccountInfo = null;
            IPrincipal  user          = httpContext.User;

            if (!user.Identity.IsAuthenticated)
            {
                return(null);
            }

            try
            {
                oGAccountInfo = (httpContext.Session[KEY_CACHEUSER]) as Acc_Account;
            }
            catch
            {
            }

            if (oGAccountInfo != null)
            {
                return(oGAccountInfo);
            }

            strLoginName            = user.Identity.Name.Split('^')[0];
            oGAccountInfo           = new Acc_Account();
            oGAccountInfo.LoginName = strLoginName;

            string  strError = "";
            DataRow oRow     = null;

            DataTable dt = GetAccount(strLoginName, SystemID.ToString(), ref strError); //SQLBase.FillTable(strSql, AccountCnn);

            if (dt != null && dt.Rows.Count > 0)
            {
                oRow = dt.Rows[0];
                //oGAccountInfo.UserID = GFun.SafeToInt32(oRow[0]);
                //oGAccountInfo.UserName = GFun.SafeToString(oRow[1]);
                //oGAccountInfo.UnitID = GFun.SafeToString(oRow[2]);
                //oGAccountInfo.Rights = GFun.SafeToString(oRow[3]);
                //oGAccountInfo.UnitCode = GFun.SafeToString(oRow[4]);
                //oGAccountInfo.UnitName = GFun.SafeToString(oRow[5]);
                //oGAccountInfo.UnitBrief = GFun.SafeToString(oRow[6]);
                //oGAccountInfo.HigherUnitID = GFun.SafeToString(oRow[7]);
                //oGAccountInfo.Functions = GFun.SafeToString(oRow[8]);
                //oGAccountInfo.UserRole = GFun.SafeToString(oRow[9]);

                oGAccountInfo.UserID        = GFun.SafeToInt32(oRow[0]);
                oGAccountInfo.UserName      = GFun.SafeToString(oRow[1]);
                oGAccountInfo.UnitID        = GFun.SafeToString(oRow[2]);
                oGAccountInfo.Rights        = GFun.SafeToString(oRow[3]);
                oGAccountInfo.UnitName      = GFun.SafeToString(oRow[4]);
                oGAccountInfo.FunctionsCode = GFun.SafeToString(oRow[5]);
                oGAccountInfo.UserRole      = GFun.SafeToString(oRow[6]);
                oGAccountInfo.UserMobile    = GFun.SafeToString(oRow[7]);
                oGAccountInfo.RoleNames     = GFun.SafeToString(oRow[8]);
                oGAccountInfo.Path          = GFun.SafeToString(oRow[9]);
                oGAccountInfo.Exjob         = GFun.SafeToString(oRow[10]);
            }

            //设置Session
            httpContext.Session[KEY_CACHEUSER] = oGAccountInfo;

            return(oGAccountInfo);
        }
Example #9
0
 public static int GetDBCount(String strSql)
 {
     return(GFun.SafeToInt32(ExecuteScalar(strSql)));
 }
Example #10
0
        public static int GetDBMax(String strField, String strTable)
        {
            String strSql = "Select max(" + strField + ") From " + strTable;

            return(GFun.SafeToInt32(ExecuteScalar(strSql)));
        }