コード例 #1
0
        /// <summary>
        /// Get dates with data and fill the global dataset of dates with it
        /// </summary>
        private void FillDatesUsingData(DateTime visibleDate)
        {
            try
            {
                ScoringDAL dbAccess      = new ScoringDAL();
                String     selectedMonth = visibleDate.Month.ToString();
                String     selectedYear  = visibleDate.Year.ToString();

                //getting dates that have data - default value for model is taken as "Risk View"
                dsPrevDateSelectedData = dbAccess.GetDatesWithData(selectedMonth,
                                                                   selectedYear, (hifModel.Value == "") ?
                                                                   "Risk View" : hifModel.Value, (hifVersion.Value == "") ?
                                                                   "4" : hifVersion.Value, (mode_id.SelectedValue == "") ?
                                                                   "XML" : mode_id.SelectedValue);

                //this data is stored and sent as view state variables
                ViewState["selectedPrevDateDataForMonth"] = dsPrevDateSelectedData;
            }
            catch (Exception ex)
            {
                //StreamWriter swException = new StreamWriter(
                // @"C:\Users\parevi01\Documents\Visual Studio 2012\Projects " +
                // @"\ScoringApp1\ScoringApp1\Log\ScoringFormExcpetions.txt");
                //swException.WriteLine(DateTime.Now.ToString() + "-" + ex.GetType() + "-" + ex.Message + "-" + ex.StackTrace);
                //swException.Close();
                // throw;
            }
        }
コード例 #2
0
        public static Dictionary <String, ArrayList> GetDefaultValues(String model)
        {
            ScoringDAL dbAccess = new ScoringDAL();
            Dictionary <String, ArrayList> defaultValues = new Dictionary <string, ArrayList>();

            //gets the default lists for the particular model that is selected by the user
            defaultValues = dbAccess.GetDefaultLists(model);
            return(defaultValues);
        }
コード例 #3
0
        protected void cdrPrevDate_SelectionChanged(object sender, EventArgs e)
        {
            DataSet    dsTimeStamps;
            ScoringDAL dbAccess = new ScoringDAL();

            dsTimeStamps = dbAccess.GetReportGenerationTimes(cdrPrevDate.SelectedDate.ToString("yyyyMMdd"),
                                                             (hifModel.Value == "") ? "Risk View" : hifModel.Value,
                                                             (hifVersion.Value == "") ? "4" : hifVersion.Value,
                                                             (mode_id.SelectedValue == "") ? "XML" : mode_id.SelectedValue);

            cdrCurrentDate.Enabled     = true;
            cdrCurrentDate.VisibleDate = cdrPrevDate.SelectedDate;
            ddlPrevTime.Items.Clear();
            if (dsTimeStamps != null)
            {
                ddlPrevTime.Items.Add("Previous Time");
                foreach (DataRow drTimeStamp in dsTimeStamps.Tables[0].Rows)
                {
                    String   strPrevTime = drTimeStamp["roxieTime"].ToString();
                    TimeSpan ts          = new TimeSpan(Convert.ToInt32(strPrevTime.Substring(0, 2)),
                                                        Convert.ToInt32(strPrevTime.Substring(2, 2)),
                                                        Convert.ToInt32(strPrevTime.Substring(4, 2)));
                    DateTime prevTime = cdrPrevDate.SelectedDate + ts;
                    //DateTime prevTime = Convert.ToDateTime(strPrevTime.Substring(0, 2) + ":" + strPrevTime.Substring(2, 2) + ":" + strPrevTime.Substring(4, 2));

                    ddlPrevTime.Items.Add(prevTime.ToString("MM/dd/yyyy hh:mm:ss tt"));

                    if (dsTimeStamps.Tables[0].Rows.Count == 1)
                    {
                        ddlPrevTime.SelectedIndex = 1;
                        TimeSpan duration = new TimeSpan(1, 0, 0, 0);
                        dsCurrentDateSelectedData = dbAccess.GetCurrentDatesWithData(cdrPrevDate.SelectedDate.Month.ToString(),
                                                                                     cdrPrevDate.SelectedDate.Year.ToString(),
                                                                                     cdrPrevDate.SelectedDate.Add(duration).ToString("yyyyMMdd"),
                                                                                     (hifModel.Value == "") ? "Risk View" : hifModel.Value,
                                                                                     (hifVersion.Value == "") ? "4" : hifVersion.Value,
                                                                                     (mode_id.SelectedValue == "") ? "XML" : mode_id.SelectedValue);
                        ViewState["selectedCurrentDateDataForMonth"] = dsCurrentDateSelectedData;
                    }
                    else
                    {
                        ddlPrevTime.SelectedIndex = 0;
                        dsCurrentDateSelectedData = dbAccess.GetCurrentDatesWithData(cdrPrevDate.SelectedDate.Month.ToString(),
                                                                                     cdrPrevDate.SelectedDate.Year.ToString(),
                                                                                     cdrPrevDate.SelectedDate.ToString("yyyyMMdd"),
                                                                                     (hifModel.Value == "") ? "Risk View" : hifModel.Value,
                                                                                     (hifVersion.Value == "") ? "4" : hifVersion.Value,
                                                                                     (mode_id.SelectedValue == "") ? "XML" : mode_id.SelectedValue);
                        ViewState["selectedCurrentDateDataForMonth"] = dsCurrentDateSelectedData;
                    }

                    ddlPrevTime.Enabled = true;
                }
            }
            // RenderControl(cdrPrevDate);
            //FillDatesUsingData(cdrPrevDate.SelectedDate);
        }
