Esempio n. 1
0
        public bool UpdateStuffFinanceInfor(int StuffUserId, string StuffSAPNo, bool IsApprover, decimal?ApproveAmount)
        {
            int rowsAffected = 0;


            // 根据 StuffUserId 查找要修改的数据
            AuthorizationDS.StuffUserDataTable tab = this.StuffUserAdapter.GetDataById(StuffUserId);

            if (tab.Count == 0)
            {
                return(false);
            }
            try {
                // 进行传值
                AuthorizationDS.StuffUserRow row = tab[0];
                row.IsApprover = IsApprover;
                if (ApproveAmount != null)
                {
                    row.ApproveAmount = ApproveAmount.GetValueOrDefault();
                }
                else
                {
                    row.ApproveAmount = 0;
                }
                // 更新数据
                rowsAffected = this.StuffUserAdapter.Update(row);
            } catch (Exception e) {
                // put errors
                throw e;
            }
            return(rowsAffected == 1);
        }
Esempio n. 2
0
        public bool UpdateStuffUser(int StuffUserId, string StuffName, string StuffId, string UserName, string UserPassword, bool IsActive, string Telephone, string EMail, string EnglishName, DateTime AttendDate, decimal?TrafficFeeLimit, decimal?TelephoneFeeLimit, string BankCard)
        {
            int rowsAffected = 0;

            // 对唯一性进行检查
            int iCount = (int)this.StuffUserAdapter.QueryForUpdDistinct(StuffUserId, UserName);

            if (iCount > 0)
            {
                throw new ApplicationException("登陆帐号重复,请变更!");
            }

            iCount = (int)this.StuffUserAdapter.QueryForUpdDistinctStuffID(StuffId, StuffUserId);
            if (iCount > 0)
            {
                throw new ApplicationException("员工工号重复,请修改!");
            }

            // 根据 StuffUserId 查找要修改的数据
            AuthorizationDS.StuffUserDataTable tab = this.StuffUserAdapter.GetDataById(StuffUserId);

            if (tab.Count == 0)
            {
                return(false);
            }

            try {
                // 进行传值
                AuthorizationDS.StuffUserRow row = tab[0];
                row.StuffName = StuffName;
                row.StuffId   = StuffId;
                row.UserName  = UserName;
                if ((UserPassword != null) && (UserPassword != ""))
                {
                    row.UserPassword        = UserPassword;
                    row.LastSetPasswordTime = DateTime.Now;
                }
                row.IsActive          = IsActive;
                row.Telephone         = Telephone;
                row.EMail             = EMail;
                row.EnglishName       = EnglishName;
                row.AttendDate        = AttendDate;
                row.TrafficFeeLimit   = TrafficFeeLimit.GetValueOrDefault();
                row.TelephoneFeeLimit = TelephoneFeeLimit.GetValueOrDefault();
                row.BankCard          = BankCard;
                // 更新数据
                rowsAffected = this.StuffUserAdapter.Update(row);
            } catch (Exception e) {
                // put errors
                throw e;
            }
            return(rowsAffected == 1);
        }
Esempio n. 3
0
        public bool InsertStuffUser(string StuffName, string StuffId, string UserName, string UserPassword, string Telephone, string EMail, string EnglishName, DateTime AttendDate, decimal?TrafficFeeLimit, decimal?TelephoneFeeLimit, string BankCard)
        {
            int rowsAffected = 0;

            // 对唯一性进行检查
            int iCount = (int)this.StuffUserAdapter.QueryForInsDistinct(UserName);

            if (iCount > 0)
            {
                throw new ApplicationException("登陆帐号重复,请修改!");
            }

            iCount = (int)this.StuffUserAdapter.QueryForInsDistinctStuffID(StuffId);
            if (iCount > 0)
            {
                throw new ApplicationException("员工工号重复,请修改!");
            }

            // 进行数据新增处理
            AuthorizationDS.StuffUserDataTable tab = new AuthorizationDS.StuffUserDataTable();
            AuthorizationDS.StuffUserRow       row = tab.NewStuffUserRow();

            try {
                // 进行传值
                row.StuffName           = StuffName;
                row.StuffId             = StuffId;
                row.UserName            = UserName;
                row.UserPassword        = UserPassword;
                row.LastSetPasswordTime = DateTime.Now;
                row.IsActive            = true;
                row.Telephone           = Telephone;
                row.EMail             = EMail;
                row.EnglishName       = EnglishName;
                row.AttendDate        = AttendDate;
                row.TrafficFeeLimit   = TrafficFeeLimit.GetValueOrDefault();
                row.TelephoneFeeLimit = TelephoneFeeLimit.GetValueOrDefault();
                row.BankCard          = BankCard;
                // 填加行并进行更新处理
                tab.AddStuffUserRow(row);
                rowsAffected = this.StuffUserAdapter.Update(tab);
            } catch (Exception e) {
                // put errors
                throw e;
            }
            return(rowsAffected == 1);
        }
