Пример #1
0
        public override void LoadDropDownListSources(string fieldName, DropDownList dropDownListControl)
        {
            base.LoadDropDownListSources(fieldName, dropDownListControl);

            if (fieldName.Equals("ApplicationUserId"))
            {
                var applicationUserdata = ApplicationUserDataManager.GetList(SessionVariables.RequestProfile);
                UIHelper.LoadDropDown(applicationUserdata, dropDownListControl,
                                      ApplicationUserDataModel.DataColumns.FirstName,
                                      ApplicationUserDataModel.DataColumns.ApplicationUserId);
            }
            if (fieldName.Equals("TaskPriorityTypeId"))
            {
                var taskPriorityTypedata = TaskPriorityTypeDataManager.GetList(SessionVariables.RequestProfile);
                UIHelper.LoadDropDown(taskPriorityTypedata, dropDownListControl,
                                      StandardDataModel.StandardDataColumns.Name,
                                      TaskPriorityTypeDataModel.DataColumns.TaskPriorityTypeId);
            }
            if (fieldName.Equals("TaskId"))
            {
                var taskdata = TaskDataManager.GetList(SessionVariables.RequestProfile);
                UIHelper.LoadDropDown(taskdata, dropDownListControl,
                                      StandardDataModel.StandardDataColumns.Name,
                                      TaskDataModel.DataColumns.TaskId);
            }
        }
Пример #2
0
        public void LoadData(int applicationUserId)
        {
            var oData = new ApplicationUserDataModel();

            oData.ApplicationUserId = applicationUserId;

            var oApplicationUserTable = ApplicationUserDataManager.GetDetails(oData, SessionVariables.RequestProfile);

            if (oApplicationUserTable.Rows.Count == 1)
            {
                var row = oApplicationUserTable.Rows[0];
                txtApplicationUserName.Text = row[ApplicationUserDataModel.DataColumns.ApplicationUserName].ToString();
                txtEmailAddress.Text        = row[ApplicationUserDataModel.DataColumns.EmailAddress].ToString();
                txtLastName.Text            = row[ApplicationUserDataModel.DataColumns.LastName].ToString();
                txtFirstName.Text           = row[ApplicationUserDataModel.DataColumns.FirstName].ToString();
                txtMiddleName.Text          = row[ApplicationUserDataModel.DataColumns.MiddleName].ToString();

                drpApplicationUserTitle.SelectedValue = Convert.ToString(row[ApplicationUserDataModel.DataColumns.ApplicationUserTitleId]);
                txtApplicationUserTitle.Text          = Convert.ToString(row[ApplicationUserDataModel.DataColumns.ApplicationUserTitleId]);
            }
            else
            {
                txtLastName.Text             = String.Empty;
                txtFirstName.Text            = String.Empty;
                txtMiddleName.Text           = String.Empty;
                txtApplicationUserTitle.Text = String.Empty;
                txtEmailAddress.Text         = string.Empty;
                txtApplicationUserName.Text  = String.Empty;
            }
        }
Пример #3
0
        private void BindComboBoxes()
        {
            var dtUsers = ApplicationUserDataManager.GetList(SessionVariables.RequestProfile);

            dtUsers = (from row in dtUsers.AsEnumerable()
                       where row["ApplicationId"].ToString() == SessionVariables.RequestProfile.ApplicationId.ToString()
                       select row).CopyToDataTable();

            UIHelper.LoadDropDown(dtUsers, drpPersons,
                                  ApplicationUserDataModel.DataColumns.FullName, ApplicationUserDataModel.DataColumns.ApplicationUserId);

            var dtCategory = ScheduleDetailActivityCategoryDataManager.GetList(SessionVariables.RequestProfile);

            UIHelper.LoadDropDown(dtCategory, drpWorkCategory,
                                  ScheduleDetailActivityCategoryDataModel.DataColumns.Name,
                                  ScheduleDetailActivityCategoryDataModel.DataColumns.ScheduleDetailActivityCategoryId);

            drpPersons.Items.Insert(0, new ListItem()
            {
                Text = "All", Value = "-1", Selected = true
            });
            drpWorkCategory.Items.Insert(0, new ListItem()
            {
                Text = "All", Value = "-1", Selected = true
            });
        }