コード例 #4
0
        public static string getHTMLCompareTable()
        {
            Dictionary <String, String> compareIDs = new Dictionary <String, String>();
            ScoringDAL dbAccess = new ScoringDAL();

            compareIDs = dbAccess.getAllExistingCompareIDs();

            String[]        comparisonData;
            List <String[]> allComparisonData = new List <String[]>();

            DataTable   tblCompareIDs = new DataTable();
            CultureInfo provider = CultureInfo.InvariantCulture;
            DateTime    prevDateTime, currDateTime;
            String      compareID, ownerName;
            int         i = 0;

            tblCompareIDs.Columns.Add("Serial");
            tblCompareIDs.Columns.Add("Model");
            tblCompareIDs.Columns.Add("Dates");
            tblCompareIDs.Columns.Add("Version");
            tblCompareIDs.Columns.Add("Mode");
            tblCompareIDs.Columns.Add("Environment");
            tblCompareIDs.Columns.Add("Restriction");
            tblCompareIDs.Columns.Add("Customer");
            tblCompareIDs.Columns.Add("Owner");

            foreach (KeyValuePair <String, String> userCompareID in compareIDs)
            {
                ownerName      = userCompareID.Value;
                compareID      = userCompareID.Key;
                comparisonData = compareID.Split('_');
                if (comparisonData != null)
                {
                    DataRow dr = tblCompareIDs.NewRow();
                    dr[0]        = ++i;
                    dr[1]        = comparisonData[0];
                    prevDateTime = DateTime.ParseExact(comparisonData[1] + " " + comparisonData[2], "yyyyMMdd HHmmss", provider);
                    currDateTime = DateTime.ParseExact(comparisonData[3] + " " + comparisonData[4], "yyyyMMdd HHmmss", provider);
                    dr[2]        = prevDateTime.ToString() + " vs " + currDateTime.ToString();
                    dr[3]        = "v" + comparisonData[5];
                    dr[4]        = comparisonData[6];
                    dr[5]        = comparisonData[7];
                    dr[6]        = comparisonData[8];
                    dr[7]        = comparisonData[9];
                    dr[8]        = ownerName;
                    tblCompareIDs.Rows.Add(dr);
                }

                //allComparisonData.Add(comparisonData);
                //DataRow dr = tblCompareIDs.NewRow();
                //tblCompareIDs.Rows.Add(processedCompareList);
            }

            // return "{\"aaData\" : " + GetJson(tblCompareIDs) + "}";
            return(GetJson(tblCompareIDs));
        }
コード例 #5
0
        public static Dictionary <String, ArrayList> GetDefaultValues(String model)
        {
            ScoringDAL dbAccess = new ScoringDAL();
            Dictionary <String, ArrayList> defaultValues = new Dictionary <string, ArrayList>();

            defaultValues = dbAccess.GetDefaultLists(model);
            //for (int loopIndex = 0; loopIndex < 10; loopIndex++)
            //{
            //    Thread.Sleep(1000);
            //}
            return(defaultValues);
        }
