protected void LineManagees_SelectedIndexChanged(object sender, EventArgs e) { LMName.InnerHtml = LineManagees.SelectedItem.ToString(); ERS.BAL.Reviews rev = new ERS.BAL.Reviews(); int lCategoryID = rev.GetCategoryID("Director"); int LMIDWhoisOn = Int32.Parse(Request.QueryString["LMID"]); int EmpID = Int32.Parse(LineManagees.SelectedValue); int DirectorID = Int32.Parse(Session["UserId"].ToString()); int ReviewID = rev.GetReviewID(LMIDWhoisOn , DirectorID , EmpID ); if (ReviewID != -1) { ERS.ReviewInfo RevInfo = rev.GetReviewInfo(ReviewID, lCategoryID); if (RevInfo != null) { CommentsTxt.Text = RevInfo.Comments; RatingsTxt.Text = RevInfo.Rating.ToString(); } } else { CommentsTxt.Text = ""; RatingsTxt.Text = ""; } // ERS.BAL.Reviews rev = new ERS.BAL.Reviews(); List<ERS.DAL.EmpWithRevInfo_Cat> Source = rev.GetAllReviewsOf_Peer_GivenCategory(Int32.Parse(LineManagees.SelectedValue), Int32.Parse(ViewState["SelCatID"].ToString())); AllReviews.DataSource = Source; AllReviews.DataBind(); }
protected void LinkButton1_Click(object sender, EventArgs e) { if (!Session["isLM"].Equals(false)) { LinkButton SendButton = (LinkButton)sender; int a = Int32.Parse(SendButton.CommandArgument); ERS.BAL.Reviews rev = new ERS.BAL.Reviews(); List<ERS.DAL.EmpWithRevInfo_Cat> Source = rev.GetAllReviewsOf_Peer_GivenCategory(Int32.Parse(ViewState["EmpID"].ToString()), a); PeerReviews.DataSource = Source; PeerReviews.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { // Permissions perm = new Permissions(); // perm.Insert(1, 2); Response.Cache.SetCacheability(HttpCacheability.NoCache); MenuItemMyReviews = "active"; if (Session["UserId"] == null) Response.Redirect("Default.aspx"); if (!IsPostBack) { Reviews BReviews = new Reviews(); ReviewList.DataSource = BReviews.GetReviewsList((Int32)Session["UserID"]); ReviewList.DataBind(); } }
protected void ManageeList_RowDataBound(object sender, GridViewRowEventArgs e) { try { switch (e.Row.RowType) { case DataControlRowType.Header: //... break; case DataControlRowType.DataRow: int LMID = Int32.Parse(Session["UserId"].ToString()); Button ConsoBtn = (Button)e.Row.FindControl("ConsoBtn"); List<ERS.DAL.Managees> mylist = (List<ERS.DAL.Managees>)((GridView)sender).DataSource; int EmpID = (int)((GridView)sender).DataKeys[e.Row.RowIndex]["EmpID"]; Managees BALManageeInst = new Managees(); Reviews RevInst = new Reviews(); if (BALManageeInst.CanConsolidate(EmpID)) ConsoBtn.Enabled = true; else ConsoBtn.Enabled = false; if (BALManageeInst.isConsolidated(EmpID, LMID)) ConsoBtn.Text = "Show Consolidated Review"; Label Fail = (e.Row.FindControl("Fail") as Label); if (RevInst.GetStatus(LMID, EmpID) == "Completed") ConsoBtn.ToolTip = "Self Review Has Been Filled By This Managee"; else ConsoBtn.ToolTip = "Self Review Has Not Been Filled"; break; } } catch { //...throw } }
protected void ButtonHeading_Click(object sender, EventArgs e) { LinkButton SendButton = (LinkButton)sender; int CatID = Int32.Parse(SendButton.CommandArgument); var item = (RepeaterItem)SendButton.NamingContainer; System.Web.UI.HtmlControls.HtmlGenericControl LI = (System.Web.UI.HtmlControls.HtmlGenericControl)item.FindControl("CatLI"); LI.Attributes["class"] = "active"; foreach (RepeaterItem a in Categories.Items) { System.Web.UI.HtmlControls.HtmlGenericControl LI2 = (System.Web.UI.HtmlControls.HtmlGenericControl)a.FindControl("CatLI"); if( LI2 != LI ) LI2.Attributes["class"] = ""; } ERS.BAL.Reviews rev = new ERS.BAL.Reviews(); List<ERS.DAL.EmpWithRevInfo_Cat> Source = rev.GetAllReviewsOf_Peer_GivenCategory(Int32.Parse(LineManagees.SelectedValue), CatID); AllReviews.DataSource = Source; AllReviews.DataBind(); ViewState["SelCatID"] = CatID; }
protected void ManageeList_RowCommand(object sender, GridViewCommandEventArgs e) { switch (e.CommandName.ToString()) { case "ShowPeers": int rowIndex = int.Parse(e.CommandArgument.ToString()); // Which is one of LM's ManageeID int EmpID = (int)((GridView)sender).DataKeys[rowIndex]["EmpID"]; GridViewRow row = ((GridView)sender).Rows[rowIndex]; Managees BManagees = new Managees(); GridView Peers = (GridView) row.FindControl("ManageePeers"); Peers.DataSource = null; int LMID = Int32.Parse(Session["UserId"].ToString()); Peers.DataSource = BManagees.GetPeerList(EmpID,LMID); Peers.DataBind(); Reviews rev = new Reviews(); rev.AddReview(EmpID, LMID, EmpID, "Self" , "Solicitation"); // Label Fail = (row.FindControl("Fail") as Label); // Fail.Text = rev.GetType(SelfId); break; case "Consolidate": rev = new Reviews(); rowIndex = int.Parse(e.CommandArgument.ToString()); row = ((GridView)sender).Rows[rowIndex]; EmpID = (int)((GridView)sender).DataKeys[rowIndex]["EmpID"]; int ReviewID = rev.CreateReviewForConsolidate(EmpID, (int)Session["UserID"]); Response.Redirect("ReviewForm.aspx?OpenedFor=consolidate&ROE=" + EmpID + "&SRI=" + ReviewID); break; } }
protected void ManageePeers_RowCommand(object sender, GridViewCommandEventArgs e) { int rowIndex = int.Parse(e.CommandArgument.ToString()); // This is the Review ID of his LineManagee with that Particular Peer int ReviewID = (int)((GridView)sender).DataKeys[rowIndex]["ReviewID"]; GridViewRow row = ((GridView)sender).Rows[rowIndex]; switch (e.CommandName.ToString()) { case "Show": int EmpID = Int32.Parse((row.FindControl("ImPeerOf") as HiddenField).Value); // He is the Person i.e LM's Managee whose review will be Opened int peerID = Int32.Parse((row.FindControl("PeerID") as HiddenField).Value); Response.Redirect("ReviewForm.aspx?ROE=" + EmpID + "&SRI=" + ReviewID); break; case "Ask": // ERS.DAL.ERSRepository Rep = new ERS.DAL.ERSRepository(); // ERS.Review temp = new ERS.Review(); // temp.Date = DateTime.Now; Reviews rev = new Reviews(); EmpID = Int32.Parse((row.FindControl("ImPeerOf") as HiddenField).Value); peerID = Int32.Parse((row.FindControl("PeerID") as HiddenField).Value); rev.AddReview(EmpID, (int)Session["UserID"], peerID, "None" , "Solicitation"); string script = "OnSelectedIndexChange();"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "UserSecurity", script, true); GridView Peers = ((GridView)sender); Managees BManagees = new Managees(); int LMID = Int32.Parse(Session["UserId"].ToString()); Peers.DataSource = BManagees.GetPeerList(EmpID,LMID); Peers.DataBind(); break; } }
protected void Page_Load(object sender, EventArgs e) { // Init , check session MenuItemMyReviews = "active"; Response.Cache.SetCacheability(HttpCacheability.NoCache); if (Session["UserId"] == null) Response.Redirect("Default.aspx"); if (Request.QueryString["SRI"] != null && !IsPostBack) { string referer = Request.UrlReferrer.ToString(); int ReviewID = Int32.Parse(Request.QueryString["SRI"].ToString()); ERS.BAL.Reviews rev = new ERS.BAL.Reviews(); String Type = rev.GetType(ReviewID); ERS.DAL.EmployeeWithLM ReviewedEmp = rev.GetEmployeeFromReview(ReviewID); LMName.InnerText = ReviewedEmp.CurrEmployeeLM.Name; EmpName.InnerText = ReviewedEmp.CurrEmployee.Name; EmpDesignation.InnerText = ReviewedEmp.CurrEmployee.Position.PositionName; bool isLMOfReview = rev.isLMOfReview(Int32.Parse(Session["UserID"].ToString()), ReviewID); bool isEmpOfReview = rev.isEmpOfReview(Int32.Parse(Session["UserID"].ToString()), ReviewID); // Is it LM's Filled Review For Employee bool LMSConsolidation = rev.isLMSConsolidation(ReviewID); // If this review is opened by someone who is not LM of this review // OR it is opened by employee himself or Reviewer Self OR Reviewers //Setting all to false; PeerPanel.Visible = false; LineManagerRating.Visible = false; DirectorRating.Visible = false; CalcRating.Visible = false; submit.Visible = false; save.Visible = false; Reject.Visible = false; if (!(isLMOfReview || isEmpOfReview)) Response.Redirect("Default.aspx"); // LM Opens for seeing And is not his own consolidation if (isLMOfReview && LMSConsolidation) { PeerPanel.Visible = true; LineManagerRating.Visible = true; Reject.Visible = false; } else if ( isLMOfReview && Type == "Solicitation" ) { PeerPanel.Visible = true; Reject.Visible = true; } else { // Review is opened by an Employee PeerPanel.Visible = false; LineManagerRating.Visible = false; DirectorRating.Visible = false; CalcRating.Visible = false; submit.Visible = false; // Disabling , will enable after querying and gettiing actual status of review save.Visible = false; Reject.Visible = false; } // Save in Viewstate ViewState["PreviousPageUrl"] = Request.UrlReferrer.ToString(); ViewState["ReviewID"] = ReviewID; ViewState["EmpID"] = ReviewedEmp.CurrEmployee.EmpID; // Load Cats Categories.DataSource = rev.GetCategories(); Categories.DataBind(); # region Decide To Show LM Comment Or Not bool toShowOrNot = true; String StatusOfCurrentReview = rev.GetStatus(ReviewID); if (StatusOfCurrentReview != null) { if (StatusOfCurrentReview == "Complete") { toShowOrNot = false; submit.Visible = false; save.Visible = false; } else if (StatusOfCurrentReview != "Rejected") { toShowOrNot = true; submit.Visible = true; save.Visible = true; } } #endregion # region Loading Saved Text foreach (RepeaterItem a in Categories.Items) { int pReviewID = Int32.Parse(Request.QueryString["SRI"].ToString()); int pCategoryID = Int32.Parse((a.FindControl("CatID") as HiddenField).Value); String str = rev.GetStatus(ReviewID); ERS.ReviewInfo RevInfo = rev.GetReviewInfo(ReviewID, pCategoryID); if(RevInfo != null ) { TextBox RatingsTxt = (a.FindControl("RatingsTxt") as TextBox); RatingsTxt.Text = RevInfo.Rating.ToString(); RatingsTxt.Enabled = toShowOrNot; TextBox CommentsTxt = (a.FindControl("CommentsTxt") as TextBox); CommentsTxt.Text = RevInfo.Comments.ToString(); CommentsTxt.Enabled = toShowOrNot; } } if (Session["isLM"].Equals(true)) { int lCategoryID = rev.GetCategoryID("LineManager"); ERS.ReviewInfo RevInfo = rev.GetReviewInfo(ReviewID,lCategoryID); if(RevInfo != null ) { LMCommentsTxt.Text = RevInfo.Comments; LMRatingsTxt.Text = RevInfo.Rating.ToString(); LMCommentsTxt.Enabled = toShowOrNot; LMRatingsTxt.Enabled = toShowOrNot; } } #endregion } }
protected void submit_Click(object sender, EventArgs e) { Reviews rev = new Reviews(); List<ERS.ReviewInfo> Result = new List<ERS.ReviewInfo>(); int pReviewID = Int32.Parse(Request.QueryString["SRI"].ToString()); // Filling Categories Comments & Ratings foreach (RepeaterItem a in Categories.Items) { int pCategoryID = Int32.Parse((a.FindControl("CatID") as HiddenField).Value); Double pRating = Double.Parse((a.FindControl("RatingsTxt") as TextBox).Text); String pComments = (a.FindControl("CommentsTxt") as TextBox).Text; // THe statement Below should be done by rev.AddReviewInfo Result.Add(new ERS.ReviewInfo() { CategoryID = pCategoryID, Comments = pComments, Rating = (decimal)pRating, ReviewId = rev.GetAReviewID(pReviewID) }); } // Filling LMS Comments and Ratings bool isLMOfReview = rev.isLMOfReview(Int32.Parse(Session["UserID"].ToString()), pReviewID); if (Session["isLM"].Equals(true) && isLMOfReview) { int lReviewID = Int32.Parse(Request.QueryString["SRI"].ToString()); int lCategoryID = rev.GetCategoryID("LineManager"); Double lRating = Double.Parse(LMRatingsTxt.Text); String lComments = LMCommentsTxt.Text; // THe statement Below should be done by rev.AddReviewInfo Result.Add(new ERS.ReviewInfo() { CategoryID = lCategoryID, Comments = lComments, Rating = (decimal)lRating, ReviewId = rev.GetAReviewID(lReviewID) }); } //If Review is filled by LM , its consolidated if by employee its just filled if( isLMOfReview) rev.FillReviews(Int32.Parse(Request.QueryString["SRI"].ToString()), Result, "Consolidated"); else rev.FillReviews(Int32.Parse(Request.QueryString["SRI"].ToString()), Result, "Completed"); Response.Redirect(ViewState["PreviousPageUrl"].ToString()); }
protected void save_Click(object sender, EventArgs e) { Reviews rev = new Reviews(); List<ERS.ReviewInfo> Result = new List<ERS.ReviewInfo>(); // SaveCategories Comments and Ratings foreach (RepeaterItem a in Categories.Items) { int pReviewID = Int32.Parse(Request.QueryString["SRI"].ToString()); int pCategoryID = Int32.Parse((a.FindControl("CatID") as HiddenField).Value); TextBox RatingTxt = (a.FindControl("RatingsTxt") as TextBox); TextBox CommentsTxt = (a.FindControl("CommentsTxt") as TextBox); Double pRating = 0 ; if(RatingTxt.Text.Length > 0 ) pRating = (Double.Parse(RatingTxt.Text)); String pComments = CommentsTxt.Text; // DO IT VIA ADD REVIEW bitch Result.Add(new ERS.ReviewInfo() { CategoryID = pCategoryID, Comments = pComments, Rating = (decimal)pRating, ReviewId = rev.GetAReviewID(pReviewID) }); } int ReviewID = Int32.Parse(Request.QueryString["SRI"].ToString()); bool isLMOfReview = rev.isLMOfReview(Int32.Parse(Session["UserID"].ToString()), ReviewID); // Saving LM's if (Session["isLM"].Equals(true) && isLMOfReview) { int lReviewID = Int32.Parse(Request.QueryString["SRI"].ToString()); int lCategoryID = rev.GetCategoryID("LineManager"); Double lRating = Double.Parse(LMRatingsTxt.Text); String lComments = LMCommentsTxt.Text; // THe statement Below should be done by rev.AddReviewInfo Result.Add(new ERS.ReviewInfo() { CategoryID = lCategoryID, Comments = lComments, Rating = (decimal)lRating, ReviewId = rev.GetAReviewID(lReviewID) }); } rev.FillReviews(Int32.Parse(Request.QueryString["SRI"].ToString()), Result, "Drafted"); Response.Redirect(ViewState["PreviousPageUrl"].ToString()); }
protected void Reject_Click(object sender, EventArgs e) { Reviews rev = new Reviews(); int ReviewID = Int32.Parse(Request.QueryString["SRI"].ToString()); rev.RejectReview(ReviewID, FeedbackTxt.Text.ToString(), Int32.Parse(Session["UserID"].ToString())); Response.Redirect(ViewState["PreviousPageUrl"].ToString()); }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); if (Session["UserId"] == null) Response.Redirect("Default.aspx"); if (!IsPostBack) { ViewState["PreviousPageUrl"] = Request.UrlReferrer.ToString(); int DirectorID; if (Session["UserId"] != null) DirectorID = Int32.Parse(Session["UserId"].ToString()); else Response.Redirect("Default.aspx"); // Check if this person is valid int LMID = Int32.Parse(Request.QueryString["LMID"]); ERS.BAL.Director Dir = new ERS.BAL.Director(); ERS.BAL.Reviews rev = new ERS.BAL.Reviews(); List<ERS.ReviewCategory> Source = rev.GetAllCategories(); Categories.DataSource = Source; Categories.DataBind(); LineManagees.DataSource = Dir.GetManagees(LMID); ; LineManagees.DataTextField = "Name"; LineManagees.DataValueField = "EmpID"; LineManagees.DataBind(); if (ViewState["SelCatID"] == null) ViewState["SelCatID"] = Source.First().CategoryID; System.Web.UI.HtmlControls.HtmlGenericControl LI2 = (System.Web.UI.HtmlControls.HtmlGenericControl)Categories.Items[0].FindControl("CatLI"); LI2.Attributes["class"] = "active"; AllReviews.DataSource = rev.GetAllReviewsOf_Peer_GivenCategory(Int32.Parse(LineManagees.SelectedValue), Int32.Parse(ViewState["SelCatID"].ToString())); ; AllReviews.DataBind(); LMName.InnerHtml = LineManagees.SelectedItem.ToString(); int lCategoryID = rev.GetCategoryID("Director"); int LMIDWhoisOn = Int32.Parse(Request.QueryString["LMID"]); int EmpID = Int32.Parse(LineManagees.SelectedValue); DirectorID = Int32.Parse(Session["UserId"].ToString()); int ReviewID = rev.GetReviewID(LMIDWhoisOn, DirectorID, EmpID); if (ReviewID != -1) { ERS.ReviewInfo RevInfo = rev.GetReviewInfo(ReviewID, lCategoryID); if (RevInfo != null) { CommentsTxt.Text = RevInfo.Comments; RatingsTxt.Text = RevInfo.Rating.ToString(); } } } }
protected void Save_Click(object sender, EventArgs e) { ERS.BAL.Reviews rev = new ERS.BAL.Reviews(); int LMIDWhoisOn = Int32.Parse(Request.QueryString["LMID"]); int EmpID = Int32.Parse(LineManagees.SelectedValue); int DirectorID = Int32.Parse(Session["UserId"].ToString()); // Creating Review For CrossLevel ( THere must be a seperat fun calling addReview in BAL ) int ReviewID = rev.AddReview(EmpID, LMIDWhoisOn , DirectorID , "Directors Feedback" , "Crosslevel"); int lCategoryID = rev.GetCategoryID("Director"); Double lRating = Double.Parse(RatingsTxt.Text); String lComments = CommentsTxt.Text; // THe statement Below should be done by rev.AddReviewInfo rev.InsertReviewInfo( lCategoryID, lComments, (decimal)lRating, ReviewID ); AllReviews.DataSource = rev.GetAllReviewsOf_Peer_GivenCategory(Int32.Parse(LineManagees.SelectedValue), Int32.Parse(ViewState["SelCatID"].ToString())); ; AllReviews.DataBind(); }
protected void Reject_Click(object sender, EventArgs e) { Reviews rev = new Reviews(); int LMIDWhoisOn = Int32.Parse(Request.QueryString["LMID"]); int EmpID = Int32.Parse(LineManagees.SelectedValue); int ReviewID = rev.GetLatestReviewID(LMIDWhoisOn, EmpID); rev.RejectReview(ReviewID, FeedbackTxt.Text.ToString(), Int32.Parse(Session["UserID"].ToString())); Response.Redirect(ViewState["PreviousPageUrl"].ToString()); // to reject // Copy Old Column of AReviewID to New Review's AReviewID // Increment Version }