Пример #1
0
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            DateTime beginfromdate;
                DateTime.TryParse(Request.Form["beginFromDate"], out beginfromdate);

                if (beginfromdate == DateTime.MinValue)
            {
                beginfromdate = DateTime.Today.AddDays(-1);
            }

                String beginfrmdate = Request.Form["beginFromDate"] ?? "";
                if (string.IsNullOrEmpty(beginfrmdate))
                {
                    beginfrmdate = DateTime.Today.AddDays(-1).ToString("MM/dd/yyyy");
                }

                String endToDate = Request.Form["beginToDate"] ?? "";
                if (string.IsNullOrEmpty(endToDate))
                {
                    endToDate = DateTime.Today.AddDays(-1).ToString("MM/dd/yyyy");
                }

                String strUser = Request.Form["chooseuser"] ?? "";
                if (string.IsNullOrEmpty(endToDate))
                {
                    strUser = "******";
                }
                manager_report objManagerReport = new manager_report(beginfrmdate, endToDate,strUser);

                ltrReportData.Text = objManagerReport.ToTable();

            this.ltrPageScript.Text = JSUtil.encloseInJavascriptTag(@" $().ready(function(){
            $('#begindate').val('" + beginfrmdate + @"');
            $('#enddate').val('" + endToDate + @"');

               }); ");
            //CurrentUser user = new CurrentUser("TimeSheetAdmin");
            CurrentUser user = new CurrentUser(HttpContext.Current.Session["UserInSession"].ToString());
            var lstChooseUsers = new Users(user).Load("", "", "").Cast<Users>().ToList();
            this.ltrChooseUsers.Text = "<option value=\"\"></option>" +
            String.Join("", lstChooseUsers.Select(x => x.UserName).Distinct().Select(uname =>
            {
                return "<option value=\"" + HttpUtility.HtmlEncode(uname) + "\">" + HttpUtility.HtmlEncode(uname) + "</option>";
            }).ToArray());
        }
Пример #2
0
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            //CurrentUser user = new CurrentUser("TimeSheetAdmin");
            CurrentUser user = new CurrentUser(HttpContext.Current.Session["UserInSession"].ToString());
            var taskGrid = TimeSheetGridUtility.taskGrid(user);
            taskGrid.allowDelete = true;

            //var task = new task(user).load("", "", "").Cast<task>().ToList();
            var task = new TimeSheetBO.Task(user).Load("", "", "").Cast<TimeSheetBO.Task>().ToList();
            taskGrid.Rows.AddRange(task);

            ltrGridUI.Text = taskGrid.gridTable.ToHTML();
            ltrAddNew.Text = "<button type=\"button\" onclick=\"GridUtil.newRow();\">Add New</button>";
            ltrGridScript.Text = JSUtil.encloseInJavascriptTag("gridData = " + taskGrid.gridJS() + ";\ncolumnJS=[" + taskGrid.gridTable.columnJS() + "]");
            ltrHiddens.Text = taskGrid.gridTable.hiddenVars;

            var lstUsers = new Users(user).Load("", "", "").Cast<Users>().ToList();
            this.ltrdevUsers.Text = "<option value=\"\"></option>" +
            String.Join("", lstUsers.Select(x=>x.UserName).Distinct().Select(uname =>
            {
                return "<option value=\"" + HttpUtility.HtmlEncode(uname) + "\">" + HttpUtility.HtmlEncode(uname) + "</option>";
            }).ToArray());
            ltrqausers.Text = ltrdevUsers.Text;
            ltrapprovedusers.Text = ltrdevUsers.Text;
        }