Ejemplo n.º 1
0
 public dalProduct(Loginer loginer)
     : base(loginer)
 {
     _KeyName   = tb_Product.__KeyName;   //主键字段
     _TableName = tb_Product.__TableName; //表名
     _ModelType = typeof(tb_Product);
 }
Ejemplo n.º 2
0
    public byte[] GetBackupHistory(byte[] loginTicket, int topList)
    {
        Loginer   loginer = WebServiceSecurity.ValidateLoginer(loginTicket);
        DataTable data    = new dalCommon(null).GetBackupHistory(topList);

        return(ZipTools.CompressionDataSet(ServerLibrary.TableToDataSet(data)));
    }
Ejemplo n.º 3
0
    public byte[] SearchOutstanding(byte[] loginTicket, string invoiceNo, string customer, DateTime dateFrom, DateTime dateTo, DateTime dateEnd, string outstandingType)
    {
        Loginer   loginer = WebServiceSecurity.ValidateLoginer(loginTicket);
        DataTable data    = new dalCommon(loginer).SearchOutstanding(invoiceNo, customer, dateFrom, dateTo, dateEnd, outstandingType);

        return(ZipTools.CompressionDataSet(ServerLibrary.TableToDataSet(data)));
    }
Ejemplo n.º 4
0
        /// <summary>
        /// 使用可能なクッキーを使ってニコニコにログインします。
        /// </summary>
        public static void LoginWithAvailableCookie(LoginModel loginModel)
        {
            var browserType = loginModel.AvailableCookieBrowser;

            if (browserType == null)
            {
                MessageUtil.ErrorMessage(
                    "ブラウザが指定されていません (>◇< )");
                return;
            }

            // ログインデータがクッキーを持っていたらそれを使い、
            // 持っていなければブラウザから取得します。
            if (loginModel.AvailableCookieContainer == null)
            {
                var cc = Loginer.LoginWithBrowser(
                    loginModel.BrowserValue.Key,
                    false);

                ValidateCookie(loginModel, cc);
            }
            else
            {
                ValidateCookie(loginModel, loginModel.AvailableCookieContainer);
            }
        }
Ejemplo n.º 5
0
    public bool SaveFieldDef(byte[] loginTicket, byte[] data)
    {
        Loginer loginer = WebServiceSecurity.ValidateLoginer(loginTicket);
        DataSet ds      = ZipTools.DecompressionDataSet(data);

        return(new dalEditLogHistory(loginer).SaveFieldDef(ds.Tables[0]));
    }
Ejemplo n.º 6
0
 public dalCommonDataDict(Loginer loginer)
     : base(loginer)
 {
     _KeyName   = tb_CommonDataDict.__KeyName;   //主键字段
     _TableName = tb_CommonDataDict.__TableName; //表名
     _ModelType = typeof(tb_CommonDataDict);     //字典表ORM
 }
Ejemplo n.º 7
0
 public dalCompanyInfo(Loginer loginer)
     : base(loginer)
 {
     _TableName = tb_CompanyInfo.__TableName;
     _KeyName   = tb_CompanyInfo.__KeyName;
     _ModelType = typeof(tb_CompanyInfo);
 }
Ejemplo n.º 8
0
        public void WriteLogOP(byte[] loginTicket, string sFunID, string sFSubunID, string sFdesc, string sSql)
        {
            Loginer loginer = WebServiceSecurity.ValidateLoginer(loginTicket);

            //dalLog.InsertLog(loginer, sFunID, sFSubunID, sFdesc, sSql);
            new dalCommon(loginer).WriteLogOP(sFunID, sFSubunID, sFdesc, sSql);
        }
Ejemplo n.º 9
0
 public dalCustomer(Loginer loginer)
     : base(loginer)
 {
     _KeyName   = tb_Customer.__KeyName;   //主键字段
     _TableName = tb_Customer.__TableName; //表名
     _ModelType = typeof(tb_Customer);
 }
Ejemplo n.º 10
0
 public dalAttachFile(Loginer loginer)
     : base(loginer)
 {
     _TableName = tb_AttachFile.__TableName;
     _KeyName   = tb_AttachFile.__KeyName;
     _ModelType = typeof(tb_AttachFile);
 }
