/// <summary> /// Get billing value /// </summary> private int GetBillingValue(int RPDurationId) { int billing = 0; BusinessEntities.ResourcePlan objBERPDurationDetail = new BusinessEntities.ResourcePlan(); objBERPDurationDetail.ResourcePlanDurationId = RPDurationId; objBERPDurationDetail.Mode = "EDIT"; objBERPDurationDetail.RPDEdited = false; //--false -RP details edited which is not commited objBERPDurationDetail.RPDDeletedStatusId = Convert.ToInt32(MasterEnum.RPDetailEditionStatus.Deleted); Rave.HR.BusinessLayer.Projects.ResourcePlan objBLLRPDurationDetail = new Rave.HR.BusinessLayer.Projects.ResourcePlan(); RaveHRCollection objListRPDurationDetail = new RaveHRCollection(); objListRPDurationDetail = objBLLRPDurationDetail.GetRPDurationDetail(objBERPDurationDetail); //loops through objListRPDurationDetail collection object to get billing value foreach (BusinessEntities.ResourcePlan ObjRP in objListRPDurationDetail) { if (billing != 0) { billing = billing + Convert.ToInt32(ObjRP.Billing); } else { billing = Convert.ToInt32(ObjRP.Billing); } } return(billing); }
/// <summary> /// Repeater Item Bound /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void rptData_ItemDataBound(object sender, RepeaterItemEventArgs e) { try { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { BusinessEntities.ResourcePlan objBERPDurationDetail = new BusinessEntities.ResourcePlan(); objBERPDurationDetail.ResourcePlanDurationId = Convert.ToInt32(((BusinessEntities.ResourcePlan)e.Item.DataItem).ResourcePlanDurationId); objBERPDurationDetail.Mode = "EDIT"; objBERPDurationDetail.RPDEdited = false; //--false -RP details edited which is not commited objBERPDurationDetail.RPDDeletedStatusId = Convert.ToInt32(MasterEnum.RPDetailEditionStatus.Deleted); Rave.HR.BusinessLayer.Projects.ResourcePlan objBLLRPDurationDetail = new Rave.HR.BusinessLayer.Projects.ResourcePlan(); RaveHRCollection objListRPDurationDetail = new RaveHRCollection(); objListRPDurationDetail = objBLLRPDurationDetail.GetRPDurationDetail(objBERPDurationDetail); ((HiddenField)e.Item.FindControl("hfRPDetailId")).Value = ((ResourcePlan)objListRPDurationDetail.Item(0)).RPDId.ToString(); ((HiddenField)e.Item.FindControl("hfUtilization")).Value = ((ResourcePlan)objListRPDurationDetail.Item(0)).Utilization.ToString(); ((HiddenField)e.Item.FindControl("hfBilling")).Value = ((ResourcePlan)objListRPDurationDetail.Item(0)).Billing.ToString(); ((HiddenField)e.Item.FindControl("hfResourceLocation")).Value = ((ResourcePlan)objListRPDurationDetail.Item(0)).ResourceLocation.ToString(); ((HiddenField)e.Item.FindControl("hfProjectLocation")).Value = ((ResourcePlan)objListRPDurationDetail.Item(0)).ProjectLocation.ToString(); } } catch (RaveHRException ex) { LogErrorMessage(ex); } catch (Exception ex) { RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME_RP, "rptData_ItemDataBound", EventIDConstants.RAVE_HR_MRF_PRESENTATION_LAYER); LogErrorMessage(objEx); } }
/// <summary> /// Returns Resource Plan data for GridView /// </summary> /// <returns>List</returns> private RaveHRCollection GetResourcePlanList(string direction) { RaveHRCollection objListGetResourcePlan = null; try { //--Fill entiry BusinessEntities.ResourcePlan objBEResourcePlan = new BusinessEntities.ResourcePlan(); objBEResourcePlan.RPId = Convert.ToInt32(Request.QueryString["rid"].ToString()); objBEResourcePlan.RPDuDeletedStatusId = Convert.ToInt32(MasterEnum.RPDurationEditionStatus.Deleted); objBEResourcePlan.RPDDeletedStatusId = Convert.ToInt32(MasterEnum.RPDetailEditionStatus.Deleted); objBEResourcePlan.PageSize = PAGE_SIZE; objBEResourcePlan.PageNumber = 1; //--Sort Expression objBEResourcePlan.SortExpression = sortExpression; objBEResourcePlan.SortDirection = direction; //--Get data Rave.HR.BusinessLayer.Projects.ResourcePlan objBLLGetResourcePlan = new Rave.HR.BusinessLayer.Projects.ResourcePlan(); objListGetResourcePlan = new RaveHRCollection(); objListGetResourcePlan = objBLLGetResourcePlan.GetResourcePlanById(objBEResourcePlan, ref pageCount); //--Get pagecount in viewstate Session[SessionNames.PageCount] = pageCount; } //catches RaveHRException exception catch (RaveHRException ex) { throw ex; } catch (Exception ex) { throw new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME_RP, "GetResourcePlanList", EventIDConstants.RAVE_HR_RP_PRESENTATION_LAYER); } //-- return(objListGetResourcePlan); }
/// <summary> /// BulkUpdate button click event handler. /// </summary> protected void btnUpdate_Click(object sender, EventArgs e) { try { if (ucDatePickerEndDate.Text == "") { lblMessage.Text = dateValidation; lblMessage.Style["color"] = "red"; return; } //--StartDate & EndDate should be within project start and enddate DateTime dtProjectStartDate, dtProjectEndDate; BusinessEntities.ResourcePlan objBEResourcePlan = new BusinessEntities.ResourcePlan(); Rave.HR.BusinessLayer.Projects.ResourcePlan objBLLResourcePlan = new Rave.HR.BusinessLayer.Projects.ResourcePlan(); objBEResourcePlan.ProjectId = Convert.ToInt32(Request.QueryString["pid"].ToString()); objBEResourcePlan = objBLLResourcePlan.GetProjectDetails(objBEResourcePlan); dtProjectStartDate = objBEResourcePlan.StartDate; dtProjectEndDate = objBEResourcePlan.EndDate; if ((DateTime.Parse(ucDatePickerEndDate.Text) > dtProjectEndDate) || (DateTime.Parse(ucDatePickerEndDate.Text) < dtProjectStartDate)) { lblMessage.Text = dateErrorMsg + " i.e between " + dtProjectStartDate.ToString(CommonConstants.DATE_FORMAT) + " & " + dtProjectEndDate.ToString(CommonConstants.DATE_FORMAT); lblMessage.Style["color"] = "red"; return; } DateTimeFormatInfo dtFormat = new DateTimeFormatInfo(); dtFormat.ShortDatePattern = "dd/MM/yyyy"; dtFormat.DateSeparator = "/"; for (int i = 0; i < rptData.Items.Count; i++) { if (((CheckBox)rptData.Items[i].FindControl("chkSelect")).Checked) { objBEResourcePlan = new BusinessEntities.ResourcePlan(); objBEResourcePlan.RPDId = Convert.ToInt32(((HiddenField)rptData.Items[i].FindControl("hfRPDetailId")).Value); objBEResourcePlan.Utilization = Convert.ToInt32(((HiddenField)rptData.Items[i].FindControl("hfUtilization")).Value); objBEResourcePlan.Billing = Convert.ToInt32(((HiddenField)rptData.Items[i].FindControl("hfBilling")).Value); objBEResourcePlan.ResourceLocation = ddlLocation.Items.FindByText(((HiddenField)rptData.Items[i].FindControl("hfResourceLocation")).Value).Value; objBEResourcePlan.ResourceStartDate = Convert.ToDateTime(((Label)rptData.Items[i].FindControl("lblStartDate")).Text, dtFormat); objBEResourcePlan.ResourceEndDate = DateTime.Parse(ucDatePickerEndDate.Text); objBEResourcePlan.ProjectLocation = ddlProjectLocation.Items.FindByText(((HiddenField)rptData.Items[i].FindControl("hfProjectLocation")).Value).Value; objBEResourcePlan.RPEdited = false; //--false -RP not Edited --true -RP Edited objBLLResourcePlan = new Rave.HR.BusinessLayer.Projects.ResourcePlan(); //--Update record //objBLLResourcePlan.UpdateRPDetailByID(objBEResourcePlan, "UPDATE"); objBLLResourcePlan.EditRPDetailByID(objBEResourcePlan); } } //Umesh: Issue 'Modal Popup issue in chrome' Starts ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "CloseJS", "jQuery.modalDialog.getCurrent().close();", true); //Umesh: Issue 'Modal Popup issue in chrome' Ends } //catches RaveHRException exception catch (RaveHRException ex) { LogErrorMessage(ex); } catch (Exception ex) { RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME_RP, "btnUpdate_Click", EventIDConstants.RAVE_HR_RP_PRESENTATION_LAYER); LogErrorMessage(objEx); } }