Ejemplo n.º 1
0
        public void TextItemName_TextChanged(object sender, EventArgs e)
        {
            try{
                if (!string.IsNullOrEmpty(TextItemName.Text))
                {
                    alert_box.Visible = false;

                    OracleConnection conn = new OracleConnection(strConnString);
                    conn.Open();
                    OracleCommand cmd = new OracleCommand();
                    cmd.Connection  = conn;
                    cmd.CommandText = "select * from IT_ASSET_ITEMS where ITEM_NAME = '" + TextItemName.Text + "'";
                    cmd.CommandType = CommandType.Text;

                    OracleDataReader dr = cmd.ExecuteReader();
                    if (dr.HasRows)
                    {
                        CheckItemName.Text      = "<label class='control-label'><i class='fa fa-times-circle-o'></i> Item name is already exist</label>";
                        CheckItemName.ForeColor = System.Drawing.Color.Red;
                        TextItemName.Focus();
                        BtnAdd.Attributes.Add("aria-disabled", "false");
                        BtnAdd.Attributes.Add("class", "btn btn-primary disabled");
                    }
                    else
                    {
                        CheckItemName.Text      = "<label class='control-label'><i class='fa fa fa-check'></i> Item name is available</label>";
                        CheckItemName.ForeColor = System.Drawing.Color.Green;
                        CheckIsActive.Focus();
                        BtnAdd.Attributes.Add("aria-disabled", "true");
                        BtnAdd.Attributes.Add("class", "btn btn-primary active");
                    }
                }
                else
                {
                    CheckItemName.Text      = "<label class='control-label'><i class='fa fa-hand-o-left'></i> Item name is not blank</label>";
                    CheckItemName.ForeColor = System.Drawing.Color.Red;
                    TextItemName.Focus();
                }
            }
            catch
            {
                Response.Redirect("~/ParameterError.aspx");
            }
        }
Ejemplo n.º 2
0
        public async Task <OperationResult <string> > Handle(LoginCommand request, CancellationToken cancellationToken)
        {
            var findUSer = await unitOfWork.UsersRepository.GetUserByUsernameAsync(request.Username, cancellationToken);

            if (findUSer.Result != null)
            {
                if (Utility.VerifyHashedPassword(findUSer.Result.Password, request.Password))
                {
                    var validate            = new CheckIsActive(new CheckPhoneConfirmed(new CheckIsLockedAccount(null)));
                    var validateUserContext = validate.ValidateUserLogin(new UserContext
                    {
                        Context = findUSer.Result,
                        Message = null
                    });
                    if (validateUserContext.Message == null)
                    {
                        var findUserInfo = await unitOfWork.UsersRepository.GetUserTokenInfo(findUSer.Result.Id);

                        var token = await tokenService.GenerateToken(findUserInfo.Result);

                        return(OperationResult <string> .BuildSuccessResult(token));
                    }
                    return(OperationResult <string> .BuildFailure(validateUserContext.Message));
                }
                else
                {
                    findUSer.Result.AccountFailed();
                    try
                    {
                        unitOfWork.CommitSaveChange();
                    }
                    catch (System.Exception ex)
                    {
                        return(OperationResult <string> .BuildFailure(ex.Message));
                    }
                    return(OperationResult <string> .BuildFailure("Username or Password not matched"));
                }
            }
            return(OperationResult <string> .BuildFailure("not Found User"));
        }
Ejemplo n.º 3
0
        public void TextItemSalesName_TextChanged(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(TextItemSalesDescription.Text))
            {
                alert_box.Visible = false;

                OracleConnection conn = new OracleConnection(strConnString);
                conn.Open();
                OracleCommand cmd = new OracleCommand();
                cmd.Connection  = conn;
                cmd.CommandText = "select * from PF_SALES_ITEM where ITEM_SALES_DESCRIPTION = '" + TextItemSalesDescription.Text + "'";
                cmd.CommandType = CommandType.Text;

                OracleDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    CheckItemSalesName.Text      = "<label class='control-label'><i class='fa fa-times-circle-o'></i> Sales Item description is already entry</label>";
                    CheckItemSalesName.ForeColor = System.Drawing.Color.Red;
                    TextItemSalesDescription.Focus();
                    BtnAdd.Attributes.Add("aria-disabled", "false");
                    BtnAdd.Attributes.Add("class", "btn btn-primary disabled");
                }
                else
                {
                    CheckItemSalesName.Text      = "<label class='control-label'><i class='fa fa fa-check'></i> Sales Item description is available</label>";
                    CheckItemSalesName.ForeColor = System.Drawing.Color.Green;
                    CheckIsActive.Focus();
                    BtnAdd.Attributes.Add("aria-disabled", "true");
                    BtnAdd.Attributes.Add("class", "btn btn-primary active");
                }
            }
            else
            {
                CheckItemSalesName.Text      = "<label class='control-label'><i class='fa fa-hand-o-left'></i> Sales Item description is not blank</label>";
                CheckItemSalesName.ForeColor = System.Drawing.Color.Red;
                TextItemSalesDescription.Focus();
            }
        }
