コード例 #1
0
ファイル: GAccount.cs プロジェクト: xupeihong/.netYJY
        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);
        }
コード例 #2
0
ファイル: SQLBase.cs プロジェクト: xupeihong/.netYJY
 public static int GetDBCount(String strSql)
 {
     return(GFun.SafeToInt32(ExecuteScalar(strSql)));
 }
コード例 #3
0
ファイル: COM_ApprovalPro.cs プロジェクト: xupeihong/.netYJY
        public static string GetSPid(string folderBack)
        {
            string[]    arr     = folderBack.Split('/');
            Acc_Account account = GAccount.GetAccountInfo();
            int         unitId  = Convert.ToInt16(account.UnitID);
            string      strPID  = "";
            string      strYMD  = DateTime.Now.ToString("yyMMdd");

            string    strSelPID = "select SPID, SPidNo from [" + arr[0] + "].." + arr[6] + " where DateRecord='" + strYMD + "'";
            DataTable dtPMaxID  = SQLBase.FillTable(strSelPID);
            int       intNewID  = 0;

            if (dtPMaxID == null)
            {
                return(strPID);
            }
            if (dtPMaxID.Rows.Count == 0)
            {
                string strInsertID = "insert into [" + arr[0] + "].." + arr[6] + " (SPID,SPidNo,DateRecord) values('P',0,'" + strYMD + "')";
                SQLBase.ExecuteNonQuery(strInsertID);
                intNewID = 0;
            }
            else
            {
                intNewID = Convert.ToInt32(dtPMaxID.Rows[0]["SPidNo"]);
            }

            intNewID++;
            string strUpdateID = "update [" + arr[0] + "].." + arr[6] + " set SPidNo='" + intNewID + "' where DateRecord ='" + strYMD + "'";

            SQLBase.ExecuteNonQuery(strUpdateID);

            strPID = dtPMaxID.Rows[0]["SPID"].ToString() + DateTime.Now.ToString("yyMMdd") + GFun.GetNum(unitId, 4) + GFun.GetNum(intNewID, 4);
            return(strPID);
        }
コード例 #4
0
ファイル: SQLBase.cs プロジェクト: xupeihong/.netYJY
        public static int GetDBMax(String strField, String strTable)
        {
            String strSql = "Select max(" + strField + ") From " + strTable;

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