Пример #4
0
        protected void btnSubmit_OnClick(object sender, EventArgs e)
        {
            var data = new ApplicationUserDataModel();

            data.ApplicationUserId = int.Parse(drpApplicationUser.SelectedValue);
            var dt = ApplicationUserDataManager.GetDetails(data, SessionVariables.RequestProfile);

            txtPersonId.Text    = dt.Rows[0][ApplicationUserDataModel.DataColumns.ApplicationUserName].ToString();
            txtPersonId.Visible = true;

            var result      = GetWorkCategoryDetails(int.Parse(drpApplicationUser.SelectedValue));
            var groupedList = result
                              .GroupBy(u => u.Week)
                              .Select(grp => grp.ToList())
                              .ToList();
            var categorizedList = new List <ResultSet>();
            var finalList       = new List <List <ResultSet> >();

            for (var i = 0; i < groupedList.Count; i++)
            {
                categorizedList = groupedList[i]
                                  .GroupBy(u => u.Category)
                                  .Select(grp => new ResultSet("", "", 0)
                {
                    Category = grp.First().Category,
                    Week     = grp.First().Week,
                    Value    = grp.Sum(u1 => u1.Value),
                }).ToList();

                finalList.Add(categorizedList);
            }
            rpt.DataSource = finalList.ToList();
            rpt.DataBind();
        }
Пример #5
0
        public override void LoadDropDownListSources(string fieldName, DropDownList dropDownListControl)
        {
            base.LoadDropDownListSources(fieldName, dropDownListControl);

            if (fieldName.Equals("Skill"))
            {
                var skilldata = SkillDataManager.GetList(SessionVariables.RequestProfile);
                UIHelper.LoadDropDown(skilldata, dropDownListControl,
                                      StandardDataModel.StandardDataColumns.Name,
                                      SkillDataModel.DataColumns.SkillId);
            }
            if (fieldName.Equals("SkillLevel"))
            {
                var skillLeveldata = SkillLevelDataManager.GetList(SessionVariables.RequestProfile);
                UIHelper.LoadDropDown(skillLeveldata, dropDownListControl,
                                      StandardDataModel.StandardDataColumns.Name,
                                      SkillLevelDataModel.DataColumns.SkillLevelId);
            }

            if (fieldName.Equals("Person"))
            {
                var applicationUserdata = ApplicationUserDataManager.GetList(SessionVariables.RequestProfile);
                UIHelper.LoadDropDown(applicationUserdata, dropDownListControl,
                                      ApplicationUserDataModel.DataColumns.FirstName,
                                      ApplicationUserDataModel.DataColumns.ApplicationUserId);
            }
        }
Пример #6
0
        private void SetupDropdown()
        {
            var isTesting  = SessionVariables.IsTesting;
            var personData = ApplicationUserDataManager.GetList(SessionVariables.RequestProfile);

            UIHelper.LoadDropDown(personData, drpPersonList, ApplicationUserDataModel.DataColumns.FirstName,
                                  ApplicationUserDataModel.DataColumns.ApplicationUserId);

            drpPersonList.SelectedValue = SessionVariables.RequestProfile.AuditId.ToString();

            var applicationData = ApplicationDataManager.GetList(SessionVariables.RequestProfile);

            UIHelper.LoadDropDown(applicationData, drpApplicationList, ApplicationDataModel.DataColumns.Name,
                                  ApplicationDataModel.DataColumns.ApplicationId);

            if (isTesting)
            {
                //drpPersonList.AutoPostBack = true;


                if (drpPersonList.Items.Count > 0)
                {
                    if (!string.IsNullOrEmpty(txtPersonId.Text.Trim()))
                    {
                        drpPersonList.SelectedValue = txtPersonId.Text;
                    }
                    else
                    {
                        txtPersonId.Text = drpPersonList.SelectedItem.Value;
                    }
                }

                if (drpApplicationList.Items.Count > 0)
                {
                    if (!string.IsNullOrEmpty(txtApplicationId.Text.Trim()))
                    {
                        drpApplicationList.SelectedValue = txtApplicationId.Text;
                    }
                    else
                    {
                        txtApplicationId.Text = drpApplicationList.SelectedItem.Value;
                    }
                }
                txtPersonId.Visible      = true;
                txtApplicationId.Visible = true;
            }
            else
            {
                if (!string.IsNullOrEmpty(txtPersonId.Text.Trim()))
                {
                    drpPersonList.SelectedValue = txtPersonId.Text;
                }
                if (!string.IsNullOrEmpty(txtApplicationId.Text.Trim()))
                {
                    drpApplicationList.SelectedValue = txtApplicationId.Text;
                }
            }
        }
