Пример #1
0
        public ServiceResponse UserMaster(UserMasterDto dto)
        {
            _result = new ServiceResponse();
            try
            {
                Guid systemSession = DevelopmentManagerFactory.GetSystemSession();
                IDevelopmentManager developmentManager = DevelopmentManagerFactory.GetDevelopmentManager(systemSession);
                _result.StatusCode = (int)HttpStatusCode.OK;
                var dao = new UserMasterDao
                {
                    UserName                = dto.UserName,
                    MobileNumber            = dto.MobileNumber,
                    Address                 = dto.Address,
                    Street                  = dto.Street,
                    City                    = dto.City,
                    State                   = dto.State,
                    Category                = dto.Category,
                    InterestedIn            = dto.InterestedIn,
                    RadiusOnWhereCanOperate = dto.RadiusOnWhereCanOperate,
                    AreaWhereCanOperate     = dto.AreaWhereCanOperate
                };

                _result.Response = developmentManager.CommonManager.SaveUserMaster(dao);
            }
            catch
            {
                _result.StatusCode = (int)HttpStatusCode.MethodNotAllowed;
                _result.Response   = null;
            }
            return(_result);
        }
Пример #2
0
        public frmStatistics()
        {
            InitializeComponent();
            long cn = BookDao.CountBooks();

            lblTotalBooks.Text += " " + cn;
            long user = UserMasterDao.CountUser();

            lblTotalUser.Text += ":   " + user;
        }
Пример #3
0
 private void dgvUserList_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex > -1)
     {
         _UserMasterID = Convert.ToInt64(dgvUserList.Rows[e.RowIndex].Cells[0].Value);
         UserMasterDto user = new UserMasterDto();
         user = UserMasterDao.GetByUserMasterID(_UserMasterID);
         FromObjectToFrom(user);
     }
 }
Пример #4
0
        private void btnrate_Click(object sender, EventArgs e)
        {
            BookDto bd = new BookDto();

            bd = BookDao.GetByID(Convert.ToInt64(cmbBook.SelectedValue));

            if (UserMasterDao.UpdateRatingByOne(bd.CreatedBy))
            {
                btnrate.Visible = false;
            }
        }
Пример #5
0
 private void txtPassword_Leave(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(txtPassword.Text))
     {
         if (!UserMasterDao.LoginCheck(user.UserName, txtPassword.Text))
         {
             MessageBox.Show(Constant.NOTIFICATION_INVALID_PASSWORD, Constant.NOTIFICATION_CAPTION_INVALID_PASSWORD, MessageBoxButtons.OK, MessageBoxIcon.Error);
             txtPassword.Text = "";
             txtPassword.Focus();
         }
     }
 }
Пример #6
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (UserMasterDao.DeleteByID(_UserMasterID))
     {
         MessageBox.Show("Succesfully Deleted ", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information);
         Initiate();
     }
     else
     {
         MessageBox.Show("Oparetion Unsuccesfull ", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
 }
Пример #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            UserMasterDto ud = new UserMasterDto();

            ud = UserMasterDao.GetByUserMasterUsername(txtSearch.Text);
            if (ud != null)
            {
                lblName.Text  += "  " + ud.UserFullName;
                lblEmail.Text += "  " + ud.Email;
                lblPhone.Text += " " + ud.PhoneNumber;
            }
        }
