Example #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (AppVariable.IsConnected)
     {
         SyncImage.ImageUrl = "~/Images/Sync.gif";
     }
     else
     {
         try
         {
             PBMServer.Service1 pbm = new FloraSoft.PBMServer.Service1();
             AppVariable.IsConnected = pbm.AreYouUp();
             SyncImage.ImageUrl      = "~/Images/Sync.gif";
         }
         catch
         {
             AppVariable.IsConnected = false;
         }
     }
 }
Example #2
0
        protected void Login_Click(object sender, EventArgs e)
        {
            string UserID = "0";

            UserDB   db    = new UserDB();
            UserInfo uinfo = new UserInfo();


            if (IsAuthenticated(ConfigurationManager.AppSettings["ADServer"], UserName.Text, Pass.Text))
            {
                uinfo  = db.Login(UserName.Text);
                UserID = uinfo.UserID;
            }
            if (UserID == "0")
            {
                if (Tried.Value == "")
                {
                    Tried.Value = "0";
                }
                string LoginTries = Tried.Value;
                int    NewVal     = Int32.Parse(LoginTries) + 1;
                Tried.Value = NewVal.ToString();
                if (NewVal > 2)
                {
                    db.LockUser(UserName.Text.Trim());
                    MyMessage.Text = UserName.Text.Trim() + " has been locked.";
                }
                else
                {
                    MyMessage.Text = "Login failed (AD): Please try again";
                }
            }
            else
            {
                Response.Cookies["LoginID"].Value   = UserName.Text;
                Response.Cookies["ZoneID"].Value    = uinfo.ZoneID;
                Response.Cookies["BranchID"].Value  = uinfo.BranchID;
                Response.Cookies["RoutingNo"].Value = uinfo.RoutingNo;

                Response.Cookies["UserName"].Value   = uinfo.UserName;
                Response.Cookies["BranchName"].Value = uinfo.BranchName;
                Response.Cookies["BankCode"].Value   = uinfo.BankCode;
                Response.Cookies["BankName"].Value   = uinfo.BankName;


                FormsAuthentication.RedirectFromLoginPage(UserID, false);
                Response.Redirect("SelectRole.aspx");

                uinfo = null;

                try
                {
                    PBMServer.Service1 pbm = new FloraSoft.PBMServer.Service1();
                    AppVariable.IsConnected = pbm.AreYouUp();
                }
                catch (Exception ex)
                {
                    System.Console.WriteLine(ex.Message);
                    AppVariable.IsConnected = false;
                }
                FormsAuthentication.RedirectFromLoginPage(UserID, false);
            }
        }