示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            pageIndexvar = 1;
            user         = string.Empty;
            try
            {
                user         = Session["user"].ToString();
                userFullname = Session["userFullname"].ToString();
                Session["TableStructure"] = null;

                DTColumnsList = new Dictionary <string, string>();
                DTColumnsList.Add("SalesId", "txt");
                DTColumnsList.Add("Program", "ddl");
                DTColumnsList.Add("SalesDate", "dpkR");
                DTColumnsList.Add("Retailer", "ddl");
                DTColumnsList.Add("StoreNumber", "txt");
                DTColumnsList.Add("ItemNumber", "txt");
                DTColumnsList.Add("ItemName", "txt");
                DTColumnsList.Add("Owner", "ddl");
                DTColumnsList.Add("Type", "ddl");
                DTColumnsList.Add("TimeStamp", "dpkR");
                //DTColumnsList.Add("LockedTimeStamp", "ddl");
                DTColumnsList.Add("Snapshot", "ddl");
                DTColumnsList.Add("PreviousSnapshot", "ddl");


                cbl_SubReconciliation.Visible = false;

                if (!IsPostBack)
                {
                    if (user == "*****@*****.**")
                    {
                        StoredProcedureSelect        = "SELECTGRID";
                        rbl_ReportType.SelectedIndex = 0;
                    }
                    else
                    {
                        StoredProcedureSelect         = "RECONCILIATION";
                        rbl_ReportType.SelectedIndex  = 1;
                        rbtn_LastLocked.SelectedIndex = 0;
                        cbl_SubReconciliation.Visible = true;

                        for (int i = 0; i < cbl_SubReconciliation.Items.Count; i++)
                        {
                            cbl_SubReconciliation.Items[i].Selected = false;
                        }
                    }

                    if (ConfigurationManager.AppSettings.Get("CleanAuditDuplicates") == "true")
                    {
                        CleanDuplicates();
                    }
                    Dictionary <string, string> DefaultValues = new Dictionary <string, string>();
                    DefaultValues.Add("WebSalesDateFromDPK", Common.ApplyDateFormat(DateTime.Now.AddMonths(-1)));
                    DefaultValues.Add("WebSalesDateToDPK", Common.ApplyDateFormat(DateTime.Now));
                    Session["DDLSelection"] = DefaultValues;
                    Session["GridResults"]  = null;

                    Dictionary <string, string> Params = new Dictionary <string, string>();
                    Params.Add("WebSalesDateFromDPK", Common.ApplyDateFormat(DateTime.Now.AddMonths(-1)));
                    Params.Add("WebSalesDateToDPK", Common.ApplyDateFormat(DateTime.Now));
                    Params.Add("Action", StoredProcedureSelect);
                    Params.Add("PageIndex", "1");
                    Params.Add("PageSize", "20");

                    Session["Params"] = Params;
                }

                if (rbl_ReportType.SelectedIndex == 0)
                {
                    StoredProcedureSelect        = "SELECTGRID";
                    rbl_ReportType.SelectedIndex = 0;
                }
                else
                {
                    StoredProcedureSelect         = "RECONCILIATION";
                    rbl_ReportType.SelectedIndex  = 1;
                    cbl_SubReconciliation.Visible = true;

                    //cbl_SubReconciliation.Items.OfType<ListItem>().Where(l => l.Selected).
                }

                List <string> HyperlinkColumns = new List <string>();
                HyperlinkColumns.Add("OriginalFilePath");
                HyperlinkColumns.Add("ReformattedFilePath");

                Session["PageCompleteFired"] = null;
                Session["HyperlinkColumns"]  = HyperlinkColumns;
                DataSet GridDS = ImportDataToGrid(1);

                if (StoredProcedureSelect == "RECONCILIATION" && GridDS != null && GridDS.Tables[1] != null)
                {
                    GridDS.Tables[1].Columns.Remove("Type");
                    if (DTColumnsList.ContainsKey("Type"))
                    {
                        DTColumnsList.Remove("Type");
                    }
                }

                ControlUtilities.BindGridWithFilters(GridDS.Tables[0], GridDS.Tables[1], ref AuditGridView, DTColumnsList, false);
                Session["GridResults"] = GridDS.Tables[0];
            }
            catch (Exception ex)
            {
                Response.Write("<script>window.top.location = '../';</script>");
            }
        }