Пример #8
0
        private void LoadGride()
        {
            dgvUserList.Rows.Clear();
            dgvUserList.Columns.Clear();

            dgvUserList.Columns.Add("UserMasterID", "");
            dgvUserList.Columns.Add("UserFullName", "User Full Name");
            dgvUserList.Columns.Add("DateOFBirth", "DateOfBirth");
            dgvUserList.Columns.Add("Emial", "Email Address");
            dgvUserList.Columns.Add("Phone", "Phone Number");
            dgvUserList.Columns.Add("UserID", "User Name");
            dgvUserList.Columns.Add("AccountType", "Account Type");
            dgvUserList.Columns.Add("Rating", "Rating");

            dgvUserList.Columns["UserFullName"].Width = 150;
            dgvUserList.Columns["DateOFBirth"].Width  = 100;
            dgvUserList.Columns["Emial"].Width        = 100;
            dgvUserList.Columns["Phone"].Width        = 100;
            dgvUserList.Columns["UserID"].Width       = 120;
            dgvUserList.Columns["Rating"].Width       = 70;


            dgvUserList.Columns["UserMasterID"].Visible = false;
            List <UserMasterDto> userList = new List <UserMasterDto>();

            try
            {
                userList = UserMasterDao.GetAll();
            }
            catch (Exception ex) { }


            if (userList.Count > 0)
            {
                for (int i = 0; i < userList.Count; i++)
                {
                    dgvUserList.Rows.Add();
                    dgvUserList.Rows[i].Cells["UserMasterID"].Value = userList[i].UserMasterID;
                    dgvUserList.Rows[i].Cells["UserID"].Value       = userList[i].UserName;
                    dgvUserList.Rows[i].Cells["UserFullName"].Value = userList[i].UserFullName;
                    dgvUserList.Rows[i].Cells["DateOFBirth"].Value  = userList[i].DateOfBirth.ToString("dd-MMM-yyyy");
                    dgvUserList.Rows[i].Cells["Emial"].Value        = userList[i].Email;

                    dgvUserList.Rows[i].Cells["Phone"].Value       = userList[i].PhoneNumber;
                    dgvUserList.Rows[i].Cells["AccountType"].Value = userList[i].AccountType;
                    dgvUserList.Rows[i].Cells["Rating"].Value      = userList[i].Rating;
                }
            }
        }
Пример #9
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtRetypePassword.Text.Trim() == string.Empty)
            {
                MessageBox.Show(Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            if (txtNewPassword.Text.Trim() == string.Empty)
            {
                MessageBox.Show(Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            if (textUserName.Text.Trim() == string.Empty)
            {
                MessageBox.Show(Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            if (txtPassword.Text.Trim() == string.Empty)
            {
                MessageBox.Show(Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            if (txtNewPassword.Text != txtRetypePassword.Text)
            {
                MessageBox.Show("Password doesn't match", "Password match error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            UserMasterDto user = new UserMasterDto();

            user.UserName = textUserName.Text.Trim();
            user.Password = txtNewPassword.Text;

            if (UserMasterDao.ResetPasswordUpdate(user))
            {
                MessageBox.Show(Constant.NOTIFICATION_SUCCESS_DATA_SAVING, Constant.NOTIFICATION_CAPTION_SAVE, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                txtNewPassword.Text    = string.Empty;
                txtPassword.Text       = string.Empty;
                txtRetypePassword.Text = string.Empty;
                textUserName.Text      = string.Empty;
                this.Close();
            }
            else
            {
                MessageBox.Show(Constant.DBErrorMsg, Constant.NOTIFICATION_ERROR_DATA_SAVING, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #10
0
 public int SaveUserMaster(CommonManagerProxy proxy, UserMasterDao request)
 {
     try
     {
         using (ITransaction tx = proxy.DevelopmentManager.GetTransaction())
         {
             tx.PersistenceManager.UserRepository.Save(request);
             tx.Commit();
             return(request.Id);
         }
     }
     catch (Exception ex)
     {
         LogError(proxy, ex);
         return(0);
     }
 }
Пример #11
0
        private void LoadGride()
        {
            dvgUserList.Rows.Clear();
            dvgUserList.Columns.Clear();

            dvgUserList.Columns.Add("UserMasterID", "Serial");
            dvgUserList.Columns.Add("UserFullName", "Name");
            dvgUserList.Columns.Add("Email", "Email");
            dvgUserList.Columns.Add("Rating", "Rating");

            dvgUserList.Columns["UserFullName"].Width = 150;
            dvgUserList.Columns["Email"].Width        = 100;

            dvgUserList.Columns["Rating"].Width       = 100;
            dvgUserList.Columns["UserMasterID"].Width = 50;



            List <UserMasterDto> userlist = new List <UserMasterDto>();

            try
            {
                userlist = UserMasterDao.GetAll();
            }
            catch (Exception ex) { }


            if (userlist.Count > 0)
            {
                for (int i = 0; i < userlist.Count; i++)
                {
                    dvgUserList.Rows.Add();
                    dvgUserList.Rows[i].Cells["UserMasterID"].Value = i + 1;
                    dvgUserList.Rows[i].Cells["UserFullName"].Value = userlist[i].UserName;
                    dvgUserList.Rows[i].Cells["Email"].Value        = userlist[i].Email;
                    dvgUserList.Rows[i].Cells["Rating"].Value       = userlist[i].Rating;
                }
            }
        }
Пример #12
0
 public int SaveUserMaster(UserMasterDao request)
 {
     return(CommonManager.Instance.SaveUserMaster(this, request));
 }
Пример #13
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (cmbAcctType.SelectedValue == "-1")
            {
                MessageBox.Show(Constant.NOTIFICATION_MESSEGE_COMBOBOX_SELECTION, Constant.NOTIFICATION_CAPTION_COMBOBOX_SELECTION, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            if (txtUserFullName.Text.Trim() == string.Empty)
            {
                MessageBox.Show(Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            if (txtPhoneNumber.Text.Trim() == string.Empty)
            {
                MessageBox.Show(Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            if (textUserName.Text.Trim() == string.Empty)
            {
                MessageBox.Show(Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            if (txtPassword.Text.Trim() == string.Empty)
            {
                MessageBox.Show(Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            if (txtPhoneNumber.Text.Trim() == string.Empty)
            {
                MessageBox.Show(Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            if (txtEmail.Text.Trim() == string.Empty)
            {
                MessageBox.Show(Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            if (dtpDateOfBirth.Value == DateTime.Now)
            {
                MessageBox.Show(Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }


            //rest all validation


            UserMasterDto user = new UserMasterDto();

            user.UserName     = textUserName.Text.Trim();
            user.Password     = txtPassword.Text;
            user.UserFullName = txtUserFullName.Text;
            user.DateOfBirth  = dtpDateOfBirth.Value;
            user.Email        = txtEmail.Text;
            user.PhoneNumber  = txtPhoneNumber.Text;
            user.AccountType  = Convert.ToInt16(cmbAcctType.SelectedValue.ToString());
            user.Rating       = 0;

            if (_UserMasterID > 0)
            {
                user.UserMasterID = _UserMasterID;

                if (UserMasterDao.Update(user))
                {
                    MessageBox.Show(Constant.NOTIFICATION_SUCCESS_DATA_SAVING, Constant.NOTIFICATION_CAPTION_SAVE, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    Initiate();
                }
                else
                {
                    MessageBox.Show(Constant.DBErrorMsg, Constant.NOTIFICATION_ERROR_DATA_SAVING, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                if (UserMasterDao.Insert(user))
                {
                    MessageBox.Show(Constant.NOTIFICATION_SUCCESS_DATA_SAVING, Constant.NOTIFICATION_CAPTION_SAVE, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    Initiate();
                }
                else
                {
                    MessageBox.Show(Constant.DBErrorMsg, Constant.NOTIFICATION_ERROR_DATA_SAVING, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #14
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtPassword.Text == string.Empty)
            {
                MessageBox.Show(Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }
            if (txtPassword.Text == string.Empty)
            {
                MessageBox.Show(Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, Constant.NOTIFICATIO_VALIDATION_ALL_FIELD_IS_REQUIRED, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }


            bool          IsValid = false;
            UserMasterDto user    = new UserMasterDto();

            IsValid = UserMasterDao.LoginCheck(txtUserName.Text.Trim(), txtPassword.Text, out user);



            if (IsValid)
            {
                MDIParent mdi = new MDIParent(user);
                mdi.IsMdiContainer = true;
                mdi.Show();
                mdi.BringToFront();
                this.Hide();
            }



            //if (txtUserName.Text == "user name")
            //{
            //    MessageBox.Show("Please intput your user name.", "User Name is required", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            //    txtUserName.Focus();
            //}
            //else if (txtPassword.Text == "password")
            //{
            //    MessageBox.Show("Please intput your password.", "Password is required", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            //    txtPassword.Focus();
            //}
            //else
            //{
            //    USER_MASTER _user = new USER_MASTER();
            //    try
            //    {
            //        using (BaseManager manager = new BaseManager())
            //        {
            //            _user = manager.GetManagerInstance<UserManager>().GetUserByNameORPassword(txtUserName.Text.Trim(), txtPassword.Text.Trim());
            //        }
            //        if (_user != null)
            //        {
            //            frmMDIParent _parent = new frmMDIParent(_user.USERNAME, _user.USERFULLNAME);
            //            _parent.Show();
            //            _parent.BringToFront();
            //            this.Hide();


            //        }
            //        else
            //        {
            //            MessageBox.Show("Login ID/Password is incorrect", "Login Failed", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            //        }



            //    }
            //    catch (Exception ex)
            //    {
            //        MessageBox.Show("Error: " + ex.Message, "Fatal Error Occured!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    }

            //}
        }