Пример #1
0
        private static string Text(BuildingRequestBussines bu)
        {
            var res = "";

            try
            {
                res = Settings.Classes.Payamak.SayerText;

                if (res.Contains(Replacor.Request.DateSabt))
                {
                    res = res.Replace(Replacor.Request.DateSabt, bu.DateSh);
                }
                if (res.Contains(Replacor.Request.Name))
                {
                    var owner = PeoplesBussines.Get(bu.AskerGuid);
                    res = res.Replace(Replacor.Request.Name, owner?.Name);
                }
                if (res.Contains(Replacor.Request.UserName))
                {
                    var user = UserBussines.Get(bu.UserGuid);
                    res = res.Replace(Replacor.Request.UserName, user?.Name);
                }
            }
            catch (Exception ex)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(ex);
            }

            return(res);
        }
Пример #2
0
 public frmUserLog(Guid _userGuid, DateTime _d1, DateTime _d2)
 {
     InitializeComponent();
     userGuid      = _userGuid;
     ucHeader.Text = $"گزارش عملکرد {UserBussines.Get(userGuid)?.Name ?? ""}";
     d1            = _d1;
     d2            = _d2;
 }
Пример #3
0
 public frmUserMain(Guid guid, bool isShowMode)
 {
     InitializeComponent();
     cls                 = UserBussines.Get(guid);
     ucHeader.Text       = !isShowMode ? $"ویرایش کاربر {cls.Name}" : $"مشاهده کاربر {cls.Name}";
     ucHeader.IsModified = true;
     grp.Enabled         = !isShowMode;
     btnFinish.Enabled   = !isShowMode;
 }
Пример #4
0
        private async Task LoadDataAsync()
        {
            try
            {
                list = await UserLogBussines.GetAllAsync(userGuid);

                logBindingSource.DataSource = list.OrderByDescending(q => q.Date).ToSortableBindingList();
                lblUserName.Text            = UserBussines.Get(userGuid)?.Name ?? "";
            }
            catch (Exception ex)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(ex);
            }
        }
Пример #5
0
        private async void frmAccessLevel_Load(object sender, EventArgs e)
        {
            try
            {
                await LoadUserDataAsync();

                cmbUser.SelectedIndex = 0;
                _currentAccessLevel   = UserBussines.Get((Guid)cmbUser.SelectedValue).UserAccess;
                LoadGrid();
            }
            catch (Exception ex)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(ex);
            }
        }
        private void BtnLogin_Click(object sender, System.EventArgs e)
        {
            var res = new ReturnedSaveFuncInfo();

            res.AddReturnedValue(CheckValidation());
            if (res.HasError)
            {
                Toast.MakeText(this, res.ErrorMessage, ToastLength.Short).Show();
                return;
            }

            var user = UserBussines.Get(txtUserName.Text.Trim());

            if (user == null)
            {
                Toast.MakeText(this, $"کاربر با نام کاربری {txtUserName.Text} یافت نشد", ToastLength.Long).Show();
                txtUserName.SelectAll();
                return;
            }

            var ue        = new UTF8Encoding();
            var bytes     = ue.GetBytes(txtPassword.Text.Trim());
            var md5       = new MD5CryptoServiceProvider();
            var hashBytes = md5.ComputeHash(bytes);
            var password  = System.Text.RegularExpressions.Regex.Replace(BitConverter.ToString(hashBytes), "-", "")
                            .ToLower();

            if (password != user.Password)
            {
                Toast.MakeText(this, "رمز عبور اشتباه است", ToastLength.Long).Show();
                txtPassword.SelectAll();
                return;
            }

            if (user.IsBlock)
            {
                Toast.MakeText(this, "دسترسی شما به برنامه، از طریق پنل مدیریت محدود شده است", ToastLength.Long).Show();
                txtPassword.SelectAll();
                return;
            }

            CurrentUser.User       = user;
            CurrentUser.LastVorrod = DateTime.Now;

            StartActivity(typeof(MainActivity));
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.UserMainLayout);
            myToolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.UserMainToolbar);
            SetSupportActionBar(myToolbar);

            var guid     = Intent.GetStringExtra("UserGuid");
            var userGuid = Guid.Empty;

            if (!string.IsNullOrEmpty(guid))
            {
                userGuid = Guid.Parse(guid);
            }

            cus = UserBussines.Get(userGuid);


            txtName      = FindViewById <EditText>(Resource.Id.txtUserMainName);
            txtUserName  = FindViewById <EditText>(Resource.Id.txtUserMain_UserName);
            txtPass      = FindViewById <EditText>(Resource.Id.txtUserMainPass);
            txtMobile    = FindViewById <EditText>(Resource.Id.txtUserMainMobile);
            txtEmail     = FindViewById <EditText>(Resource.Id.txtUserMainEmail);
            rbtnManager  = FindViewById <RadioButton>(Resource.Id.rbtnManager);
            rbtnOperator = FindViewById <RadioButton>(Resource.Id.rbtnOperator);
            rbtnVisitor  = FindViewById <RadioButton>(Resource.Id.rbtnVisitor);

            SetFonts();

            txtName.Text     = cus?.Name;
            txtUserName.Text = cus?.UserName;
            txtMobile.Text   = cus?.Mobile;
            txtEmail.Text    = cus?.Email;
            if (cus?.Type == EnUserType.Manager)
            {
                rbtnManager.Checked = true;
            }
            else if (cus?.Type == EnUserType.Operator)
            {
                rbtnOperator.Checked = true;
            }
            else if (cus?.Type == EnUserType.Visitor)
            {
                rbtnVisitor.Checked = true;
            }
        }
Пример #8
0
 public frmUserMain(Guid guid)
 {
     InitializeComponent();
     cls = UserBussines.Get(guid);
 }