Exemplo n.º 1
0
        private void btNext_FormSubmit(object sender, EventArgs e)
        {
            try
            {
                user = new clsUsers();
                user.iOrgId = OrgId;
                user.sLastName = tbLastName.Text;
                user.sPIN = tbPIN.Text;
                if(user.AuthOperator() != 0)
                {
                    if(!user.bActiveStatus.Value)
                    {
                        lblError.Text = "<ul><li>" + _functions.ErrorMessage(202) + "</li></ul>";
                    }
                    else
                    {
                        Response.Cookies["bfp_operator"].Value =  (new OperatorInfo(user.iId.Value, user.sFirstName.Value)).ToString();
                        Response.Cookies["bfp_operator"].Path = "/";
                        Response.Cookies["bfp_operator"].Expires = DateTime.Now.AddYears(1);

                        Response.Redirect("ok_mainDetails.aspx?id=" + OrderId.ToString() + "&back=authcredentials", false);
                    }
            //					switch(m_sOperation)
            //					{
            //						case "CheckIn":
            //							Response.Redirect("ok_selectEquipment.aspx?orderid=" + OrderId.ToString(), false);
            //							break;
            //						case "CheckOut":
            //							Response.Redirect("ok_selectWorkOrder.aspx?id=" + OrderId.ToString(), false);
            //							break;
            //						case "CheckOutSpare":
            //							Response.Redirect("ok_selectSpareEquip.aspx?op=CheckOutSpare&orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString(), false);
            //							break;
            //						case "AddIssue":
            //							Response.Redirect("ok_addIssues.aspx?op=AddIssue&orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString(), false);
            //							break;
            //						default:
            //							Response.Redirect("ok_selectEquipment.aspx?orderid=" + OrderId.ToString(), false);
            //							break;
            //					}
                }
                else
                {
                    lblError.Text = "<ul><li>The PIN code is incorrect</li></ul>";
                }
            }
            catch(Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"] = "ok_authCredentials.aspx?orderid=" + OrderId.ToString();
                Session["error"] = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if(user != null)
                    user.Dispose();
            }
        }
Exemplo n.º 2
0
        private void btnLogin_Click(object sender, System.EventArgs e)
        {
            try
            {
                user = new clsUsers();
                user.iOrgId = OrgId;
                user.sLastName = tbLastName.Text;
                user.sPIN = tbPIN.Text;
                if(user.AuthOperator() != 0)
                {
                    if(!user.bActiveStatus.Value)
                    {
                        Header.ErrorMessage =  "<font size=3>" + _functions.ErrorMessage(202) + "</font>";
                        return;
                    }

                    Response.Cookies["bfp_operator"].Value =  (new OperatorInfo(user.iId.Value, user.sFirstName.Value)).ToString();
                    Response.Cookies["bfp_operator"].Path = "/";
                    Response.Cookies["bfp_operator"].Expires = DateTime.Now.AddYears(1);

            //					 scenario:
            //					 0 - if operator hasn't assigned the redirect to ok_selectEquipment.aspx
            //					 1 - if operator has only one assigned equipment
            //						1.1 - if this equipment is active (i.e. it exists in active table of equipments)
            //						then redirect to screen where operator select operation for this equipment ok_mainDetails.aspx?id=OrderId
            //						1.2 - if equipment is not activety then redirect to ok_selectEquipment.aspx?equipid=EquipId
            //					 2 - If operator has many assigned equipment then redirect to ok_mainMenu2.aspx
            //					 There over, operator select equipment what he will be processing
            //					during selecting, if he select not active equipment then repeat the point 1.2
            //					if active then 1.1
                    switch(user.GetUserInfoForKiosk())
                    {
                        case 0:
                            Response.Redirect("ok_selectEquipment.aspx?orderid=0&back=mainmenu", false);
                            break;
                        case 1:
                            dtOrders = (DataTable)ViewState["ActivityOrders"];
                            DataView dwOrders = new DataView(dtOrders);
                            dwOrders.RowFilter = "EquipId=" + user.iEquipId.Value.ToString();
                            if(dwOrders.Count == 0)
                                Response.Redirect("ok_selectEquipment.aspx?orderid=0&equipid=" + user.iEquipId.Value.ToString() + "&back=mainmenu", false);
                            if(dwOrders.Count == 1)
                                Response.Redirect("ok_mainDetails.aspx?id=" + dwOrders[0]["Id"].ToString() + "&back=mainmenu", false);
                            if(dwOrders.Count > 1)
                                Header.ErrorMessage = "<font size=3>" + _functions.ErrorMessage(165) + "</font>";
                            break;
                        case 2:
                            Response.Redirect("ok_mainMenu2.aspx", false);
                            break;
                        default:
                            break;
                    }
                }
                else
                {
                    Header.ErrorMessage = "<font size=3>" + _functions.ErrorMessage(201) + "</font>";
                }
            }
            catch(Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"] = "ok_mainMenu.aspx";
                Session["error"] = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if(user != null)
                    user.Dispose();
            }
        }