Пример #7
0
        public IEnumerable <ApplicationUserDataModel> ListUsers()
        {
            var data = new ApplicationUserDataModel();

            data.ApplicationId = SessionVariables.RequestProfile.ApplicationId;
            var listUsers = ApplicationUserDataManager.GetEntityDetails(data, SessionVariables.RequestProfile, ApplicationCommon.ReturnAuditInfo);

            return(listUsers);
        }
Пример #8
0
        private DataTable GetApplicationUserData(int taskId)
        {
            var dt       = TaskXApplicationUserDataManager.GetByTask(taskId, SessionVariables.RequestProfile);
            var audt     = ApplicationUserDataManager.GetList(SessionVariables.RequestProfile);
            var resultdt = audt.Clone();

            foreach (DataRow row in dt.Rows)
            {
                var rows = audt.Select("ApplicationUserId = " + row[ApplicationUserDataModel.DataColumns.ApplicationUserId]);
                resultdt.ImportRow(rows[0]);
            }
            return(resultdt);
        }
Пример #9
0
        private void GetCurrentUserEmailAddress()
        {
            var data = new ApplicationUserDataModel();

            data.ApplicationId       = SessionVariables.RequestProfile.ApplicationId;
            data.ApplicationUserName = SessionVariables.ApplicationUserName;

            DataTable dt = ApplicationUserDataManager.Search(data, SessionVariables.RequestProfile);

            if (dt.Rows.Count == 1)
            {
                txtEmailAddress.Text = dt.Rows[0]["EmailAddress"].ToString();
            }
        }
Пример #10
0
        public string GroupByPerson()
        {
            SessionVariables.RequestProfile.AuditId = 200;
            var dt = ScheduleDataManager.GetList(SessionVariables.RequestProfile);

            var workSummary = from eschedule in dt.AsEnumerable()

                              group eschedule by new { PersonId = eschedule.Field <int>("PersonId") } into wsum

                select new

            {
                PersonId = wsum.Key.PersonId,

                Duration = wsum.Sum(eschedule => eschedule.Field <decimal>("TotalHoursWorked")),

                //AvgStartTime = decimal.Round(wsum.Average(eschedule => eschedule.Field<decimal>("StartTime")), 2),
                AvgStartTime = wsum.Average(eschedule => decimal.Round(Convert.ToDecimal(eschedule.Field <DateTime>("StartTime").Hour + "." + eschedule.Field <DateTime>("StartTime").Minute), 2)),

                //AvgEndTime = decimal.Round(wsum.Average(eschedule => eschedule.Field<decimal>("EndTime")), 2)
                AvgEndTime = wsum.Average(eschedule => decimal.Round(Convert.ToDecimal(eschedule.Field <DateTime>("EndTime").Hour + "." + eschedule.Field <DateTime>("EndTime").Minute), 2)),
            };

            foreach (var VARIABLE in workSummary)
            {
                var personId  = VARIABLE.GetType().GetProperty("PersonId").GetValue(VARIABLE, null).ToString();
                var noofhours = VARIABLE.GetType().GetProperty("Duration").GetValue(VARIABLE, null).ToString();
                var starttime = VARIABLE.GetType().GetProperty("AvgStartTime").GetValue(VARIABLE, null).ToString();
                var endtime   = VARIABLE.GetType().GetProperty("AvgEndTime").GetValue(VARIABLE, null).ToString();


                if (int.Parse(personId) != 0)
                {
                    var personData = ApplicationUserDataManager.GetList(SessionVariables.RequestProfile);
                    var fullname   = (from DataRow dr in personData.Rows
                                      where (int)dr["ApplicationUserId"] == int.Parse(personId)
                                      select(string) dr["FullName"]).FirstOrDefault();

                    var summary = "Person " + fullname + "'s Total Hours Worked: " + noofhours +
                                  "hours,  Average Start Time: " + starttime +
                                  " hours,  Average End Time: " + endtime +
                                  " hours.";
                    RaiseSearch();

                    return(summary);
                }
            }
            return("");
        }