Ejemplo n.º 11
0
 public dalITEM(Loginer loginer)
     : base(loginer)
 {
     _KeyName   = tb_ITEM.__KeyName;   //主键字段
     _TableName = tb_ITEM.__TableName; //表名
     _ModelType = typeof(tb_ITEM);
 }
Ejemplo n.º 12
0
        public int GetMenuShow(byte[] loginTicket, string account, int moduleID)
        {
            Loginer loginer = WebServiceSecurity.ValidateLoginer(loginTicket);
            object  o       = new dalUserGroup(loginer).GetMenuShow(account, moduleID);

            return(Convert.ToInt32(o));
        }
Ejemplo n.º 13
0
        public byte[] G_GetFormTagCustomName(byte[] loginTicket)
        {
            Loginer   loginer = WebServiceSecurity.ValidateLoginer(loginTicket);
            DataTable data    = new dalUserGroup(loginer).GetFormTagCustomName();

            return(ZipTools.CompressionObject(DataConverter.TableToDataSet(data)));
        }
Ejemplo n.º 14
0
        public byte[] G_GetAuthorityItem(byte[] loginTicket, string sFunID)
        {
            Loginer   loginer = WebServiceSecurity.ValidateLoginer(loginTicket);
            DataTable data    = new dalUserGroup(loginer).GetAuthorityItem(sFunID);

            return(ZipTools.CompressionObject(DataConverter.TableToDataSet(data)));
        }
Ejemplo n.º 15
0
 public dalAccountIDs(Loginer loginer)
     : base(loginer)
 {
     _KeyName   = tb_AccountIDs.__KeyName;   //主键字段
     _TableName = tb_AccountIDs.__TableName; //表名
     _ModelType = typeof(tb_AccountIDs);
 }
Ejemplo n.º 16
0
 public dalPerson(Loginer loginer)
     : base(loginer)
 {
     _KeyName   = tb_Person.__KeyName;   //主键字段
     _TableName = tb_Person.__TableName; //表名
     _ModelType = typeof(tb_Person);
 }
Ejemplo n.º 17
0
        public Loginer Login(string uname, string pwd)
        {
            Loginer userer = null;

            try
            {
                using (var sql = SugarDbContext.GetInstance())
                {
                    var user = sql.Queryable <Opers>().Where(s => s.userName == uname && s.password == pwd)
                               .First();
                    if (user == null)
                    {
                        return(null);
                    }
                    userer = new Loginer();
                    //存储登录用户信息
                    userer.Account     = user.userName;
                    userer.AccountName = user.operName;
                    userer.LoginTime   = DateTime.Now;
                }
            }
            catch (Exception e)
            {
                LogNHelper.Exception(e);
            }

            return(userer);
        }
        /// <summary>
        /// 检查用户登录凭证,验证通过才允许访问后台数据.
        /// </summary>
        /// <param name="loginer">用户登录凭证</param>
        /// <returns></returns>
        public static Loginer ValidateLoginer(byte[] loginer)
        {
            //用户登录信息的长度小于伪码长度,数据包无效!
            if (loginer.Length < PREFIX_LEN + SUFFIX_LEN)
            {
                return(null);
            }

            try
            {
                //用户登录信息的长度
                byte[] objectArrar = new byte[loginer.Length - (PREFIX_LEN + SUFFIX_LEN)];

                //复制用户登录信息的数据包(去掉前后伪码)
                Array.Copy(loginer, PREFIX_LEN, objectArrar, 0, objectArrar.Length);

                //转换为用户对象
                Loginer user = (Loginer)ZipTools.DecompressionObject(objectArrar);
                if (user.Account.Length >= 1) //系统限制用户帐号的长度必须大于或等于1位
                {
                    return(user);             //转换成功,返回用户对象.
                }
                else
                {
                    throw new Exception("用户帐号不正确!");
                }
            }
            catch
            {
                throw new Exception("验证用户资料失败!");
            }
        }
