Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string submitKey = (Request.Form["submitKey"] ?? "").ToString();
            if (!string.IsNullOrEmpty(submitKey))
            {
                string allSubmitKeys = (Session["allSubmitKeys"] ?? "").ToString();
                if (!allSubmitKeys.Split(',').Contains(submitKey))
                {
                    Session["allSubmitKeys"] = allSubmitKeys + "," + submitKey;
                    CurrentUser user = new CurrentUser("TimeSheetAdmin");
                    TimeSheetBO.Users userRoleObj = new TimeSheetBO.Users(user);
                    Guid guidfield;
                    Guid.TryParse(Request.Form["guidfield"], out guidfield);
                    userRoleObj.LoadSingle(userRoleObj, " WHERE guidfield = @guidfield", "guidfield", guidfield);
                    userRoleObj.UserName = Request.Form["username"];
                    userRoleObj.FullName = Request.Form["fullname"];
                    userRoleObj.emailAddress = Request.Form["emailAddress"];
                    userRoleObj.Address1 = Request.Form["address1"];
                    userRoleObj.Address2 = Request.Form["address2"];
                    userRoleObj.City = Request.Form["city"];
                    userRoleObj.State = Request.Form["state"];
                    userRoleObj.Role = Request.Form["role"];

                    if (userRoleObj.Save())
                    {

                        ltrMessage.Text = "User saved successfully.";
                    }
                    else
                    {
                        ltrMessage.Text = "Unable to save User information.";
                    }
                }
            }
        }
Пример #2
0
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            CurrentUser user = new CurrentUser("TimeSheetAdmin"); /* This will change later only test purposes it is here, later it will become login user */
            var UserFieldsGrid = TimeSheetGridUtility.UserFieldsGrid(user);
            UserFieldsGrid.allowDelete = true;
            //var UserFields = new UserFields(user).load("", "", "").Cast<UserFields>().ToList();
            var Users = new TimeSheetBO.Users(user).Load("", "", "").Cast<TimeSheetBO.Users>().ToList();
            UserFieldsGrid.Rows.AddRange(Users);

            ltrGridUI.Text = UserFieldsGrid.gridTable.ToHTML();
            ltrAddNew.Text = "<button type=\"button\" onclick=\"GridUtil.newRow();\">Add New</button>";
            ltrGridScript.Text = JSUtil.encloseInJavascriptTag("gridData = " + UserFieldsGrid.gridJS() + ";\ncolumnJS=[" + UserFieldsGrid.gridTable.columnJS() + "]");
            ltrHiddens.Text = UserFieldsGrid.gridTable.hiddenVars;
        }
Пример #3
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());
        }
Пример #4
0
 public TimeSheetContext(Users user)
 {
     SqlConnectionStringBuilder csb = new SqlConnectionStringBuilder(ConfigurationManager.AppSettings["ConnectionString"]);
     csb.ApplicationName = (string.IsNullOrEmpty(this.UserName) ? "TimeSheet" : user.UserName);
     _sqlCon = new SqlConnection(csb.ConnectionString);
 }
Пример #5
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;
        }
Пример #6
0
 public CurrentUser()
 {
     _Users = new Users();
 }
Пример #7
0
 public void Load()
 {
     _Users = new Users();
     _Users.LoadSingle(_Users, " where UserName=@username", "UserName", this.userName);
 }