コード例 #6
0
        /// <summary>
        /// Page load event handler
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                cdrPrevDate.VisibleDate = DateTime.Today;
                cdrCurrentDate.Enabled  = false;
                //FillDatesUsingData(DateTime.Today);
                ddlPrevTime.Enabled = false;
                cdrPrevDate.Enabled = false;

                ScoringDAL dbAccess = new ScoringDAL();

                userName = HttpContext.Current.User.Identity.Name;
                userName = userName.Substring(userName.IndexOf('\\') + 1);


                if (Request.QueryString["user"] != null && Request.QueryString["id"] != null)
                {
                    if (Request.QueryString["user"] == userName)
                    {
                        Dictionary <String, String> compareIDs = new Dictionary <String, String>();
                        compareIDs = dbAccess.getAllExistingCompareIDs();
                        Int32 compareIDSerial = (Request.QueryString["id"] == null) ? 0 : Convert.ToInt32(Request.QueryString["id"]);
                        int   i = 0;
                        foreach (KeyValuePair <String, String> userCompareIDs in compareIDs)
                        {
                            i = i + 1;
                            if (i == compareIDSerial)
                            {
                                compareID = userCompareIDs.Key;
                            }
                        }

                        dbAccess.DeleteCompareID(compareID, userName);
                    }
                }
                //DataTable tblCompareIDs = getPrevCompareTable();

                //List<String> compareIDList = new List<String>();

                //compareIDList = dbAccess.getAllExistingCompareIDs();

                //ClientScript.RegisterForEventValidation("mode_id");
            }
            else
            {
                dsPrevDateSelectedData = (DataSet)ViewState["selectedPrevDateDataForMonth"];
                // FillDatesUsingData(DateTime.Today);
                dsCurrentDateSelectedData = (DataSet)ViewState["selectedCurrentDateDataForMonth"];
                compareID = Session["compareID"] == null ? "" : Session["compareID"].ToString();
                ClientScript.RegisterHiddenField("isPostBack", "1");
            }
        }
コード例 #7
0
        public List <CompareIDFields> getPrevCompareIDs()
        {
            ScoringDAL    dbAccess      = new ScoringDAL();
            List <String> compareIDList = new List <String>();

            compareIDList = dbAccess.getAllExistingCompareIDs();

            CultureInfo            provider      = CultureInfo.InvariantCulture;
            List <CompareIDFields> compareIDObjs = new List <CompareIDFields>();

            String[]        comparisonData;
            DateTime        prevDateTime, currDateTime;
            String          compareID;
            CompareIDFields compareIDObj;

            for (int i = 0; i < compareIDList.Count; i++)
            {
                compareID      = compareIDList[i];
                comparisonData = compareID.Split('_');
                if (comparisonData != null)
                {
                    compareIDObj             = new CompareIDFields();
                    compareIDObj.Serial      = i + 1;
                    compareIDObj.Model       = comparisonData[0];
                    prevDateTime             = DateTime.ParseExact(comparisonData[1] + " " + comparisonData[2], "yyyyMMdd HHmmss", provider);
                    currDateTime             = DateTime.ParseExact(comparisonData[3] + " " + comparisonData[4], "yyyyMMdd HHmmss", provider);
                    compareIDObj.Dates       = prevDateTime.ToString() + " vs " + currDateTime.ToString();
                    compareIDObj.Version     = comparisonData[5];
                    compareIDObj.Mode        = comparisonData[6];
                    compareIDObj.Environment = comparisonData[7];
                    compareIDObj.Restriction = comparisonData[8];
                    compareIDObj.Customer    = comparisonData[9];
                    compareIDObjs.Add(compareIDObj);
                }

                //allComparisonData.Add(comparisonData);
                //DataRow dr = tblCompareIDs.NewRow();
                //tblCompareIDs.Rows.Add(processedCompareList);
            }
            return(compareIDObjs);
        }