Ejemplo n.º 19
0
    public byte[] AR_GetReportData(byte[] loginTicket, string DocNoFrom, string DocNoTo, DateTime DateFrom, DateTime DateTo)
    {
        Loginer loginer = WebServiceSecurity.ValidateLoginer(loginTicket);
        DataSet data    = new dalAR(loginer).GetReportData(DocNoFrom, DocNoTo, DateFrom, DateTo);

        return(ZipTools.CompressionDataSet(data));
    }
Ejemplo n.º 20
0
    public byte[] G_GetUserGroupByCode(byte[] loginTicket, string groupCode)
    {
        Loginer loginer = WebServiceSecurity.ValidateLoginer(loginTicket);
        DataSet ds      = new dalUserGroup(loginer).GetUserGroup(groupCode);

        return(ZipTools.CompressionDataSet(ds));
    }
Ejemplo n.º 21
0
    public byte[] G_GetFormTagCustomName(byte[] loginTicket)
    {
        Loginer   loginer = WebServiceSecurity.ValidateLoginer(loginTicket);
        DataTable dt      = new dalUserGroup(loginer).GetFormTagCustomName();

        return(ZipTools.CompressionDataSet(ServerLibrary.TableToDataSet(dt)));
    }
Ejemplo n.º 22
0
        public bool Login(LoginUser loginUser)
        {
            //调用数据访问层的接口检查用户登录
            //用户登录前尚未创建Loginer对象,所有传null值
            IBridge_User bridge = BridgeFactory.CreateUserBridge();
            DataTable    data   = bridge.Login(loginUser, Char.Parse(LoginUserType.S.ToString()));

            if (data.Rows.Count == 0)
            {
                throw new CustomException("登录失败,请检查用户名和密码!");
            }
            DataRow row = data.Rows[0];

            //用户实例,登录成功
            Loginer user = new Loginer();

            user.Account     = ConvertEx.ToString(row[TUser.Account]);
            user.AccountName = ConvertEx.ToString(row[TUser.UserName]);
            user.FlagAdmin   = ConvertEx.ToString(row[TUser.FlagAdmin]);
            user.Email       = ConvertEx.ToString(row[TUser.Email]);
            user.LoginTime   = DateTime.Now;

            //参数:dataSet: 帐套编号, 从帐套字典表获取DBName,DataSetID,DataSetName三个字段的值
            //给下面三个属性赋值
            user.DBName    = loginUser.DataSetDBName; //重要:在数据层根据DBName设置连接数据库
            user.DataSetID = loginUser.DataSetID;

            Loginer.CurrentUser = user;                                             //保存当前用户

            SystemAuthentication.UserAuthorities = bridge.GetUserAuthorities(user); //下载用户权限

            return(true);
        }
Ejemplo n.º 23
0
 public dalIN(Loginer loginer)
     : base(loginer)
 {
     _SummaryTableName     = tb_IN.__TableName;
     _SummaryKeyName       = tb_IN.__KeyName;
     _UpdateSummaryKeyMode = UpdateKeyMode.OnlyDocumentNo;
 }
Ejemplo n.º 24
0
 public dalFunction(Loginer loginer)
     : base(loginer)
 {
     _TableName = tb_sys_Function.__TableName;
     _KeyName   = tb_sys_Function.__KeyName;
     _ModelType = typeof(tb_sys_Function);
 }
Ejemplo n.º 25
0
 public dalUser(Loginer loginer)
     : base(loginer)
 {
     _KeyName   = TUser.__KeyName;   //主键字段
     _TableName = TUser.__TableName; //表名
     _ModelType = typeof(TUser);
 }
