Пример #1
0
    /// <summary>
    /// Attempt To Logon User
    /// </summary>
    /// <param name="sender">Sending Object</param>
    /// <param name="e">Event Args</param>
    protected void btnSubmitLoginCredentials_Click(object sender, EventArgs e)
    {
        //Check For Input
        if ((txtUsername.Text != "") && (txtPassword.Text != ""))
        {
            //Instanciate Class & Values
            _oLogon = new LogonObject {
                Username = txtUsername.Text, Password = txtPassword.Text
            };

            //Run Login Routine
            if (_oLogon.PerformLogin())
            {
                //Check For Previous Session Variable
                if (HttpContext.Current.Session["LogonInfo"] != null)
                {
                    //Remove Old One
                    HttpContext.Current.Session.Remove("LogonInfo");
                }

                //Add New Session State For Logon
                HttpContext.Current.Session.Add("LogonInfo", _oLogon);

                //Get Username
                //var textToShow = ((LogonObject)HttpContext.Current.Session["LogonInfo"]).Username.ToUpper();

                //Create Menu Item
                //UserControl userControl = form1.FindControl("ucTextBox") as UserControl;

                //var mainMenu = (userControl.FindControl("mainMenu") as ASPxMenu);
                //    //((this.Master.FindControl("HeaderMenu") as UserControl).FindControl("mainMenu") as ASPxMenu);

                //MenuItem helpMenuItem = mainMenu.Items.Add(textToShow, "helpMenuItem");
                //helpMenuItem.ItemStyle.CssClass = "helpMenuItem";

                //Hide Logon Details
                HelpMenuPopup.ShowOnPageLoad = false;
                Response.Redirect("~/main.aspx");
            }
            else
            {
                //Show Error In Footer
                HelpMenuPopup.FooterText = _oLogon.LastError;

                //Set Focus
                txtPassword.Focus();
            }
        }
    }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Check For Logon Class
            if (HttpContext.Current.Session["LogonInfo"] != null)
            {
                //Get Logon Info From Session
                _oLogon = ((LogonObject)HttpContext.Current.Session["LogonInfo"]);

                //Add Use ID TO Session
                HttpContext.Current.Session.Add("UserID", _oLogon.UserID);

                //Load Form Permissions
                if (FormSetup(_oLogon.UserID))
                {
                    //Setup Buttons
                    Master.ShowSaveButton        = false;
                    Master.ShowNewButton         = _userCanAdd;
                    Master.ShowEditButton        = _userCanEdit;
                    Master.ShowDeleteButton      = _userCanDelete;
                    Master.ShowViewButton        = _userCanView;
                    Master.ShowPrintButton       = true;
                    Master.ShowPdfButton         = false;
                    Master.ShowXlsButton         = true;
                    Master.ShowMultiSelectButton = _userCanDelete;
                }
            }

            //Check For Post Back
            if (!IsPostBack)
            {
                //Bind Grid
                PMTaskGrid.DataBind();
            }
            else
            {
                var scriptManager = ScriptManager.GetCurrent(Page);
                if (scriptManager != null && scriptManager.IsInAsyncPostBack)
                {
                }

                //Get Control That Caused Post Back
                var controlName = Request.Params.Get("__EVENTTARGET");

                //Check For Null
                if (!string.IsNullOrEmpty(controlName))
                {
                    //Determing What To Do
                    switch (controlName.Replace("ctl00$Footer$", ""))
                    {
                    case "NewButton":
                    {
                        //Call View Routine
                        AddNewRow();
                        break;
                    }

                    case "EditButton":
                    {
                        //Call View Routine
                        EditSelectedRow();
                        break;
                    }

                    case "DeleteButton":
                    {
                        //Call View Routine
                        DeleteSelectedRow();
                        break;
                    }

                    case "ViewButton":
                    {
                        //Call View Routine
                        ViewSelectedRow();
                        break;
                    }

                    case "PrintButton":
                    {
                        //Call Print Routine
                        PrintSelectedRow();
                        break;
                    }

                    case "ExportPDF":
                    {
                        //Call Export PDF Option
                        ExportPdf();
                        break;
                    }

                    case "ExportXLS":
                    {
                        //Call Export XLS Option
                        ExportXls();
                        break;
                    }

                    case "MultiSelect":
                    {
                        //Enable/Disable MultiSelect
                        EnableMultiSelect(!(PMTaskGrid.Columns[0].Visible));
                        break;
                    }

                    default:
                    {
                        //Do Nothing
                        break;
                    }
                    }
                }
            }

            //Enable/Disable Buttons
            Master.ShowNewButton   = !(PMTaskGrid.Columns[0].Visible);
            Master.ShowEditButton  = !(PMTaskGrid.Columns[0].Visible);
            Master.ShowViewButton  = !(PMTaskGrid.Columns[0].Visible);
            Master.ShowPrintButton = !(PMTaskGrid.Columns[0].Visible);

            //Clear Prior Selection If Edit Check Is No Longer Visible
            if (!(PMTaskGrid.Columns[0].Visible))
            {
                //Uncheck All
                PMTaskGrid.Selection.UnselectAll();
            }
        }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Check For Logon Class
        if (HttpContext.Current.Session["LogonInfo"] != null)
        {
            //Get Logon Info From Session
            _oLogon = ((LogonObject)HttpContext.Current.Session["LogonInfo"]);

            UserName = ((LogonObject)HttpContext.Current.Session["LogonInfo"]).Username;
            UserID   = ((LogonObject)HttpContext.Current.Session["LogonInfo"]).UserID;
        }

        //Enable/Disable Buttons
        Master.ShowNewButton  = true;
        Master.ShowEditButton = true;

        //Get Control That Caused Post Back
        var controlName = Request.Params.Get("__EVENTTARGET");

        if (!string.IsNullOrEmpty(controlName))
        {
            switch (controlName.Replace("ctl00$Footer$", ""))
            {
            case "NewButton":
            {           //Call Add Row
                AddNewRow();
                break;
            }

            case "EditButton":
            {
                //Call Edit on Selection
                EditSelectedRow();
                break;
            }

            default:
            {
                //Do Nothing
                break;
            }
            }
        }

        Configuration rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/LindtTest");

        ConnectionStringSettings strConnString = rootWebConfig.ConnectionStrings.ConnectionStrings["connection"];

        //String strConnString = ConfigurationManager.ConnectionStrings["ClientConnectionString"].ConnectionString;


        using (SqlConnection con = new SqlConnection(strConnString.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "filter_GetFilteredPlannedJobstepsList";
            cmd.Parameters.Add("@MatchJobType", SqlDbType.Int).Value              = MatchJobType;
            cmd.Parameters.Add("@MatchJobAgainst", SqlDbType.Int).Value           = MatchJobAgainst;
            cmd.Parameters.Add("@JobIDLike", SqlDbType.VarChar).Value             = JobIDLike;
            cmd.Parameters.Add("@UserID", SqlDbType.Int).Value                    = UserID;
            cmd.Parameters.Add("@JobCrew", SqlDbType.VarChar).SqlValue            = UserName;
            cmd.Parameters.Add("@FromHistoryYNB", SqlDbType.VarChar).SqlValue     = FromHistoryYNB;
            cmd.Parameters.Add("@IsIssuedYNB", SqlDbType.VarChar).SqlValue        = IsIssuedYNB;
            cmd.Parameters.Add("@StartingReqDate", SqlDbType.DateTime).SqlValue   = StartingReqDate;
            cmd.Parameters.Add("@EndingReqDate", SqlDbType.DateTime).SqlValue     = EndingReqDate;
            cmd.Parameters.Add("@StartDateStart", SqlDbType.DateTime).SqlValue    = StartDateStart;
            cmd.Parameters.Add("@StartDateEnd", SqlDbType.DateTime).SqlValue      = StartDateEnd;
            cmd.Parameters.Add("@TitleContains", SqlDbType.VarChar).SqlValue      = TitleContains;
            cmd.Parameters.Add("@MatchLaborClass", SqlDbType.VarChar).SqlValue    = MatchLaborClass;
            cmd.Parameters.Add("@MatchStatus", SqlDbType.VarChar).SqlValue        = MatchStatus;
            cmd.Parameters.Add("@MatchGroup", SqlDbType.VarChar).SqlValue         = MatchGroup;
            cmd.Parameters.Add("@MatchPriority", SqlDbType.VarChar).SqlValue      = MatchPriority;
            cmd.Parameters.Add("@MatchReason", SqlDbType.VarChar).SqlValue        = MatchReason;
            cmd.Parameters.Add("@MatchArea", SqlDbType.VarChar).SqlValue          = MatchArea;
            cmd.Parameters.Add("@MatchObjectType", SqlDbType.VarChar).SqlValue    = MatchObjectType;
            cmd.Parameters.Add("@MachineIDContains", SqlDbType.VarChar).SqlValue  = MachineIDContains;
            cmd.Parameters.Add("@MatchOutcomeCode", SqlDbType.VarChar).SqlValue   = MatchOutcomeCode;
            cmd.Parameters.Add("@ObjIDDescrContains", SqlDbType.VarChar).SqlValue = ObjIDDescrContains;
            cmd.Parameters.Add("@MatchTaskID", SqlDbType.VarChar).SqlValue        = MatchTaskID;
            cmd.Parameters.Add("@CompStartDate", SqlDbType.DateTime).SqlValue     = CompStartDate;
            cmd.Parameters.Add("@CompEndDate", SqlDbType.DateTime).SqlValue       = CompEndDate;
            cmd.Parameters.Add("@JobSupervisor", SqlDbType.VarChar).SqlValue      = JobSupervisor;
            cmd.Parameters.Add("@MatchStateRoute", SqlDbType.VarChar).SqlValue    = MatchStateRoute;
            cmd.Parameters.Add("@MatchLocation", SqlDbType.VarChar).SqlValue      = MatchLocation;
            cmd.Parameters.Add("@PostedBy", SqlDbType.VarChar).SqlValue           = PostedBy;
            cmd.Parameters.Add("@PostStartDate", SqlDbType.DateTime).SqlValue     = PostStartDate;
            cmd.Parameters.Add("@PostEndDate", SqlDbType.DateTime).SqlValue       = PostEndDate;
            cmd.Parameters.Add("@MatchWorkType", SqlDbType.VarChar).SqlValue      = MatchWorkType;
            cmd.Parameters.Add("@IssuedStartDate", SqlDbType.DateTime).SqlValue   = IssuedStartDate;
            cmd.Parameters.Add("@IssuedEndDate", SqlDbType.DateTime).SqlValue     = IssuedEndDate;
            cmd.Parameters.Add("@RequestedBy", SqlDbType.VarChar).SqlValue        = RequestedBy;
            cmd.Parameters.Add("@RouteTo", SqlDbType.VarChar).SqlValue            = RouteTo;
            cmd.Parameters.Add("@Notes", SqlDbType.VarChar).SqlValue              = Notes;
            cmd.Parameters.Add("@MiscRef", SqlDbType.VarChar).SqlValue            = MiscRef;
            cmd.Parameters.Add("@CostCodeID", SqlDbType.VarChar).SqlValue         = CostCodeID;
            cmd.Parameters.Add("@FundSourceID", SqlDbType.VarChar).SqlValue       = FundSourceID;
            cmd.Parameters.Add("@WorkOrderCodeID", SqlDbType.VarChar).SqlValue    = WorkOrderCodeID;
            cmd.Parameters.Add("@OrgCodeID", SqlDbType.VarChar).SqlValue          = OrgCodeID;
            cmd.Parameters.Add("@FundGroupID", SqlDbType.VarChar).SqlValue        = FundGroupID;
            cmd.Parameters.Add("@ControlSectionID", SqlDbType.VarChar).SqlValue   = ControlSectionID;
            cmd.Parameters.Add("@EquipNumberID", SqlDbType.VarChar).SqlValue      = EquipNmberID;
            cmd.Parameters.Add("@IsBreakdownYNB", SqlDbType.VarChar).SqlValue     = IsBreakdownYNB;
            cmd.Parameters.Add("@HasAttachments", SqlDbType.VarChar).SqlValue     = HasAttachments;



            cmd.Connection = con;
            try
            {
                con.Open();

                myJobsGrid.DataSource = cmd.ExecuteReader();
                myJobsGrid.DataBind();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }