Beispiel #1
0
 public LoginScreen()
 {
     InitializeComponent();
     studentBusinessLogic = new LoginBusinessLogic();
     studentBusinessLogic.ActivateApplication();
     txtUserName.Focus();
 }
        /// <summary>
        /// Converts the input ChequeMaster object to its model object type
        /// </summary>
        /// <param name="cheque"></param>
        /// <returns></returns>
        private ChequeInwardsModel ConvertToCheque(CHQ_Cheques_Master cheque, int SerialNo)
        {
            if (cheque == null)
            {
                return(new ChequeInwardsModel());
            }
            StudentBusinessLogic bussiness = new StudentBusinessLogic();

            //STUD_Students_Master student = bussiness.GetAllStudents().Where(S => S.Student_ID == cheque.Student_ID).FirstOrDefault();
            //GEN_Sections_Lookup sec = bussiness.GetAllSections().Where(S => S.Section_Id == cheque.Section_ID).FirstOrDefault();

            ChequeInwardsModel cheq = new ChequeInwardsModel();

            cheq.SerialNo     = SerialNo;
            cheq.Student_ID   = cheque.Student_ID;
            cheq.Bank         = cheque.Bank;
            cheq.ChequeNo     = cheque.ChequeNo;
            cheq.Cheque_ID    = cheque.Cheque_ID;
            cheq.ChqAmount    = cheque.ChqAmount;
            cheq.ChqStatus_ID = cheque.ChqStatus_ID;
            cheq.EnteredBy    = cheque.EnteredBy;
            cheq.EnteredOn    = cheque.EnteredOn;
            cheq.InwardDate   = cheque.InwardDate;
            cheq.IsActive     = cheque.IsActive;
            cheq.Login_ID     = cheque.Login_ID;
            cheq.Remarks      = cheque.Remarks;
            cheq.Section_ID   = cheque.Section_ID;
            cheq.RegNo        = CurrentChequeInwardModel.RegNo;
            cheq.StudentName  = CurrentChequeInwardModel.StudentName;
            cheq.Section      = CurrentChequeInwardModel.Section;

            cheq.User = LoginBusinessLogic.GetUserByID(LoginBusinessLogic.GetUserIdByLoginId((decimal)cheque.Login_ID)).Username;
            return(cheq);
        }
Beispiel #3
0
        public void LoginIntegrationTest_validParameters_Ok()
        {
            IUserDataAccess     da    = new UserDataAccess();
            ILoginBusinessLogic login = new LoginBusinessLogic(da);
            Guid guid = user.Token;

            da.Add(user);
            login.Login(user.Username, user.Password);
            Guid tokenObtained = da.Get(user.Username).Token;

            Assert.AreNotEqual(guid, tokenObtained);
        }
Beispiel #4
0
 public IHttpActionResult Put([FromBody] UserModel user)
 {
     try
     {
         Guid      token        = LoginBusinessLogic.Login(user.Username, user.Password);
         User      obtainedUser = UserBusinessLogic.GetUser(user.Username);
         UserModel responseUser = UserModel.ToModel(obtainedUser);
         return(Ok(responseUser));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            string username = this.textBox1.Text;
            string password = this.textBox2.Text;

            try
            {
                Guid token = LoginBusinessLogic.Login(username, password);
                if (AuthBusinessLogic.IsAdmin(token))
                {
                    this.Hide();
                    var principal = new Principal();
                    principal.Show();
                }
                else
                {
                    MessageBox.Show("Usuario no es admin");
                }
            }
            catch
            {
                MessageBox.Show("Username o password son incorrectos");
            }
        }
 public Login()
 {
     InitializeComponent();
     LoginBusinessLogic = new LoginBusinessLogic(new UserDataAccess());
     AuthBusinessLogic  = new AuthorizationBusinessLogic(new UserDataAccess());
 }
        private void ExecuteAddChequeCommand(object sender)
        {
            View.Cheque.UC_ChequeInwardScreen uccheque = sender as View.Cheque.UC_ChequeInwardScreen;
            ChequeBusinessLogic business;

            try
            {
                ControlValidationStatus validation = ValidateControls.ValidateAllControls(sender);
                if (validation != null && !validation.isValid)
                {
                    WPFCustomMessageBox.CustomMessageBox.ShowOK(validation.ValidationMessage, "S360 Application", "OK");
                    return;
                }

                decimal chequeNo = 0;
                decimal Amt      = 0;
                decimal.TryParse(CurrentChequeInwardModel.ChequeNo, out chequeNo);
                if (string.IsNullOrEmpty(CurrentChequeInwardModel.ChequeNo) || chequeNo <= 0)
                {
                    WPFCustomMessageBox.CustomMessageBox.ShowOK("Invalid Cq. No", "Warning", "OK");
                    S360Controlls.BasicControls.S360TextBox txt = FindVisualChildren <S360Controlls.BasicControls.S360TextBox>(uccheque).Where(S => S.Name == "txtCqNo").FirstOrDefault();
                    txt.Text = string.Empty;
                    txt.Focus();
                    return;
                }
                if (!decimal.TryParse(CurrentChequeInwardModel.ChqAmount.ToString(), out Amt))
                {
                    WPFCustomMessageBox.CustomMessageBox.ShowOK("Invalid Amount", "Warning", "OK");
                    S360Controlls.BasicControls.S360TextBox txt = FindVisualChildren <S360Controlls.BasicControls.S360TextBox>(uccheque).Where(S => S.Name == "txtAmt").FirstOrDefault();
                    txt.Text = string.Empty;
                    txt.Focus();
                    return;
                }
                if (Amt <= 0)
                {
                    WPFCustomMessageBox.CustomMessageBox.ShowOK("Invalid Amount", "Warning", "OK");
                    S360Controlls.BasicControls.S360TextBox txt = FindVisualChildren <S360Controlls.BasicControls.S360TextBox>(uccheque).Where(S => S.Name == "txtAmt").FirstOrDefault();
                    txt.Text = string.Empty;
                    txt.Focus();
                    return;
                }

                if (this._chequeList == null)
                {
                    _chequeList = new ObservableCollection <ChequeInwardsModel>();
                }
                CurrentChequeInwardModel.User      = LoginBusinessLogic.GetUserByID(S360Configuration.Instance.UserID).Username;
                CurrentChequeInwardModel.EnteredBy = S360Model.S360Configuration.Instance.UserID;
                CurrentChequeInwardModel.Login_ID  = S360Model.S360Configuration.Instance.LoginID;

                business = new ChequeBusinessLogic();
                CurrentChequeInwardModel = ConvertToCheque(business.SaveChequeTemp(ConvertToCheque(CurrentChequeInwardModel, true)
                                                                                   as CHQ_Cheques_Master_Temp), false) as ChequeInwardsModel;
                CurrentChequeInwardModel.SerialNo = ChequeList.Count + 1;

                ChequeList.Add(CurrentChequeInwardModel);
            }
            catch (Exception ex)
            {
                throw new S360Exceptions.S360Exception(ex.Message, ex.InnerException);
            }
            CurrentChequeInwardModel = null;
            business = null;
        }