Пример #11
0
        private string GetApplicationUserName(int applicationUserId)
        {
            var applicationUserName = string.Empty;
            var data = new ApplicationUserDataModel();

            data.ApplicationUserId = applicationUserId;

            DataTable dt = ApplicationUserDataManager.Search(data, SessionVariables.RequestProfile);

            if (dt.Rows.Count == 1)
            {
                applicationUserName = dt.Rows[0][ApplicationUserDataModel.DataColumns.ApplicationUserName].ToString();
            }

            return(applicationUserName);
        }
Пример #12
0
        private void BindUsers()
        {
            var dtUsers = ApplicationUserDataManager.GetList(SessionVariables.RequestProfile);

            dtUsers = (from row in dtUsers.AsEnumerable()
                       where row["ApplicationId"].ToString() == SessionVariables.RequestProfile.ApplicationId.ToString()
                       select row).CopyToDataTable();

            UIHelper.LoadDropDown(dtUsers, drpPersons,
                                  ApplicationUserDataModel.DataColumns.FullName, ApplicationUserDataModel.DataColumns.ApplicationUserName);

            drpPersons.Items.Insert(0, new ListItem()
            {
                Text = "All", Value = "-1", Selected = true
            });
        }
Пример #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetUpDateRangeControl();
            if (!IsPostBack)
            {
                var auData = ApplicationUserDataManager.GetList(SessionVariables.RequestProfile);

                UIHelper.LoadDropDown(auData, drpApplicationUser, ApplicationUserDataModel.DataColumns.EmailAddress,
                                      ApplicationUserDataModel.DataColumns.EmailAddress);
                drpApplicationUser.Items.Insert(0, "All");

                var auData1 = ApplicationDataManager.GetList(SessionVariables.RequestProfile);

                UIHelper.LoadDropDown(auData1, drpApplicationId, ApplicationDataModel.DataColumns.Name,
                                      ApplicationDataModel.DataColumns.ApplicationId);
                drpApplicationId.Items.Insert(0, "All");
            }
        }
Пример #14
0
        private string GetCurrentUserEmailAddress()
        {
            var currentUserEmail = string.Empty;
            var data             = new ApplicationUserDataModel();

            data.ApplicationId       = SessionVariables.RequestProfile.ApplicationId;
            data.ApplicationUserName = SessionVariables.ApplicationUserName;

            DataTable dt = ApplicationUserDataManager.Search(data, SessionVariables.RequestProfile);

            if (dt.Rows.Count == 1)
            {
                txtEmailAddress.Text = dt.Rows[0][ApplicationUserDataModel.DataColumns.EmailAddress].ToString();
            }

            currentUserEmail = txtEmailAddress.Text;

            return(currentUserEmail);
        }
Пример #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetUpDateRangeControl();


            if (!IsPostBack)
            {
                var auData1 = CustomTimeCategoryDataManager.GetList(SessionVariables.RequestProfile);

                UIHelper.LoadDropDown(auData1, drpCustomTimeCategory, CustomTimeCategoryDataModel.DataColumns.Name,
                                      CustomTimeCategoryDataModel.DataColumns.CustomTimeCategoryId);
                drpApplicationUser.Items.Insert(0, "All");

                var auData = ApplicationUserDataManager.GetList(SessionVariables.RequestProfile);

                UIHelper.LoadDropDown(auData, drpApplicationUser, ApplicationUserDataModel.DataColumns.ApplicationUserName,
                                      ApplicationUserDataModel.DataColumns.ApplicationUserId);
                drpApplicationUser.Items.Insert(0, "All");

                txtPersonId.Visible = false;
            }
        }
Пример #16
0
        public void CalculateRNandSDWorkedHoursForAllUsers(int appId)
        {
            var resultArray  = new ArrayList();
            var appUserName  = string.Empty;
            var emailAddress = string.Empty;
            var obj          = new ApplicationUserDataModel();
            var dt           = ApplicationUserDataManager.GetList(SessionVariables.RequestProfile);
            var dt1          = ApplicationDataManager.GetList(SessionVariables.RequestProfile);


            for (var i = 0; i < dt.Rows.Count; i++)
            {
                emailAddress = (string)(dt.Rows[i][ApplicationUserDataModel.DataColumns.EmailAddress]);
                //appUserId = (int)(dt.Rows[i][ApplicationUserDataModel.DataColumns.ApplicationUserId]);
                //appId = (int)(dt1.Rows[i][ApplicationDataModel.DataColumns.ApplicationId]);
                appUserName = dt.Rows[i][ApplicationUserDataModel.DataColumns.FirstName] + " " + dt.Rows[i][ApplicationUserDataModel.DataColumns.LastName];
                var result = CalculateRNandSDWorkedHours(emailAddress, appId);
                result.TotalRNHrs = string.Format("{0}.00", result.TotalRNHrs);
                resultArray.Add(result);
            }

            gv.DataSource = resultArray;
            gv.DataBind();
        }
Пример #17
0
        public IEnumerable <ApplicationUserDataModel> GetPersonList()
        {
            var items = ApplicationUserDataManager.GetEntityDetails(ApplicationUserDataModel.Empty, SessionVariables.RequestProfile);

            return(items);
        }
Пример #18
0
        protected override DataTable GetData()
        {
            DataTable dt = ApplicationUserDataManager.Search(oSearchFilter.SearchParameters, SessionVariables.RequestProfile);

            return(dt);
        }
Пример #19
0
        private DataTable GetApplicationUserList()
        {
            var dt = ApplicationUserDataManager.GetList(SessionVariables.RequestProfile);

            return(dt);
        }
Пример #20
0
        private void SetupDropdown()
        {
            var isTesting = SessionVariables.IsTesting;

            var taskPriorityTypeData = TaskPriorityTypeDataManager.GetList(SessionVariables.RequestProfile);

            UIHelper.LoadDropDown(taskPriorityTypeData, drpTaskPriorityTypeList, StandardDataModel.StandardDataColumns.Name,
                                  TaskPriorityTypeDataModel.DataColumns.TaskPriorityTypeId);



            var taskData = TaskDataManager.GetList(SessionVariables.RequestProfile);

            UIHelper.LoadDropDown(taskData, drpTaskList, StandardDataModel.StandardDataColumns.Name,
                                  TaskDataModel.DataColumns.TaskId);



            var ApplicationUserData = ApplicationUserDataManager.GetList(SessionVariables.RequestProfile);

            UIHelper.LoadDropDown(ApplicationUserData, drpApplicationUserList, ApplicationUserDataModel.DataColumns.FirstName,
                                  ApplicationUserDataModel.DataColumns.ApplicationUserId);


            if (isTesting)
            {
                drpTaskList.AutoPostBack             = true;
                drpTaskPriorityTypeList.AutoPostBack = true;
                drpApplicationUserList.AutoPostBack  = true;
                if (drpTaskPriorityTypeList.Items.Count > 0)
                {
                    if (!string.IsNullOrEmpty(txtTaskPriorityTypeId.Text.Trim()))
                    {
                        drpTaskPriorityTypeList.SelectedValue = txtTaskPriorityTypeId.Text;
                    }
                    else
                    {
                        txtTaskPriorityTypeId.Text = drpTaskPriorityTypeList.SelectedItem.Value;
                    }
                }
                if (drpTaskList.Items.Count > 0)
                {
                    if (!string.IsNullOrEmpty(txtTaskId.Text.Trim()))
                    {
                        drpTaskList.SelectedValue = txtTaskId.Text;
                    }
                    else
                    {
                        txtTaskId.Text = drpTaskList.SelectedItem.Value;
                    }
                }
                if (drpApplicationUserList.Items.Count > 0)
                {
                    if (!string.IsNullOrEmpty(txtApplicationUserId.Text.Trim()))
                    {
                        drpApplicationUserList.SelectedValue = txtApplicationUserId.Text;
                    }
                    else
                    {
                        txtApplicationUserId.Text = drpApplicationUserList.SelectedItem.Value;
                    }
                }
                txtTaskPriorityTypeId.Visible = true;
                txtTaskId.Visible             = true;
                txtApplicationUserId.Visible  = true;
            }
            else
            {
                if (!string.IsNullOrEmpty(txtTaskPriorityTypeId.Text.Trim()))
                {
                    drpTaskPriorityTypeList.SelectedValue = txtTaskPriorityTypeId.Text;
                }
                if (!string.IsNullOrEmpty(txtTaskId.Text.Trim()))
                {
                    drpTaskList.SelectedValue = txtTaskId.Text;
                }
                if (!string.IsNullOrEmpty(txtApplicationUserId.Text.Trim()))
                {
                    drpApplicationUserList.SelectedValue = txtApplicationUserId.Text;
                }
            }
        }
Пример #21
0
        public void CalculateRNandSDWorkedHoursForAllUsersAllApps()
        {
            gv.DataSource = "";
            gv.DataBind();
            var resultArray  = new ArrayList();
            var appUserName  = string.Empty;
            var emailAddress = string.Empty;
            var result       = new ResultSet(string.Empty, "", "");
            var obj          = new ApplicationUserDataModel();

            SessionVariables.RequestProfile.ApplicationId = 100047;
            var applicationUserList = ApplicationUserDataManager.GetList(SessionVariables.RequestProfile);
            var applicationList     = ApplicationDataManager.GetList(SessionVariables.RequestProfile);
            var bc = new BoundField();

            for (var i = 0; i < applicationUserList.Rows.Count; i++)
            {
                var rnHrs = "0";
                emailAddress = (string)(applicationUserList.Rows[i][ApplicationUserDataModel.DataColumns.EmailAddress]);
                for (var j = 0; j < applicationList.Rows.Count; j++)
                {
                    var applicationName = applicationList.Rows[j][ApplicationDataModel.DataColumns.Name];
                    result = CalculateRNandSDWorkedHours(emailAddress, (int)applicationList.Rows[j][ApplicationDataModel.DataColumns.ApplicationId]);
                    rnHrs  = (int.Parse(result.TotalRNHrs) + int.Parse(rnHrs)).ToString();
                }
                result.TotalRNHrs = string.Format("{0}.00", rnHrs);
                resultArray.Add(result);
            }

            var cell = 3;

            for (var i = 0; i < applicationList.Rows.Count; i++)
            {
                if (!applicationList.Rows[i][ApplicationDataModel.DataColumns.Code].ToString().Equals(""))
                {
                    gv.Columns.Add(new BoundField());
                    var applicationName = applicationList.Rows[i][ApplicationDataModel.DataColumns.Name];
                    gv.Columns[cell].HeaderText = applicationName.ToString();
                    cell++;
                }
            }
            gv.DataSource = resultArray;
            gv.DataBind();
            for (var i = 0; i < applicationUserList.Rows.Count; i++)
            {
                cell         = 3;
                emailAddress = (string)(applicationUserList.Rows[i][ApplicationUserDataModel.DataColumns.EmailAddress]);
                for (var j = 0; j < applicationList.Rows.Count; j++)
                {
                    if (!applicationList.Rows[j][ApplicationDataModel.DataColumns.Code].ToString().Equals(""))
                    {
                        var applicationName = applicationList.Rows[j][ApplicationDataModel.DataColumns.Name];
                        result = CalculateRNandSDWorkedHours(emailAddress, (int)applicationList.Rows[j][ApplicationDataModel.DataColumns.ApplicationId]);
                        gv.Rows[i].Cells[cell].HorizontalAlign = HorizontalAlign.Right;
                        gv.Rows[i].Cells[cell].Text            = string.Format("{0}.00", result.TotalRNHrs);
                        cell++;
                    }
                }
            }


            int rowscount    = gv.Rows.Count;
            int columnscount = gv.Columns.Count;

            for (int j = 3; j < columnscount; j++)
            {
                var countRemove = 0;

                for (int i = 1; i < rowscount; i++)
                {
                    if (Convert.ToDouble(gv.Rows[i].Cells[j].Text) != 0.00)
                    {
                        countRemove++;
                    }
                }
                if (countRemove == 0)
                {
                    gv.Columns[j].Visible = false;
                }
            }
        }
Пример #22
0
        public ResultSet CalculateRNandSDWorkedHours(string emailAddress, int appId)
        {
            var rnTotalHours  = 0.0;
            var srnTotalHours = 0.0;
            var sdTotalHours  = 0;
            var temp          = 0.0;
            var developer     = string.Empty;
            var appUserId     = 0;
            var appUserName   = string.Empty;
            var fromDateTime  = new DateTime();
            var toDateTime    = new DateTime();
            var date          = new ReleaseLogDetailDataModel();

            var dateValue = ReleaseLogDetailDataManager.GetDetails(date, SessionVariables.RequestProfile);
            var dv        = dateValue.DefaultView;

            dv.Sort = "ReleaseDate ASC";

            if (oDateRange.FromDateTime.Equals("") || oDateRange.ToDateTime.Equals(""))
            {
                fromDateTime = Convert.ToDateTime(dv.ToTable().Rows[0][ReleaseLogDetailDataModel.DataColumns.ReleaseDate].ToString());
                toDateTime   = Convert.ToDateTime(dv.ToTable().Rows[dateValue.Rows.Count - 1][ReleaseLogDetailDataModel.DataColumns.ReleaseDate].ToString());
            }
            else
            {
                fromDateTime = Convert.ToDateTime(DateTimeHelper.FromUserDateFormatToApplicationDateFormat(oDateRange.FromDateTime));
                toDateTime   = Convert.ToDateTime(DateTimeHelper.FromUserDateFormatToApplicationDateFormat(oDateRange.ToDateTime));
            }
            var format   = SessionVariables.UserDateFormat;
            var fromDate = fromDateTime.ToString(format);
            var toDate   = toDateTime.ToString(format);


            //var appObj = new ApplicationDataModel();
            //appObj.ApplicationId = appId;
            //var dt3 = Framework.Components.ApplicationUser.ApplicationDataManager.Search(appObj, SessionVariables.RequestProfile);
            //var applicationName = dt3.Rows[0][ApplicationDataModel.DataColumns.Name];

            var obj1 = new ApplicationUserDataModel();

            obj1.EmailAddress = emailAddress;
            SessionVariables.RequestProfile.ApplicationId = 100;
            var dt1 = ApplicationUserDataManager.Search(obj1, SessionVariables.RequestProfile);

            //appUserId = (int)(dt1.Rows[0][ApplicationUserDataModel.DataColumns.ApplicationUserId]);
            appUserName = dt1.Rows[0][ApplicationUserDataModel.DataColumns.FirstName] + " " + dt1.Rows[0][ApplicationUserDataModel.DataColumns.LastName];

            if (dt1.Rows[0][ApplicationUserDataModel.DataColumns.LastName].ToString().Substring(1, 1).Equals("u"))
            {
                developer = (string)(dt1.Rows[0][ApplicationUserDataModel.DataColumns.FirstName].ToString().Substring(0, 1) + dt1.Rows[0][ApplicationUserDataModel.DataColumns.LastName].ToString().Substring(0, 1) + "2");
            }
            else
            {
                developer = (string)(dt1.Rows[0][ApplicationUserDataModel.DataColumns.FirstName].ToString().Substring(0, 1) + dt1.Rows[0][ApplicationUserDataModel.DataColumns.LastName].ToString().Substring(0, 1));
            }


            var tsObj = new ReleaseLogDetailDataModel();

            tsObj.ReleaseDateMin   = Convert.ToDateTime(fromDate);
            tsObj.ReleaseDateMax   = Convert.ToDateTime(toDate);
            tsObj.ApplicationId    = appId;
            tsObj.PrimaryDeveloper = developer;
            var dt4   = ReleaseLogDetailDataManager.Search(tsObj, SessionVariables.RequestProfile);
            var temp1 = 0.0;

            for (var i = 0; i < dt4.Rows.Count; i++)
            {
                if (dt4.Rows[i][ReleaseLogDetailDataModel.DataColumns.PrimaryDeveloper].Equals(developer) || dt4.Rows[i][ReleaseLogDetailDataModel.DataColumns.PrimaryDeveloper].Equals("Admin"))
                {
                    if (!dt4.Rows[i][ReleaseLogDetailDataModel.DataColumns.TimeSpent].Equals("Unknown"))
                    {
                        temp1         = (double)Convert.ToDouble(dt4.Rows[i][ReleaseLogDetailDataModel.DataColumns.TimeSpent]);
                        srnTotalHours = srnTotalHours + temp1;
                    }
                }
            }



            var sObj = new ApplicationUserDataModel();

            sObj.EmailAddress  = emailAddress;
            sObj.ApplicationId = 100047;
            var sDt = ApplicationUserDataManager.Search(sObj, SessionVariables.RequestProfile);

            if (sDt.Rows.Count > 0)
            {
                var obj2 = new ScheduleDataModel();
                obj2.FromSearchDate = Convert.ToDateTime(fromDate);
                obj2.ToSearchDate   = Convert.ToDateTime(toDate);
                obj2.Person         = (sDt.Rows[0][ApplicationUserDataModel.DataColumns.ApplicationUserId]).ToString();
                obj2.ApplicationId  = 100047;
                //SessionVariables.RequestProfile.ApplicationId = 100047;
                var dt2 = ScheduleDataManager.Search(obj2, SessionVariables.RequestProfile);


                for (var i = 0; i < dt2.Rows.Count; i++)
                {
                    temp         = Convert.ToInt32(dt2.Rows[i][ScheduleDataModel.DataColumns.TotalHoursWorked]);
                    sdTotalHours = sdTotalHours + (int)temp;
                }
            }


            var resultSet = new ResultSet(appUserName, ((int)(rnTotalHours + srnTotalHours)).ToString(), string.Format("{0}.00", sdTotalHours));

            return(resultSet);
        }
