Exemplo n.º 1
0
 public string FormatText(object objval)
 {
     string StrReturn = "";
       try
       {
       CustomFacade objCustomFacade = new CustomFacade();
       string UserID = Convert.ToString(objval);
       StrReturn = objCustomFacade.GetRoleDetailsBYUserId(UserID);
       }
       catch (Exception ex)
       {
       }
       return StrReturn;
 }
Exemplo n.º 2
0
    void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack) {
          if ((Page.User.IsInRole("ProjectAdministrator") || Page.User.IsInRole("ProjectManager"))) {
        UserList.DataSourceID = "ProjectMembers";

        //if (Page.User.ToString() != null && Page.User.ToString() != "")
        //{
        //    UserList.SelectedValue = Page.User.ToString();
        //}
          //UserList.SelectedValue=
        if (Page.User.IsInRole("ProjectAdministrator")) {
          ProjectData.SortParameterName = "sortParameter";
          ProjectData.SelectMethod = "GetAllProjects";
          divTimeSheet.Visible = false;
          AllProjectList.DataBind();
          ListItem select = new ListItem("Select", "0");
          if (AllProjectList.Items.Contains(select).ToString() != "True")
          {
              AllProjectList.Items.Insert(0, new ListItem("Select All", "0"));
          }
          UserList.DataBind();

          ProjectList.Items.Insert(0, new ListItem("Select", "0"));
          admin.Attributes.Add("style","width:0px;");
          admin.Visible = false;
        }
        else if (Page.User.IsInRole("ProjectManager")) {

          ProjectData.SelectParameters.Add(new Parameter("userName", TypeCode.String, Page.User.Identity.Name));
          ProjectData.SelectMethod = "GetProjectsByUserName";
          SQLDataAccess objSQLDataAccess = new SQLDataAccess();
          List<Category> objCategorylist = objSQLDataAccess.GetCategoriesByUserName(Convert.ToString(""));
          CategoryList.DataSource = objCategorylist;
          CategoryList.DataTextField = "Name";
          CategoryList.DataValueField = "Id";
          //CategoryList.DA =Convert.ToString(objCategorylist[0].Name);
          //CategoryList.SelectedValue = Convert.ToString(objCategorylist[0].Id);
          CategoryList.DataBind();
          AllProjectList.DataBind();
          ListItem select = new ListItem("Select", "0");
          if (AllProjectList.Items.Contains(select).ToString() != "True")
          {
              AllProjectList.Items.Insert(0, new ListItem("Select All", "0"));
          }
          UserList.DataBind();
          UserList.Items.Insert(0, new ListItem("Select", "0"));
          //ProjectList.Items.Insert(0, new ListItem("Select", "0"));
        }
          }
          else if (Page.User.IsInRole("TeamLeader"))
          {
          ProjectData.SelectParameters.Add(new Parameter("userName", TypeCode.String, Page.User.Identity.Name));
          ProjectData.SelectMethod = "GetProjectsByUserName";
          UserList.Items.Add(Page.User.Identity.Name);

          SQLDataAccess objSQLDataAccess = new SQLDataAccess();
          List<Category> objCategorylist = objSQLDataAccess.GetCategoriesByUserName(Convert.ToString(Page.User.Identity.Name));
          CategoryList.DataSource = objCategorylist;
          CategoryList.DataTextField = "Name";
          CategoryList.DataValueField = "Id";
          //CategoryList.DA =Convert.ToString(objCategorylist[0].Name);
          //CategoryList.SelectedValue = Convert.ToString(objCategorylist[0].Id);
          CategoryList.DataBind();
          AllProjectList.DataBind();
          ListItem select = new ListItem("Select", "0");
          if (AllProjectList.Items.Contains(select).ToString() != "True")
          {
              AllProjectList.Items.Insert(0, new ListItem("Select All", "0"));
          }

         // ProjectList.Items.Insert(0, new ListItem("Select", "0")); /
          }
          else
          {
          ProjectData.SelectParameters.Add(new Parameter("userName", TypeCode.String, Page.User.Identity.Name));

          ProjectData.SelectMethod = "GetProjectsByUserName";
          CustomFacade objCustomFacade = new CustomFacade();
          List<Project> listProject = new List<Project>();
          //listProject = objCustomFacade.GetProjectsByUserName(Page.User.Identity.Name);

          UserList.Items.Add(Page.User.Identity.Name);
          //UserList.Items.Insert(0, new ListItem("Select", "0"));

          SQLDataAccess objSQLDataAccess = new SQLDataAccess();
          List<Category> objCategorylist = objSQLDataAccess.GetCategoriesByUserName(Convert.ToString(Page.User.Identity.Name));
          CategoryList.DataSource = objCategorylist;
          CategoryList.DataTextField = "Name";
          CategoryList.DataValueField = "Id";
          //CategoryList.DA =Convert.ToString(objCategorylist[0].Name);
          //CategoryList.SelectedValue = Convert.ToString(objCategorylist[0].Id);
          CategoryList.DataBind();
          AllProjectList.DataBind();
          ListItem select = new ListItem("Select", "0");
          if (AllProjectList.Items.Contains(select).ToString() != "True")
          {
              AllProjectList.Items.Insert(0, new ListItem("Select All", "0"));
          }
          //ProjectList.Items.Insert(0, new ListItem("Select", "0"));
          }
          username.Text = "Welcome: " + Session["username"];
          ProjectList.DataBind();
          //ProjectList.Items.Insert(0, new ListItem("Select", "0"));

          //if (ProjectList.SelectedValue != "0" && ProjectList.SelectedValue != "")
          //{
          //    if (Session["username"] != null && Session["username"] != "")
          //    {
          //        UserList.SelectedItem.Text = Convert.ToString(Session["username"]);
          //    }
          //}

          //if (ProjectListGridView.Rows.Count==0)
          //{
          //    lblexport.Visible =false;
          //    lnkexport.Visible = false;
          //}
          if (ProjectList.Items.Count >= 1)
          {
          TimeEntryView.Visible = true;
          MessageView.Visible = false;
          }
          else
          {
          TimeEntryView.Visible = true;
          MessageView.Visible = false;
          }
          StartDate.Text = DateTime.Now.Date.AddDays(-7).ToShortDateString();
          EndDate.Text = DateTime.Now.ToShortDateString();
          ProjectListGridView.DataBind();
        }
        if (UserList.Items.Count == 0) {
        AddEntry.Enabled = false;
        }
    }
        public static List<UserTotalDurationReport> GetUserReportsByUserNamesAndMonthAndyear(string userNames, int Month, int Year,string ProjectId)
        {
            if (String.IsNullOrEmpty(userNames))
                return (new List<UserTotalDurationReport>());

            char[] separator = new char[] { ',' };
            string[] substrings = userNames.Split(separator);
            //string[] substringProject = ProjectId.Split(separator);
            List<UserTotalDurationReport> list = new List<UserTotalDurationReport>();
            if (ProjectId != null && ProjectId!="0")
            {
                if (ProjectId.Length > 0)
                {
                    ProjectId = ProjectId.Trim().Substring(0, ProjectId.Length - 1);
                }
            }
            foreach (string str in substrings)
            {
            if (ProjectId=="0")
            {
                CustomFacade ObjCustomFacade = new CustomFacade();
                List<Project> objlstProject = new List<Project>();
                 objlstProject = ObjCustomFacade.GetProjectDetailsByUserDetails(Convert.ToString(str));
                 if (objlstProject.Count > 0)
                 {
                     for (int i = 0; i < objlstProject.Count; i++)
                     {
                         if (ProjectId == "")
                         {
                             ProjectId = ProjectId + "," + Convert.ToString(objlstProject[i].Id);
                         }
                         else
                         {
                             ProjectId = Convert.ToString(objlstProject[i].Id);
                         }
                     }
                 }
            }

            if (!string.IsNullOrEmpty(str))
            {
                //foreach (var item in substringProject)
                //{
                //    if (!string.IsNullOrEmpty(item))
                //    {
                        List<UserTotalDurationReport> tempList = UserTotalDurationReport.GetUserReportsByUserNameAndMonthAndyear(str, Month, Year, ProjectId);
                        foreach (UserTotalDurationReport userReport in tempList)
                        {
                            list.Add(userReport);
                        }
                //    }
                //}
            }
            }
            return list;
        }
