Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DropDownListVersion1.ClearSelection();
            DropDownListVersion2.ClearSelection();
            //    DropDownListRequests.ClearSelection();

            DropDownListVersion1.Items.FindByText(strVersion1).Selected = true;
            DropDownListVersion2.Items.FindByText(strVersion2).Selected = true;

            UpdateRequestsList(strVersion1);
            if (!string.IsNullOrEmpty(strRequest))
            {
                DropDownListRequests.Items.FindByValue(strRequest).Selected = true;
            }
        }


        if (IsPostBack)
        {
            string strID = Request.Params.Get(postEventSourceID);
            if (strID.ToUpper().Contains("TIMER"))
            {
                if (REPID.Value != GetLastRepID())
                {
                    if (string.IsNullOrEmpty(Request.QueryString.ToString()))
                    {
                        Response.Redirect(CurrentPageName);
                    }
                    else
                    {
                        Response.Redirect(CurrentPageName + "?" + Request.QueryString.ToString());                        //new tests arriving
                    }
                }
                else
                {
                    Response.End();
                }
            }
            else if (!strID.ToUpper().Contains("GRIDVIEW"))
            {
                return;                 //other button clicks do not need data loading.
            }
        }

        int iShowBy = 50;

        if (Request.Cookies["showbyCV"] != null)
        {
            try
            {
                iShowBy = Convert.ToInt32(Request.Cookies["showbyCV"].Value);
            }
            catch (System.Exception /*ex*/) { }
        }
        ShowByList.SelectedValue = iShowBy.ToString();
        GridView1.PageSize       = iShowBy;
    }
Exemple #2
0
    protected void Page_Init(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string strVersion1 = Request.Params["Version1"];
            string strVersion2 = Request.Params["Version2"];


            if ((strVersion1 == null) || (strVersion2 == null))
            {
                String tempVersion = "";
                // char chLast = ' ';

                DataSet ds = GetDataSet("SELECT TOP 100 ID, VERSION FROM dbo.FIPVERSION ORDER BY ID DESC");

                foreach (DataRow rowCur in ds.Tables[0].Rows)
                {
                    tempVersion = delSpaseVersion(rowCur[1].ToString());

                    if (!Regex.IsMatch(tempVersion, patternVersion, RegexOptions.IgnoreCase))
                    {
                        continue;
                    }

                    if (!isProgramerVersion(tempVersion))
                    {
                        if (strVersion1 == null)
                        {
                            strVersion1 = tempVersion;
                        }
                        else if (strVersion2 == null)
                        {
                            strVersion2 = tempVersion;

                            if (EquelsFipVersion(strVersion1, strVersion2) != 0)
                            {
                                if (EquelsFipVersion(strVersion1, strVersion2) > 0)
                                {
                                    strVersion2 = null;
                                }
                                else
                                {
                                    strVersion1 = strVersion2;
                                    strVersion2 = null;
                                }
                                continue;
                            }

                            break;
                        }
                    }
                }

                Response.Redirect(GetFilterURL(strVersion1, strVersion2, null), true);
            }
            else
            {
                // String strSQL = "SELECT TOP 50 ID, VERSION FROM dbo.FIPVERSION ORDER BY ID DESC";
                //OleDbDataReader reader = GetDataFromDB(strSQL);
                DropDownListVersion1.ClearSelection();
                DropDownListVersion2.ClearSelection();

                DropDownListVersion1.Items.Clear();
                DropDownListVersion2.Items.Clear();

                DataSet ds = GetDataSet("SELECT TOP 100 ID, VERSION FROM dbo.FIPVERSION ORDER BY ID DESC");

                foreach (DataRow rowCur in ds.Tables[0].Rows)
                {
                    string tempVersion = delSpaseVersion(rowCur[1].ToString());
                    if (!Regex.IsMatch(tempVersion, patternVersion, RegexOptions.IgnoreCase))
                    {
                        continue;
                    }
                    ListItem lst  = new ListItem(tempVersion, rowCur[0].ToString());
                    ListItem lst2 = new ListItem(tempVersion, rowCur[0].ToString());
                    DropDownListVersion1.Items.Add(lst);
                    DropDownListVersion2.Items.Add(lst2);
                }

                int    iV1       = VersionID(strVersion1);
                int    iV2       = VersionID(strVersion2);
                String sqlComand = SQL_Command.Replace("$Version_2", iV2.ToString());
                sqlComand = sqlComand.Replace("$Version_1", iV1.ToString());

                if (string.IsNullOrEmpty(strRequest))
                {
                    sqlComand = sqlComand.Replace("$RequestID", "");
                }
                else
                {
                    sqlComand = sqlComand.Replace("$RequestID", "AND RequestID=" + strRequest);
                }

                if (isProgramerVersion(strVersion1))
                {
                    sqlComand = sqlComand.Replace("$order", "ORD_PROG");
                }
                else
                {
                    sqlComand = sqlComand.Replace("$order", "ORD");
                }
                sqlComand = sqlComand.Replace("$Filter", GetSQLFilter());
                SqlDataSource1.SelectCommand = sqlComand;
            }
        }
        else
        {
            int    iV1       = VersionID(strVersion1);
            int    iV2       = VersionID(strVersion2);
            String sqlComand = SQL_Command.Replace("$Version_2", iV2.ToString());
            sqlComand = sqlComand.Replace("$Version_1", iV1.ToString());

            sqlComand = sqlComand.Replace("$Filter", GetSQLFilter());

            if (string.IsNullOrEmpty(strRequest))
            {
                sqlComand = sqlComand.Replace("$RequestID", "");
            }
            else
            {
                sqlComand = sqlComand.Replace("$RequestID", "AND RequestID=" + strRequest);
            }

            if (isProgramerVersion(strVersion1))
            {
                sqlComand = sqlComand.Replace("$order", "ORD_PROG");
            }
            else
            {
                sqlComand = sqlComand.Replace("$order", "ORD");
            }

            SqlDataSource1.SelectCommand = sqlComand;
        }
    }