コード例 #1
0
ファイル: ScoringForm.aspx.cs プロジェクト: vikram-ed/newVS
        /// <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");
            }
        }
コード例 #2
0
ファイル: CompareIDDAL.cs プロジェクト: vikram-ed/newVS
        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;
        }
コード例 #3
0
ファイル: ScoringForm.aspx.cs プロジェクト: vikram-gsu/newVS
        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;
        }
コード例 #4
0
ファイル: ScoringForm.aspx.cs プロジェクト: vikram-ed/newVS
        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);
        }
コード例 #5
0
ファイル: ScoringForm.aspx.cs プロジェクト: vikram-ed/newVS
        /// <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;
            }
        }
コード例 #6
0
ファイル: ScoringForm.aspx.cs プロジェクト: vikram-ed/newVS
        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);

        }
コード例 #7
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);
        }