Exemplo n.º 4
0
 private void BindClientDeatails()
 {
     try
     {
         List<Project> lstProjectDetails = new List<Project>();
         CustomFacade objCustomFacade = new CustomFacade();
         lstProjectDetails = objCustomFacade.GetClientDeatils();
         if (lstProjectDetails.Count > 0)
         {
             ddlClientName.DataSource = lstProjectDetails;
             ddlClientName.DataTextField = "Name";
             ddlClientName.DataValueField = "Id";
             ddlClientName.DataBind();
         }
         ddlClientName.Items.Insert(0, new ListItem("Select", "0"));
         ddlClientName.SelectedValue = "0";
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 5
0
    protected void SaveButton_Click(object obj, EventArgs args)
    {
        if (Page.IsValid == false)
            return;
        Project newProject;
          if (CurrentProject != null)
            {
                newProject = Project.GetProjectById(CurrentProject.Id);

            }
            else
            {
                newProject = new Project(Page.User.Identity.Name, Page.User.Identity.Name, ProjectName.Text);
            }
          try
          {
              CustomFacade objCustomFacade = new CustomFacade();

                  newProject.ClientName = Convert.ToString(ddlClientName.SelectedValue);
                  newProject.Name = ProjectName.Text;
                  newProject.CompletionDate = Convert.ToDateTime(EstimatedDate.Text);
                  newProject.Description = Description.Text;
                  newProject.DevelopmentEstimateDuration = Convert.ToDecimal(txtDevHours.Text);
                  newProject.TestingEstimateDuration = Convert.ToDecimal(txtTestingHrs.Text);
                  newProject.DesignEstimateDuration = Convert.ToDecimal(txtDesignHrs.Text);
                  newProject.BAEstimateDuration = Convert.ToDecimal(txtBAHrs.Text);
                  newProject.ProjectManagementEstimateDuration = Convert.ToDecimal(txtProjectHrs.Text);
                  newProject.OtherDuration = Convert.ToDecimal(txtOtherDuration.Text);
                  //Duration.Enabled = true;
                  //if (Duration.Text.Trim() != "")
                  //{
                  //    newProject.EstimateDuration = Convert.ToDecimal(Duration.Text);
                  //}
                  //else
                  //{
                  newProject.EstimateDuration = Convert.ToDecimal(hdnDuration.Value);
                  //}

                  //Duration.Enabled = false;
                  newProject.ManagerUserName = Managers.SelectedItem.Value;
                  if (chkIsCompleted.Checked == true)
                  {
                      newProject.IsCompleted = true;
                  }
                  else
                  {
                      newProject.IsCompleted = false;
                  }
                  if (CurrentProject != null)
                  {
                      if (!objCustomFacade.IsProjectExists(ProjectName.Text.Trim(), CurrentProject.Id))
                      {
                          if (!newProject.Save())
                          {
                              // ErrorMessage.Text = "There was an error.  Please fix it and try it again.";

                          }
                          UpdateProjectMembers(newProject.Id);

                          string strUrl = "Project_Details.aspx?ProjectId=" + newProject.Id.ToString() + "&succ=true";
                          Response.Redirect(strUrl);
                      }
                      else
                      {
                          Error.Visible = true;
                          Error.Text = "Already the project name is exists.";
                      }
                  }
                  else
                  {
                      if (!newProject.Save())
                      {
                          // ErrorMessage.Text = "There was an error.  Please fix it and try it again.";

                      }
                      UpdateProjectMembers(newProject.Id);

                      string strUrl = "Project_Details.aspx?ProjectId=" + newProject.Id.ToString() + "&succ=true";
                      Response.Redirect(strUrl);
                  }

          }

          catch (Exception ex)
          {
              string strUrl1 = "Project_Details.aspx?ProjectId=" + newProject.Id.ToString() + "&error=false";

              Error.Text = "Project name already exists.";
              //Response.Redirect(strUrl1);
          }
    }
Exemplo n.º 6
0
 protected void Consultants_DataBound(object sender, EventArgs e)
 {
     int count = Consultants.Items.Count;
     string RoleName = "";
     if (count>0)
     {
         for (int i = 0; i < Consultants.Items.Count; i++)
         {
             CustomFacade objCustomFacade = new CustomFacade();
             RoleName = objCustomFacade.GetRoleDetailsBYUserName(Consultants.Items[i].Value);
             if (RoleName.ToLower().Contains("projectadministrator") || RoleName.ToLower().Contains("projectmanager"))
             {
                 Consultants.Items.Remove(Consultants.Items[i].Value);
             }
         }
     }
 }