コード例 #8
0
        protected void cdrCurrentDate_SelectionChanged(object sender, EventArgs e)
        {
            DataSet    dsTimeStamps;
            ArrayList  alTimeStamps = new ArrayList();
            ScoringDAL dbAccess     = new ScoringDAL();

            dsTimeStamps = dbAccess.GetReportGenerationTimes(cdrCurrentDate.SelectedDate.ToString("yyyyMMdd"),
                                                             (hifModel.Value == "") ? "Risk View" : hifModel.Value,
                                                             (hifVersion.Value == "") ? "4" : hifVersion.Value,
                                                             (mode_id.SelectedValue == "") ? "XML" : mode_id.SelectedValue);
            ddlCurrentTime.Items.Clear();
            if (dsTimeStamps != null)
            {
                ddlCurrentTime.Items.Add("Current Time");
                foreach (DataRow drTimeStamp in dsTimeStamps.Tables[0].Rows)
                {
                    String   strCurrentTime = drTimeStamp["roxieTime"].ToString();
                    TimeSpan ts             = new TimeSpan(Convert.ToInt32(strCurrentTime.Substring(0, 2)),
                                                           Convert.ToInt32(strCurrentTime.Substring(2, 2)),
                                                           Convert.ToInt32(strCurrentTime.Substring(4, 2)));
                    DateTime prevTime = cdrCurrentDate.SelectedDate + ts;
                    //DateTime prevTime = Convert.ToDateTime(strPrevTime.Substring(0, 2) + ":" + strPrevTime.Substring(2, 2) + ":" + strPrevTime.Substring(4, 2));
                    //alTimeStamps.Add("Current Time");
                    //alTimeStamps.Add(prevTime.ToString("MM/dd/yyyy hh:mm:ss tt"));

                    ddlCurrentTime.Items.Add(prevTime.ToString("MM/dd/yyyy hh:mm:ss tt"));
                    if (dsTimeStamps.Tables[0].Rows.Count == 1)
                    {
                        ddlCurrentTime.SelectedIndex = 1;
                    }
                    else
                    {
                        ddlCurrentTime.SelectedIndex = 0;
                    }
                    ddlCurrentTime.Enabled = true;
                }
                //ddlCurrentTime.DataSource = alTimeStamps;
                //ddlCurrentTime.DataBind();
            }
            btnSubmit.Enabled = true;
        }
コード例 #9
0
        public static void DeleteCompareID(String serialID)
        {
            ScoringDAL dbAccess  = new ScoringDAL();
            String     compareID = "";
            Dictionary <String, String> compareIDs = new Dictionary <String, String>();

            compareIDs = dbAccess.getAllExistingCompareIDs();
            Int32 compareIDSerial = (serialID == null || serialID == "") ? 0 : Convert.ToInt32(serialID);
            int   i = 0;

            foreach (KeyValuePair <String, String> userCompareIDs in compareIDs)
            {
                i = i + 1;
                if (i == compareIDSerial + 1)
                {
                    compareID = userCompareIDs.Key;
                }
            }

            // dbAccess.DeleteCompareID(compareID);
        }
コード例 #10
0
 /// <summary>
 /// Get dates with data and fill the global dataset of dates with it
 /// </summary>
 private void FillDatesUsingData(DateTime visibleDate)
 {
     try
     {
         ScoringDAL dbAccess      = new ScoringDAL();
         String     selectedMonth = visibleDate.Month.ToString();
         String     selectedYear  = visibleDate.Year.ToString();
         dsPrevDateSelectedData = dbAccess.GetDatesWithData(selectedMonth,
                                                            selectedYear, (hifModel.Value == "") ?
                                                            "Risk View" : hifModel.Value);
         ViewState["selectedPrevDateDataForMonth"] = dsPrevDateSelectedData;
     }
     catch (Exception ex)
     {
         //StreamWriter swException = new StreamWriter(
         // @"C:\Users\parevi01\Documents\Visual Studio 2012\Projects " +
         // @"\ScoringApp1\ScoringApp1\Log\ScoringFormExcpetions.txt");
         //swException.WriteLine(DateTime.Now.ToString() + "-" + ex.GetType() + "-" + ex.Message + "-" + ex.StackTrace);
         //swException.Close();
         // throw;
     }
 }
コード例 #11
0
        public string getHTMLCompareTable1()
        {
            Dictionary <String, String> compareIDs = new Dictionary <String, String>();
            ScoringDAL dbAccess = new ScoringDAL();

            compareIDs = dbAccess.getAllExistingCompareIDs();

            String compareID;

            String[]        comparisonData;
            DateTime        prevDateTime, currDateTime;
            CultureInfo     provider       = CultureInfo.InvariantCulture;
            List <String[]> allCompareData = new List <String[]>();
            int             i = 0;

            foreach (KeyValuePair <String, String> userCompareID in compareIDs)
            {
                compareID      = userCompareID.Key;
                comparisonData = compareID.Split('_');
                if (comparisonData != null)
                {
                    String[] tableData = new String[8];

                    //dr[0] = i + 1 + "," + comparisonData[0] + "," + prevDateTime.ToString() + " vs " +
                    //    currDateTime.ToString() + "," + "v" + comparisonData[5] + "," +
                    //    comparisonData[6] + "," + comparisonData[7] + "," + comparisonData[8] + "," + comparisonData[9];
                    tableData[0] = (i + 1).ToString();
                    tableData[1] = comparisonData[0];
                    prevDateTime = DateTime.ParseExact(comparisonData[1] + " " + comparisonData[2], "yyyyMMdd HHmmss", provider);
                    currDateTime = DateTime.ParseExact(comparisonData[3] + " " + comparisonData[4], "yyyyMMdd HHmmss", provider);
                    tableData[2] = prevDateTime.ToString() + " vs " + currDateTime.ToString();
                    tableData[3] = "v" + comparisonData[5];
                    tableData[4] = comparisonData[6];
                    tableData[5] = comparisonData[7];
                    tableData[6] = comparisonData[8];
                    tableData[7] = comparisonData[9];
                    allCompareData.Add(tableData);
                }
            }
            //for (int i = 0; i < compareIDList.Count; i++)
            //{
            //    compareID = compareIDList[i];
            //    comparisonData = compareID.Split('_');
            //    if (comparisonData != null)
            //    {

            //        String[] tableData = new String[8];

            //        //dr[0] = i + 1 + "," + comparisonData[0] + "," + prevDateTime.ToString() + " vs " +
            //        //    currDateTime.ToString() + "," + "v" + comparisonData[5] + "," +
            //        //    comparisonData[6] + "," + comparisonData[7] + "," + comparisonData[8] + "," + comparisonData[9];
            //        tableData[0] = (i + 1).ToString();
            //        tableData[1] = comparisonData[0];
            //        prevDateTime = DateTime.ParseExact(comparisonData[1] + " " + comparisonData[2], "yyyyMMdd HHmmss", provider);
            //        currDateTime = DateTime.ParseExact(comparisonData[3] + " " + comparisonData[4], "yyyyMMdd HHmmss", provider);
            //        tableData[2] = prevDateTime.ToString() + " vs " + currDateTime.ToString();
            //        tableData[3] = "v" + comparisonData[5];
            //        tableData[4] = comparisonData[6];
            //        tableData[5] = comparisonData[7];
            //        tableData[6] = comparisonData[8];
            //        tableData[7] = comparisonData[9];
            //        allCompareData.Add(tableData);
            //    }

            //    //allComparisonData.Add(comparisonData);
            //    //DataRow dr = tblCompareIDs.NewRow();
            //    //tblCompareIDs.Rows.Add(processedCompareList);


            //}
            // return "{\"aaData\" : " + GetJson(tblCompareIDs) + "}";
            return(GetJson1(allCompareData));
        }
コード例 #12
0
 private async void RefreshDataAsync(String previousDate, String currentDate, String tableType)
 {
     ScoringDAL dbAccess = new ScoringDAL();
     //dbAccess.RefreshData(previousDate, currentDate, tableType);
     await dbAccess.RefreshDataAsync(previousDate, currentDate, tableType);
 }
コード例 #13
0
        private async Task Run(String typeOfTask)
        {
            userName = HttpContext.Current.User.Identity.Name;
            userName = userName.Substring(userName.IndexOf('\\') + 1);

            ScoringDAL dbAccess = new ScoringDAL();

            progress = "Retrieving values from UI...";

            try
            {
                if (typeOfTask == "History Compare")
                {
                    DataTable   tblCompareIDs        = getPrevCompareTable();
                    String[]    processedCompareList = new String[8];
                    CultureInfo provider             = CultureInfo.InvariantCulture;
                    if (tblCompareIDs != null)
                    {
                        foreach (DataRow compareIDRow in tblCompareIDs.Rows)
                        {
                            if (compareIDRow.ItemArray[0].ToString() == Request.Form["rdoCompareID"].ToString())
                            {
                                String[] datesArray       = compareIDRow.ItemArray[2].ToString().Split(new String[] { "vs" }, StringSplitOptions.None);
                                String   prevDateTime2    = Convert.ToDateTime(datesArray[0]).ToString("yyyyMMdd_HHmmss");
                                String   currentDateTime2 = Convert.ToDateTime(datesArray[1]).ToString("yyyyMMdd_HHmmss");
                                compareID = compareIDRow.ItemArray[1] + "_" + prevDateTime2 + "_" + currentDateTime2 + "_" + compareIDRow.ItemArray[3] + "_" +
                                            compareIDRow.ItemArray[4] + "_" + compareIDRow.ItemArray[5] + "_" + compareIDRow.ItemArray[6] + "_" + compareIDRow.ItemArray[7];
                                dbAccess.RefreshData("", "", "", "", "", "", "", "", "", userName, compareID);
                            }
                        }
                    }

                    // compareID = lbCurrentUserGenCIDs.SelectedValue;

                    //Response.Redirect(HttpUtility.HtmlEncode("http://" + Server.MachineName + "/ScoringApp1/ScoringForm.aspx?id=" + compareID), false);
                }
                else
                {
                    String model, version, mode, env, restriction, customer;
                    String previousDate, currentDate;
                    String loadTime    = DateTime.Now.ToString();
                    String prevTime    = Convert.ToDateTime(ddlPrevTime.SelectedValue.ToString()).ToString("HHmmss");
                    String currentTime = Convert.ToDateTime(ddlCurrentTime.SelectedValue.ToString()).ToString("HHmmss");

                    //Assigning default values for the variables
                    previousDate = (hifPrevDate.Value == "") ? "20130210" : hifPrevDate.Value;
                    currentDate  = (hifCurrentDate.Value == "") ? "20130522" : hifCurrentDate.Value;
                    previousDate = cdrPrevDate.SelectedDate.ToString("yyyyMMdd") + "_" + prevTime;
                    currentDate  = cdrCurrentDate.SelectedDate.ToString("yyyyMMdd") + "_" + currentTime;

                    model       = (hifModel.Value == "") ? "Risk View" : hifModel.Value;
                    version     = hifVersion.Value;
                    mode        = hifMode.Value;
                    env         = hifEnv.Value;
                    restriction = hifRestriction.Value;
                    customer    = hifCustomer.Value;
                    userName    = HttpContext.Current.User.Identity.Name;
                    userName    = userName.Substring(userName.IndexOf('\\') + 1);
                    compareID   = model + "_" + previousDate + "_"
                                  + currentDate + "_" + version + "_" +
                                  mode + "_" + env + "_" + restriction + "_" + customer;
                    Session["compareID"] = compareID;

                    progress = "Running queries to generate data...";
                    //Task refreshDataTask = dbAccess.RefreshData(previousDate, currentDate, model, version, mode, env, restriction, customer, loadTime, userName, compareID);
                    //await Task.WhenAny(refreshDataTask);
                    dbAccess.RefreshData(previousDate, currentDate, model, version, mode, env, restriction, customer, loadTime, userName, compareID);


                    ////RefreshDataAsync(previousDate, currentDate, tableType);
                    //progress = "Generating Excel...";
                    ////dbAccess.GenerateExcel();

                    //summaryPath = (compareID == "") ? "Archive/noCompareID.xlsx" : "Archive/" + compareID + "-Summary.xlsx";
                    //Task generateSummaryExcelTask = dbAccess.getSummaryReport(summaryPath);
                    //summaryPath = HttpUtility.HtmlEncode("http://" + Server.MachineName + "/ScoringApp1/" + summaryPath);
                    //await Task.WhenAny(generateSummaryExcelTask);
                    ////btnGetSummaryReport.Enabled = true;


                    //progress = "Summary Report Generated!";
                    //Thread.Sleep(2000);
                    //progress = "Generating Detailed Report...";

                    //detailedPath = (compareID == "") ? "Archive/noCompareID.xlsx" : "Archive/" + compareID + "-Detailed.xlsx";
                    //Task generateDetailedExcelTask = dbAccess.getDetailedReport(detailedPath);
                    //detailedPath = HttpUtility.HtmlEncode("http://" + Server.MachineName + "/ScoringApp1/" + detailedPath);
                    //await Task.WhenAny(generateDetailedExcelTask);

                    //progress = "Detailed Report Generated!";
                    ////Thread.Sleep(5000);
                    //Response.Redirect(HttpUtility.HtmlEncode("http://" + Server.MachineName + "/ScoringApp1/ScoringForm.aspx?id=" + compareID), false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            //progress = "Excel Generated";
        }
コード例 #14
0
        /// <summary>
        /// Page load event handler
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //userName = System.Environment.UserName +
                //    System.Security.Principal.WindowsIdentity.GetCurrent().Name +
                //    HttpContext.Current.User.Identity.Name;
                //lblUserName.Text = userName;
                //userName = System.Environment.UserName;
                //userName = userName.Substring(userName.IndexOf('\\') + 1);


                //cdrPrevDate.VisibleDate = DateTime.Today;
                //cdrCurrentDate.Enabled = false;
                //FillDatesUsingData(DateTime.Today);
                //ddlPrevTime.Enabled = false;

                ////populating default lists into viewstate for access using client script
                //Dictionary<String, ArrayList> defaultLists = new Dictionary<string, ArrayList>();
                //ScoringDAL dbAccess = new ScoringDAL();
                //lbDailyCompareIDs.DataBind();
                //defaultLists = dbAccess.GetDefaultLists("Risk View");

                //Page.ClientScript.RegisterHiddenField("vCode", ViewState["listsDictionary"].ToString());



                cdrPrevDate.VisibleDate = DateTime.Today;
                cdrCurrentDate.Enabled  = false;
                FillDatesUsingData(DateTime.Today);
                ddlPrevTime.Enabled = false;

                //populating default lists into viewstate for access using client script
                //Dictionary<String, ArrayList> defaultLists = new Dictionary<string, ArrayList>();
                ScoringDAL dbAccess = new ScoringDAL();
                //lbDailyCompareIDs.DataBind();
                //defaultLists = dbAccess.GetDefaultLists("Risk View");
                //ViewState["listsDictionary"] = defaultLists;
                //Page.ClientScript.RegisterHiddenField("vCode", ViewState["listsDictionary"].ToString());



                //Code to generate existing compareIDs
                //userName = System.Environment.UserName +
                //    System.Security.Principal.WindowsIdentity.GetCurrent().Name +
                //    HttpContext.Current.User.Identity.Name;
                //lblUserName.Text = userName;
                userName = HttpContext.Current.User.Identity.Name;
                userName = userName.Substring(userName.IndexOf('\\') + 1);



                //foreach (String compareID in compareIDList)
                //{
                //    comparisonData = compareID.Split('_');
                //    allComparisonData.Add(comparisonData);
                //}
                DataTable tblCompareIDs = getPrevCompareTable();

                grdPrevCompareIDs.DataSource = tblCompareIDs;
                grdPrevCompareIDs.DataBind();
            }
            else
            {
                dsPrevDateSelectedData    = (DataSet)ViewState["selectedPrevDateDataForMonth"];
                dsCurrentDateSelectedData = (DataSet)ViewState["selectedCurrentDateDataForMonth"];
                compareID = Session["compareID"] == null ? "" : Session["compareID"].ToString();
                ClientScript.RegisterHiddenField("isPostBack", "1");
            }
        }
コード例 #15
0
        private DataTable getPrevCompareTable()
        {
            List <String> compareIDList = new List <String>();
            ScoringDAL    dbAccess      = new ScoringDAL();

            compareIDList = dbAccess.getAllExistingCompareIDs();

            String[]        comparisonData;
            List <String[]> allComparisonData = new List <String[]>();

            DataTable tblCompareIDs = grdPrevCompareIDs.DataSource as DataTable;

            String[]    processedCompareList = new String[8];
            CultureInfo provider = CultureInfo.InvariantCulture;
            DateTime    prevDateTime, currDateTime;
            String      compareID;

            if (tblCompareIDs != null)
            {
                for (int i = 0; i < compareIDList.Count; i++)
                {
                    compareID      = compareIDList[i];
                    comparisonData = compareID.Split('_');
                    //allComparisonData.Add(comparisonData);
                    DataRow dr = tblCompareIDs.NewRow();
                    tblCompareIDs.Rows.Add(comparisonData);
                }
            }
            else
            {
                tblCompareIDs = new DataTable();
                tblCompareIDs.Columns.Add("Serial");
                tblCompareIDs.Columns.Add("Model");
                tblCompareIDs.Columns.Add("Dates");
                tblCompareIDs.Columns.Add("Version");
                tblCompareIDs.Columns.Add("Mode");
                tblCompareIDs.Columns.Add("Environment");
                tblCompareIDs.Columns.Add("Restriction");
                tblCompareIDs.Columns.Add("Customer");
                for (int i = 0; i < compareIDList.Count; i++)
                {
                    compareID      = compareIDList[i];
                    comparisonData = compareID.Split('_');
                    if (comparisonData != null)
                    {
                        DataRow dr = tblCompareIDs.NewRow();
                        dr[0]        = i + 1;
                        dr[1]        = comparisonData[0];
                        prevDateTime = DateTime.ParseExact(comparisonData[1] + " " + comparisonData[2], "yyyyMMdd HHmmss", provider);
                        currDateTime = DateTime.ParseExact(comparisonData[3] + " " + comparisonData[4], "yyyyMMdd HHmmss", provider);
                        dr[2]        = prevDateTime.ToString() + " vs " + currDateTime.ToString();
                        dr[3]        = comparisonData[5];
                        dr[4]        = comparisonData[6];
                        dr[5]        = comparisonData[7];
                        dr[6]        = comparisonData[8];
                        dr[7]        = comparisonData[9];


                        tblCompareIDs.Rows.Add(dr);
                    }

                    //allComparisonData.Add(comparisonData);
                    //DataRow dr = tblCompareIDs.NewRow();
                    //tblCompareIDs.Rows.Add(processedCompareList);
                }
            }

            return(tblCompareIDs);
        }
