Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (HttpContext.Current.Session["username"].ToString() == "null" || HttpContext.Current.Session["userpwd"].ToString() == "null")
                {
                    HttpContext.Current.Response.Write(" <script> alert( '您还未登陆,请先登录!!!');window.parent.location.href= '../../Default.aspx' </script> ");
                }


                sqlTable st = new sqlTable();

                string year = DateTime.Now.Year.ToString();//当前年份

                //月汇总
                string   TableName1        = "Login";                                                                         //表名1
                string   TableName2        = "Summary";                                                                       //表名2
                string   TableName55       = "Jiediao";
                string[] MonthSourceList   = { "Login.name", "Summary.work_day" };                                            //查看列名
                string[] MonthSourceList22 = { "Login.name", "Jiediao.transfer" };                                            //查看列名

                string[] MonthSelectList    = { "Summary.year", "Summary.month", "Login.username" };                          //限定列名
                string[] MonthSelectList22  = { "Jiediao.year", "Jiediao.month", "Login.username" };                          //限定列名
                string[] MonthSelectValue   = { year, HttpContext.Current.Session["months"].ToString(), "Summary.username" }; //限定列值
                string[] MonthSelectValue22 = { year, HttpContext.Current.Session["months"].ToString(), "Jiediao.username" }; //限定列值
                                                                                                                              //DataTable MonthCmd = st.selectAll2(TableName1, TableName2, MonthSourceList, MonthSelectList, MonthSelectValue);
                DataTable MonthCmd = st.selectAll2(TableName1, TableName2, TableName55, MonthSourceList, MonthSelectList, MonthSelectValue, MonthSourceList22, MonthSelectList22, MonthSelectValue22);
                //年汇总
                string    TableName3      = "Summary_Month";                                     //表名
                string[]  YearSourceList  = { "month", "summary" };                              //查看列名
                string[]  YearSelectList  = { "year" };                                          //限定列名
                string[]  YearSelectValue = { HttpContext.Current.Session["years"].ToString() }; //限定列值
                DataTable YearCmd         = st.selectAll3(TableName3, YearSourceList, YearSelectList, YearSelectValue);


                //按年查看员工汇总
                string    TableName4      = "Summary_Year_User";                                    //表名
                string[]  UserSourceList  = { "name", "summary_user" };                             //查看列名
                string[]  UserSelectList  = { "year" };                                             //限定列名
                string[]  UserSelectValue = { HttpContext.Current.Session["yearuser"].ToString() }; //限定列值
                DataTable UserCmd         = st.selectAll4(TableName4, UserSourceList, UserSelectList, UserSelectValue);
                try
                {
                    if (MonthCmd != null || YearCmd != null || UserCmd != null)
                    {
                        Month_Repeater.DataSource = MonthCmd;
                        Month_Repeater.DataBind();

                        Year_Repeater.DataSource = YearCmd;
                        Year_Repeater.DataBind();

                        Person_Repeater.DataSource = UserCmd;
                        Person_Repeater.DataBind();
                    }
                }
                catch (Exception)
                {
                    HttpContext.Current.Response.Write(" <script> alert( '语法错误!!!');window.location.href= '../../Default.aspx ' </script> ");
                }
            }
            catch (Exception)
            {
                HttpContext.Current.Response.Write(" <script> alert( '您还未登陆,请先登录!!!');window.parent.location.href= '../../Default.aspx' </script> ");
            }
        }