Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                TimeBoundAccessRequest tbar = BussinessLogic.IsAccessRequestIsValid(Session, "SERVER");

                if (tbar.StatusCode != Globals.SUCCESS_STATUS_CODE)
                {
                    string msg = "ERROR:" + tbar.StatusDesc;
                    Master.ErrorMessage        = msg;
                    Multiview1.ActiveViewIndex = 0;
                    return;
                }

                if (IsPostBack)
                {
                    return;
                }

                LoadData(tbar);
            }
            catch (Exception ex)
            {
                //Show Error Message
                string msg = "ERROR:" + ex.Message;
                Master.ErrorMessage = msg;
                return;
            }
        }
        protected void ddSystemTypes_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                string systemType = ddSystemTypes.SelectedValue.ToUpper();

                if (systemType == "DATABASE")
                {
                    BussinessLogic.LoadDataIntoDropDown("GetDatabasesForDropDown", ddSystems, Session["User"] as SystemUser);
                    BussinessLogic.LoadDataIntoDropDown("GetDatabaseAccessTypesForDropDown", ddTypeOfAccess, Session["User"] as SystemUser);
                    return;
                }
                else if (systemType == "SERVER")
                {
                    BussinessLogic.LoadDataIntoDropDown("GetServersForDropDown", ddSystems, Session["User"] as SystemUser);
                    BussinessLogic.LoadDataIntoDropDown("GetServerAccessTypesForDropDown", ddTypeOfAccess, Session["User"] as SystemUser);
                    return;
                }

                //Show Error Message
                ddSystems.Items.Clear();
                ddTypeOfAccess.Items.Clear();

                string msg = "ERROR: SYSTEM TYPE SPECIFIED IS NOT YET SUPPORTED FOR TBAR";
                Master.ErrorMessage = msg;
                return;
            }
            catch (Exception ex)
            {
                //Show Error Message
                string msg = "ERROR:" + ex.Message;
                Master.ErrorMessage = msg;
                return;
            }
        }
 private void LoadData()
 {
     BussinessLogic.LoadDataIntoDropDown("GetApproversForDropDown", ddApprover, Session["User"] as SystemUser);
     BussinessLogic.LoadDataIntoDropDown("GetSystemTypesForDropDown", ddSystemTypes, Session["User"] as SystemUser);
     BussinessLogic.LoadDataIntoDropDown("GetDatabasesForDropDown", ddSystems, Session["User"] as SystemUser);
     BussinessLogic.LoadDataIntoDropDown("GetDatabaseAccessTypesForDropDown", ddTypeOfAccess, Session["User"] as SystemUser);
     txtStartDateTime.Text = DateTime.Now.ToString(Globals.DATE_TIME_FORMAT);
 }
Example #4
0
        protected void btnComplete_Click(object sender, EventArgs e)
        {
            try
            {
                TimeBoundAccessRequest tbar = Session["TBAR"] as TimeBoundAccessRequest;
                string sqlText = txtQuery.Text;

                //check if tbar has expired
                ApiResult checkResult = BussinessLogic.CheckIfTbarIsStillValid(tbar);

                //tbar has expired
                if (checkResult.StatusCode != Globals.SUCCESS_STATUS_CODE)
                {
                    lblErrorMsg.Text           = checkResult.StatusDesc;
                    Multiview1.ActiveViewIndex = 0;
                    return;
                }

                //see if the dude is fooling around with his query
                checkResult = CheckIfQueryIsValidForTbar(sqlText, tbar);

                //failed check
                if (checkResult.StatusCode != Globals.SUCCESS_STATUS_CODE)
                {
                    //return error
                    Master.ErrorMessage = checkResult.StatusDesc;
                    return;
                }

                int dt = BussinessLogic.cRSystemAPIClient.ExecuteNonQuery(sqlText, tbar);

                //Show Error Message
                string msg1 = $"SUCCESS: {dt} ROWS WHERE AFFECTED.";
                Master.ErrorMessage = msg1;
                btnComplete.Visible = false;
                btnExecute.Visible  = true;
                txtQuery.Enabled    = true;
                return;
            }
            catch (Exception ex)
            {
                //Show Error Message
                string msg = "ERROR:" + ex.Message;
                Master.ErrorMessage = msg;
                return;
            }
        }
Example #5
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                ChangeRequest changeRequest = new ChangeRequest
                {
                    ApprovalStatus    = "PENDING",
                    ApprovalReason    = "",
                    ChangeCategoryId  = ddChangeCategories.SelectedValue,
                    ChangeRequestId   = BussinessLogic.GenerateUniqueId("CR-"),
                    ChangeEndDateTime = !string.IsNullOrEmpty(txtImplementationStartDate.Text)? DateTime.ParseExact(txtImplementationStartDate.Text, Globals.DATE_TIME_FORMAT, CultureInfo.InvariantCulture):throw new Exception("Please Supply a Start Date"),
                                              ChangeStartDateTime = !string.IsNullOrEmpty(txtImplementationEndDateTime.Text) ? DateTime.ParseExact(txtImplementationEndDateTime.Text, Globals.DATE_TIME_FORMAT, CultureInfo.InvariantCulture) : throw new Exception("Please Supply a End Date"),
                                                                          ImpactOfNotImplementing = txtImpact.Text,
                                                                          ImplementerCompany      = (Session["User"] as SystemUser)?.CompanyCode,
                                                                          ImplementerEmail        = txtImplementerEmail.Text,
                                                                          ImplementerName         = txtImplementerName.Text,
                                                                          ImplementerPhone        = txtImplementerPhone.Text,
                                                                          Justification           = txtJustification.Text,
                                                                          RequesterCompany        = txtReqAddress.Text,
                                                                          RequesterEmail          = txtReqEmail.Text,
                                                                          RequesterName           = txtReqName.Text,
                                                                          RequesterPhone          = txtReqPhone.Text,
                                                                          Title    = txtTitle.Text,
                                                                          Problem  = txtProblemDesc.Text,
                                                                          Solution = txtSolutionDesc.Text
                };

                ApiResult apiResult = BussinessLogic.cRSystemAPIClient.SaveChangeRequest(changeRequest);

                if (apiResult.StatusCode != Globals.SUCCESS_STATUS_CODE)
                {
                    //Show Error Message
                    string msg = "ERROR:" + apiResult.StatusDesc;
                    Master.ErrorMessage = msg;
                    return;
                }

                Response.Redirect("~/AttachSystemsAffected.aspx?Id=" + changeRequest.ChangeRequestId);
            }
            catch (Exception ex)
            {
                //Show Error Message
                string msg = "ERROR:" + ex.Message;
                Master.ErrorMessage = msg;
                return;
            }
        }
        protected void btnNextStep_Click(object sender, EventArgs e)
        {
            try
            {
                TimeBoundAccessRequest req = new TimeBoundAccessRequest();

                string dateFormat = "yyyy-MM-dd HH:mm";
                req.Approver          = ddApprover.SelectedValue;
                req.CreatedBy         = (Session["User"] as SystemUser)?.Username;
                req.CreatedOn         = DateTime.Now;
                req.ApproverReason    = "PENDING";
                req.Status            = "PENDING";
                req.DurationInMinutes = int.Parse(ddDuration.SelectedValue);
                req.Reason            = txtReason.Text;
                req.StartTime         = DateTime.ParseExact(txtStartDateTime.Text, dateFormat, CultureInfo.InvariantCulture);
                req.SystemCode        = ddSystems.SelectedValue;
                req.TypeOfAccess      = ddTypeOfAccess.SelectedValue;
                req.UserId            = (Session["User"] as SystemUser)?.Username;
                req.TBPAccessId       = BussinessLogic.GenerateUniqueId("TBPA-");
                req.ModifiedBy        = (Session["User"] as SystemUser)?.Username;
                req.ModifiedOn        = DateTime.Now;

                ApiResult apiResult = BussinessLogic.cRSystemAPIClient.SaveTimeBoundAccessRequest(req);

                if (apiResult.StatusCode != Globals.SUCCESS_STATUS_CODE)
                {
                    //Show Error Message
                    string msg = "ERROR:" + apiResult.StatusDesc;
                    Master.ErrorMessage = msg;
                    return;
                }

                Response.Redirect("~/Finished.aspx");
            }
            catch (Exception ex)
            {
                //Show Error Message
                string msg = "ERROR:" + ex.Message;
                Master.ErrorMessage = msg;
                return;
            }
        }
Example #7
0
        protected void btnExecute_Click(object sender, EventArgs e)
        {
            try
            {
                TimeBoundAccessRequest tbar = Session["TBAR"] as TimeBoundAccessRequest;
                string sqlText = txtQuery.Text;

                //check if tbar has expired
                ApiResult checkResult = BussinessLogic.CheckIfTbarIsStillValid(tbar);

                //tbar has expired
                if (checkResult.StatusCode != Globals.SUCCESS_STATUS_CODE)
                {
                    lblErrorMsg.Text           = checkResult.StatusDesc;
                    Multiview1.ActiveViewIndex = 0;
                    return;
                }

                //see if the dude is fooling around with his query
                checkResult = CheckIfQueryIsValidForTbar(sqlText, tbar);

                //failed check
                if (checkResult.StatusCode != Globals.SUCCESS_STATUS_CODE)
                {
                    //return error
                    Master.ErrorMessage = checkResult.StatusDesc;
                    return;
                }

                ApiResult result = ConvertToSelect();

                if (result.StatusCode == Globals.PARSE_ERROR_CODE)
                {
                    //Show Error Message
                    string msg = "ERROR:" + result.StatusDesc;
                    dataGridResults.DataSource = null;
                    dataGridResults.DataBind();
                    Master.ErrorMessage = msg;
                    return;
                }

                if (result.StatusCode == Globals.FAILURE_STATUS_CODE)
                {
                    //Show Error Message
                    string msg = "ERROR:" + result.StatusDesc;
                    Master.ErrorMessage        = msg;
                    dataGridResults.DataSource = null;
                    dataGridResults.DataBind();
                    return;
                }

                //he input an update or delete statement
                if (result.StatusCode == Globals.SUCCESS_STATUS_CODE)
                {
                    DataTable dt = BussinessLogic.cRSystemAPIClient.ExecuteSqlQuery(result.PegPayID, tbar).Tables[0];

                    dataGridResults.DataSource = dt;
                    dataGridResults.DataBind();

                    string msg = $"SUCCESS: {dt.Rows.Count} ROWS WILL BE AFFECTED. PLEASE CONFIRM QUERY EXECUTION";
                    Master.ErrorMessage = msg;
                    btnComplete.Visible = true;
                    btnExecute.Visible  = false;
                    txtQuery.Enabled    = false;
                    return;
                }

                //this is most likely an Insert or create Statment
                string msg2 = $"SUCCESS: {result.PegPayID} DETECTED. PLEASE CONFIRM QUERY EXECUTION";
                Master.ErrorMessage = msg2;
                txtQuery.Enabled    = false;
                btnComplete.Visible = true;
                btnExecute.Visible  = false;
            }
            catch (Exception ex)
            {
                //Show Error Message
                string msg = "ERROR, Query Failed:" + ex.Message;
                Master.ErrorMessage = msg;
                return;
            }
        }
Example #8
0
 private void LoadData()
 {
     BussinessLogic.LoadDataIntoDropDown("GetSystemsForDropDown", ddTypeOfSystem, Session["User"] as SystemUser);
 }
Example #9
0
 private void LoadData()
 {
     BussinessLogic.LoadDataIntoDropDown("GetSystemTypesForDropDown", ddSysTypes, Session["User"] as SystemUser);
     txtSysCode.Text = BussinessLogic.GenerateUniqueId("SYS-");
 }
 private void LoadData()
 {
     BussinessLogic.LoadDataIntoDropDown("GetSystemUsersForDropDown", ddUsers, Session["User"] as SystemUser);
     txtEndDate.Text   = DateTime.Now.AddDays(1).ToString(Globals.DATE_TIME_FORMAT);
     txtStartDate.Text = DateTime.Now.ToString(Globals.DATE_TIME_FORMAT);
 }