コード例 #16
0
        /// <summary>
        /// main execution code for running the comparisons
        /// </summary>
        private void Run(String typeOfTask)
        {
            //Current application user name
            userName = HttpContext.Current.User.Identity.Name;
            userName = userName.Substring(userName.IndexOf('\\') + 1);

            ScoringDAL dbAccess = new ScoringDAL();

            //changing the progress that is to be displayed on the loading division
            progress = "Retrieving values from UI...";

            try
            {
                //if the type of task is to compare based on the previous compareIDs,
                //then the stored proc is called with just the username and the compareID
                if (typeOfTask == "History Compare")
                {
                    //getting all the compareIDs as a list. This list was sent to the
                    //client during page load, as an ajax call from jquery.
                    //When the datatable in prev comparison screen is clicked,
                    //jquery returns the serial number on the grid, through which we fetch the compareID
                    Dictionary <String, String> compareIDs = new Dictionary <String, String>();
                    compareIDs = dbAccess.getAllExistingCompareIDs();
                    Int32 compareIDSerial = (hifCompareIDSerial.Value == null) ? 0 : Convert.ToInt32(hifCompareIDSerial.Value);
                    int   i = 0;
                    foreach (KeyValuePair <String, String> userCompareIDs in compareIDs)
                    {
                        i = i + 1;
                        if (i == compareIDSerial + 1)
                        {
                            compareID = userCompareIDs.Key;
                        }
                    }


                    //calling DAL method that calls the stored procedure
                    dbAccess.RefreshData("", "", "", "", "", "", "", "", "", userName, compareID);
                    progress = "Results populated in the database. Please refresh the specific excel to see the results.";
                }
                else
                {
                    //this is the case where the user requested that the comparison results be generated at real time

                    //server validation for dates
                    if (!(cdrPrevDate.SelectedDate == Convert.ToDateTime("1/1/0001 12:00:00 AM") ||
                          cdrCurrentDate.SelectedDate == Convert.ToDateTime("1/1/0001 12:00:00 AM")))
                    {
                        String model, version, mode, env, restriction, customer;
                        String previousDate, currentDate;
                        String loadTime = DateTime.Now.ToString();

                        //getting all the required values from the user interface,
                        //that will be passed to the stored proc at the backend
                        String prevTime    = Convert.ToDateTime(ddlPrevTime.SelectedValue.ToString()).ToString("HHmmss");
                        String currentTime = Convert.ToDateTime(ddlCurrentTime.SelectedValue.ToString()).ToString("HHmmss");

                        previousDate = cdrPrevDate.SelectedDate.ToString("yyyyMMdd") + "_" + prevTime;
                        currentDate  = cdrCurrentDate.SelectedDate.ToString("yyyyMMdd") + "_" + currentTime;

                        model       = (hifModel.Value == "") ? "Risk View" : hifModel.Value;
                        version     = hifVersion.Value.Substring(1);
                        mode        = hifMode.Value;
                        env         = hifEnv.Value;
                        restriction = hifRestriction.Value;
                        customer    = hifCustomer.Value;
                        userName    = HttpContext.Current.User.Identity.Name;
                        userName    = userName.Substring(userName.IndexOf('\\') + 1);

                        //preparing a compareID that is passed to the stored proc
                        compareID = model + "_" + previousDate + "_"
                                    + currentDate + "_" + version + "_" +
                                    mode + "_" + env + "_" + restriction + "_" + customer;

                        //storing the compareID as a session variable
                        Session["compareID"] = compareID;

                        //changing the display status of the application
                        progress = "Running queries to generate comparison results...";

                        //calling the DAL method using the parameters passed
                        dbAccess.RefreshData(previousDate, currentDate, model, version, mode, env, restriction, customer, loadTime, userName, compareID);

                        //updating the display status
                        progress = "Results populated in the database. Please refresh the specific excel to see the results.";
                    }
                    else
                    {
                        //error while validating the calendar dates
                        progress = "Please enter the values for all the previous and current comparison dates";
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }