Exemple #1
0
 private void updateName()
 {
     if (!string.IsNullOrEmpty(VesselName))
     {
         Name = VesselName;
     }
     else
     {
         Name = SystemID.ToString();
     }
 }
Exemple #2
0
 public string GetID()
 {
     if (MMSI != 0)
     {
         return("MMSI:" + MMSI.ToString());
     }
     else if (!string.IsNullOrEmpty(VesselName))
     {
         return("Name:" + VesselName);
     }
     else
     {
         return("ID:" + SystemID.ToString());
     }
 }
 public virtual void ResetSequenceNumber(Context context)
 {
     if (resetCommand == null)
     {
         //String connectionString = ConfigurationSettings.AppSettings["strConnectionString"].ToString();
         //SqlConnection adoCon = new SqlConnection(connectionString);
         System.Data.IDbConnection adoCon = context.PersistenceSession.Connection;
         resetCommand             = adoCon.CreateCommand();
         resetCommand.CommandText = "exec dbo.usp_ResetSequenceNo "
                                    + SystemID.ToString() + ","
                                    + SequenceType.ToString() + ","
                                    + SubsequenceType.ToString() + ";";
     }
     resetCommand.ExecuteNonQuery();
 }
Exemple #4
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);
        }