Ejemplo n.º 26
0
        /// <summary>
        /// 验证账号与密码
        /// </summary>
        /// <param name="objLogin"></param>
        /// <returns></returns>
        public Loginer LoginConfirm(Loginer objLogin)
        {
            string sql = "select SalePersonName from SalesPerson where SalePersonId=@SalePersonId and LoginPwd=@LoginPwd";

            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@SalePersonId", objLogin.LoginId),
                new SqlParameter("@LoginPwd", objLogin.LoginPwd)
            };

            try
            {
                object obj = SQLHelper.GetSingleResult(sql, param);
                if (obj != null)
                {
                    objLogin.LoginName = obj.ToString();
                    return(objLogin);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 /// <summary>
 /// 构造器
 /// </summary>
 /// <param name="loginer">当前用户登录信息</param>
 /// <param name="tableName">字典表名</param>
 /// <param name="keyName">主键字段名</param>
 /// <param name="modelType">数据字典的ORM类</param>
 public dalBaseDataDict(Loginer loginer, string tableName, string keyName, Type modelType)
     : base(loginer)
 {
     _ModelType = modelType;
     _TableName = tableName;
     _KeyName   = keyName;
 }
Ejemplo n.º 28
0
 /// <summary>
 /// 构造器
 /// </summary>
 /// <param name="loginer">当前登录用户</param>
 public dalAP(Loginer loginer)
     : base(loginer)
 {
     _SummaryKeyName       = tb_AP.__KeyName;              //主表的主键字段
     _SummaryTableName     = tb_AP.__TableName;            //主表表名
     _UpdateSummaryKeyMode = UpdateKeyMode.OnlyDocumentNo; //单据号码生成模式
 }
Ejemplo n.º 29
0
 public dalSUPPLIERCUSTOMER(Loginer loginer)
     : base(loginer)
 {
     _KeyName   = tb_SUPPLIERCUSTOMER.__KeyName;   //主键字段
     _TableName = tb_SUPPLIERCUSTOMER.__TableName; //表名
     _ModelType = typeof(tb_SUPPLIERCUSTOMER);
 }
Ejemplo n.º 30
0
 /// <summary>
 /// 构造器
 /// </summary>
 /// <param name="loginer">当前登录用户</param>
 public dalAttachFile(Loginer loginer)
     : base(loginer)
 {
     _KeyName   = tb_sys_AttachFile.__KeyName;   //主键字段
     _TableName = tb_sys_AttachFile.__TableName; //表名
     _ModelType = typeof(tb_sys_AttachFile);
 }
Ejemplo n.º 31
0
        /// <summary>
        /// 写入日志
        /// </summary>
        /// <param name="logUser"></param>
        public static void InsertLog(Loginer logUser,string sFunID,string sFSubunID,string sFdesc,string sSql)
        {
            string sql = "insert into sys_log( FID, FDate, FUserID, FFunctionID, FSubFunctionID, FDescription, FMachineName, FIPAddress, FSQL) ";
            sql += " values(" + DocNoTool.GetTableID(logUser.DBName, "sys_log", "FID") + ",";
            if (logUser.DbType == DbAcessTyp.Oracle)
                sql += "sysdate,";
            else
                sql += "getdate(),";
            sql += logUser.Fid + "," + sFunID + "," + sFSubunID + ",'" + sFdesc + "','" + logUser.MachineName + "','" + logUser.IPAddress + "','" + sSql + "')";

            new DataBaseLayer(logUser.DBName).ExecuteSql(sql);
        }
Ejemplo n.º 32
0
 /// <summary>
 /// 查询日志数据 第二个参数为查询条件
 /// </summary>
 /// <param name="logUser"></param>
 /// <param name="sFilter"></param>
 /// <returns></returns>
 public static DataSet GetLog(Loginer logUser,string sFilter)
 {
     DataSet ds;
     string sql = "SELECT     l.FID, l.FDate, u.FAccount, u.FUserName, f.FNumber AS FunNum, f.FName AS FunName, fs.FNumber AS FsubNum, fs.FName AS FsubName, l.FDescription, " +
              " l.FMachineName, l.FIPAddress, l.FSQL " +
              " FROM         sys_log AS l INNER JOIN " +
              " sys_User AS u ON l.FUserID = u.FID LEFT OUTER JOIN " +
              " sys_Function AS f ON l.FFunctionID = f.FID LEFT OUTER JOIN " +
              " sys_Fun_MenuBar AS fs ON l.FSubFunctionID = fs.FID where 1=1 " + sFilter;
     ds = new DataBaseLayer(logUser.DBName).Query(sql);
     return ds;
 }