Ejemplo n.º 4
0
        public void TextPayTerms_TextChanged(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(TextPayTerms.Text))
            {
                alert_box.Visible = false;

                OracleConnection conn = new OracleConnection(strConnString);
                conn.Open();
                OracleCommand cmd = new OracleCommand();
                cmd.Connection  = conn;
                cmd.CommandText = "select * from NRC_PAYMENT_TERMS where PAY_TERMS_NAME = '" + TextPayTerms.Text + "'";
                cmd.CommandType = CommandType.Text;

                OracleDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    CheckPayTerms.Text      = "<label class='control-label'><i class='fa fa-times-circle-o'></i> Payment Terms name is already entry</label>";
                    CheckPayTerms.ForeColor = System.Drawing.Color.Red;
                    TextPayTerms.Focus();
                    BtnAdd.Attributes.Add("aria-disabled", "false");
                    BtnAdd.Attributes.Add("class", "btn btn-primary disabled");
                }
                else
                {
                    CheckPayTerms.Text      = "<label class='control-label'><i class='fa fa fa-check'></i> Payment Terms name is available</label>";
                    CheckPayTerms.ForeColor = System.Drawing.Color.Green;
                    CheckIsActive.Focus();
                    BtnAdd.Attributes.Add("aria-disabled", "true");
                    BtnAdd.Attributes.Add("class", "btn btn-primary active");
                }
            }
            else
            {
                CheckPayTerms.Text      = "<label class='control-label'><i class='fa fa-hand-o-left'></i> Payment Terms name is not blank</label>";
                CheckPayTerms.ForeColor = System.Drawing.Color.Red;
                TextPayTerms.Focus();
            }
        }
Ejemplo n.º 5
0
        public void TextProGarEstName_TextChanged(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(TextProGarEstName.Text))
            {
                alert_box.Visible = false;

                OracleConnection conn = new OracleConnection(strConnString);
                conn.Open();
                OracleCommand cmd = new OracleCommand();
                cmd.Connection  = conn;
                cmd.CommandText = "select * from PF_PRODUCTION_GARBAGE_EST where PGE_PERCENT = '" + TextProGarEstName.Text + "'";
                cmd.CommandType = CommandType.Text;

                OracleDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    CheckMachineName.Text      = "<label class='control-label'><i class='fa fa-times-circle-o'></i> Garbage Estimation Percent of Production  is already entry</label>";
                    CheckMachineName.ForeColor = System.Drawing.Color.Red;
                    TextProGarEstName.Focus();
                    BtnAdd.Attributes.Add("aria-disabled", "false");
                    BtnAdd.Attributes.Add("class", "btn btn-primary disabled");
                }
                else
                {
                    CheckMachineName.Text      = "<label class='control-label'><i class='fa fa fa-check'></i> Garbage Estimation Percent of Production  is available</label>";
                    CheckMachineName.ForeColor = System.Drawing.Color.Green;
                    CheckIsActive.Focus();
                    BtnAdd.Attributes.Add("aria-disabled", "true");
                    BtnAdd.Attributes.Add("class", "btn btn-primary active");
                }
            }
            else
            {
                CheckMachineName.Text      = "<label class='control-label'><i class='fa fa-hand-o-left'></i> Garbage Estimation Percent of Production  is not blank</label>";
                CheckMachineName.ForeColor = System.Drawing.Color.Red;
                TextProGarEstName.Focus();
            }
        }