Esempio n. 4
0
 protected void LogInValidator_ServerValidate(object source, ServerValidateEventArgs args)
 {
     args.IsValid = this.BLL.LogInUser(Request.UserHostAddress, this.UserIdCtl.Text.Trim(), FormsAuthentication.HashPasswordForStoringInConfigFile(this.PasswordCtl.Text, "MD5"));
     //args.IsValid = this.BLL.LogInUser(Request.UserHostAddress, this.UserIdCtl.Text.Trim(), this.PasswordCtl.Text);
     if (!args.IsValid)
     {
         AuthorizationDS.StuffUserDataTable stuffUserDT = this.BLL.GetStuffUserByUserId(this.UserIdCtl.Text.Trim());
         if (stuffUserDT != null && stuffUserDT.Rows.Count > 0)
         {
             if (!stuffUserDT[0].IsActive)
             {
                 this.MessageCtl.Text = "该帐户已被停用!";
             }
         }
         else
         {
             this.MessageCtl.Text = "系统不存在登陆帐号" + this.UserIdCtl.Text.Trim() + "!";
         }
     }
 }
Esempio n. 5
0
        public bool LogInUser(string clientIP, string userName, string password)
        {
            bool result = false;

            LogInAction action = new LogInAction();

            action.UserName  = userName;
            action.ClientIP  = clientIP;
            action.LogInTime = DateTime.Now;

            AuthorizationDS.StuffUserDataTable table = this.StuffUserAdapter.GetDataByUserName(userName);
            if (table.Count > 0)
            {
                action.StuffName = table[0].StuffName;
                action.StuffId   = table[0].StuffId;

                if (table[0].UserPassword.Equals(password))
                {
                    if (table[0].IsLatestLogInTimeNull())
                    {
                        table[0].SetLaterLogInTimeNull();
                    }
                    else
                    {
                        table[0].LaterLogInTime = table[0].LatestLogInTime;
                    }
                    table[0].LatestLogInTime = DateTime.Now;
                    this.StuffUserAdapter.Update(table);
                    action.Success = true;
                    result         = true;
                }
            }
            if (result == false)
            {
                action.Success = false;
            }
            SysLog.LogLogInAction(action);
            return(result);
        }
Esempio n. 6
0
        public bool InsertStuffUser(string StuffName, string StuffId, string UserName, string UserPassword, string Telephone, string EMail, string EnglishName, DateTime AttendDate, int StaffLevelID,string VendorCode)
        {
            int rowsAffected = 0;

            // ��Ψһ�Խ��м��
            int iCount = (int)this.StuffUserAdapter.QueryForInsDistinct(UserName);
            if (iCount > 0) {
                throw new ApplicationException("��½�ʺ��ظ������޸ģ�");
            }

            iCount = (int)this.StuffUserAdapter.QueryForInsDistinctStuffID(StuffId);
            if (iCount > 0) {
                throw new ApplicationException("Ա�������ظ������޸ģ�");
            }

            // ����������������
            AuthorizationDS.StuffUserDataTable tab = new AuthorizationDS.StuffUserDataTable();
            AuthorizationDS.StuffUserRow row = tab.NewStuffUserRow();

            try {
                // ���д�ֵ
                row.StuffName = StuffName;
                row.StuffId = StuffId;
                row.UserName = UserName;
                row.UserPassword = UserPassword;
                row.LastSetPasswordTime = DateTime.Now;
                row.IsActive = true;
                row.Telephone = Telephone;
                row.EMail = EMail;
                row.EnglishName = EnglishName;
                row.AttendDate = AttendDate;
                row.StaffLevelID = StaffLevelID;
                row.StuffNo = StuffId;
                row.VendorCode = VendorCode;
                // ����в����и��´���
                tab.AddStuffUserRow(row);
                rowsAffected = this.StuffUserAdapter.Update(tab);
            } catch (Exception e) {
                // put errors
                throw e;
            }
            return rowsAffected == 1;
        }