Пример #23
0
        private void SetupDropdown()
        {
            var isTesting  = SessionVariables.IsTesting;
            var personData = ApplicationUserDataManager.GetList(SessionVariables.RequestProfile);

            UIHelper.LoadDropDown(personData, drpPersonList, ApplicationUserDataModel.DataColumns.FirstName,
                                  ApplicationUserDataModel.DataColumns.ApplicationUserId);

            drpPersonList.SelectedValue = SessionVariables.RequestProfile.AuditId.ToString();

            var scheduleStateData = ScheduleStateDataManager.GetList(SessionVariables.RequestProfile);

            UIHelper.LoadDropDown(scheduleStateData, drpScheduleStateList, StandardDataModel.StandardDataColumns.Name,
                                  ScheduleStateDataModel.DataColumns.ScheduleStateId);

            if (drpScheduleStateList.Items.FindByText("Submitted") != null)
            {
                drpScheduleStateList.SelectedValue = drpScheduleStateList.Items.FindByText("Submitted").Value;                 // Submitted selected by default
            }

            if (isTesting)
            {
                drpPersonList.AutoPostBack        = true;
                drpScheduleStateList.AutoPostBack = true;

                if (drpPersonList.Items.Count > 0)
                {
                    if (!string.IsNullOrEmpty(txtPersonId.Text.Trim()))
                    {
                        drpPersonList.SelectedValue = txtPersonId.Text;
                    }
                    else
                    {
                        txtPersonId.Text = drpPersonList.SelectedItem.Value;
                    }
                }


                if (drpScheduleStateList.Items.Count > 0)
                {
                    if (!string.IsNullOrEmpty(txtScheduleState.Text.Trim()))
                    {
                        drpScheduleStateList.SelectedValue = txtScheduleState.Text;
                    }
                    else
                    {
                        txtScheduleState.Text = drpScheduleStateList.SelectedItem.Value;
                    }
                }
                txtPersonId.Visible      = true;
                txtScheduleState.Visible = true;
            }
            else
            {
                if (!string.IsNullOrEmpty(txtPersonId.Text.Trim()))
                {
                    drpPersonList.SelectedValue = txtPersonId.Text;
                }

                if (!string.IsNullOrEmpty(txtScheduleState.Text.Trim()))
                {
                    drpScheduleStateList.SelectedValue = txtScheduleState.Text;
                }
            }
        }