public string GetAndEditPrevTimesheet(ClientContext clientContext, TIM_EmployeeTimesheetModel item) { string result = "ERROR"; int count = 0; List <TIM_EmployeeTimesheetModel> lstPrevtimesheet = BalEmpTimesheet.AlterPrevEmpTimesheet(clientContext, item); if (lstPrevtimesheet.Count > 0) { foreach (var data in lstPrevtimesheet) { string NewUtilized = GetTimeDiffForUtilizedHours(data.UtilizedHours, item.AlterUtilizeHour); string NewRemaining = GetTimeDiffForRemainingHours(data.RemainingHours, item.AlterUtilizeHour); string itemdata = " 'UtilizedHours': '" + NewUtilized + "'"; itemdata += " ,'RemainingHours': '" + NewRemaining + "'"; string returnID = BalEmpTimesheet.UpdateTimesheet(clientContext, itemdata, data.ID.ToString()); if (returnID == "Update") { count++; } } if (lstPrevtimesheet.Count == count) { result = "OK"; } } else { result = "OK"; } return(result); }
public string TimesheetCreationNotification(ClientContext clientContext, TIM_EmployeeTimesheetModel item, GEN_ApproverRoleNameModel Manager, Emp_BasicInfoModel Employee) { string returnID = ""; try { string AddedDate = DateTime.ParseExact(item.TimesheetAddedDate, "MM-dd-yyyy hh:mm:ss", CultureInfo.InvariantCulture).ToString("dd-MM-yyyy", CultureInfo.InvariantCulture); string InternalStatus = "Inprogress"; string Subject = "Timesheet Creation Notification"; string MainBody = "<table style='width: 100%; border: 1px solid black'><tbody><tr><th>Timesheet ID</th><td>:</td><td>" + item.TimesheetID + "</td></tr><tr><th>Date</th><td>:</td><td>" + AddedDate + "</td></tr><tr><th>Manager</th><td>:</td><td>" + Manager.FullName + "</td></tr><tr><th>Employee</th><td>:</td><td>" + Employee.FullName + "</td></tr><tr><th>Status</th><td>:</td><td>" + InternalStatus + "</td></tr></tbody></table>"; string Body = "Dear Member,<br /><br />The following new timesheet has been created by you.<br /><br />"; string ItemData = "'To': '" + Employee.OfficeEmail + "'"; ItemData += " ,'Subject': '" + Subject + "'"; ItemData += " ,'Body': '" + Body + getDescriptionFormatted(MainBody) + "'"; returnID = BalEmail.SaveMail(clientContext, ItemData); if (Convert.ToInt32(returnID) > 0) { string NewBody = "<div>Dear Member,<br /><br />The following timesheet has been created by " + Employee.FullName + " and awaiting for your approval. <br /><br />"; string ItemDataNew = "'To': '" + Manager.Email + "'"; ItemDataNew += " ,'Subject': '" + Subject + "'"; ItemDataNew += " ,'Body': '" + NewBody + getDescriptionFormatted(MainBody) + "'"; returnID = BalEmail.SaveMail(clientContext, ItemDataNew); } } catch { } return(returnID); }
public void UpdateAllStatus(string taskdata, TIM_EmployeeTimesheetModel item, List <TIM_WorkFlowMasterModel> lstWorkFlowForApproveTimesheet) { var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext); using (var clientContext = spContext.CreateUserClientContextForSPHost()) { List <TIM_TaskModel> lstTask = new List <TIM_TaskModel>(); lstTask = BalTask.GetTaskByMilestoneId(clientContext, item.MileStone); if (lstTask.Count == 0) { string MilestoneUpdate = BalMilestone.UpdateMilestone(clientContext, taskdata, item.MileStone.ToString()); if (MilestoneUpdate == "Update") { List <TIM_MilestoneModel> lstMilestone = new List <TIM_MilestoneModel>(); lstMilestone = BalMilestone.GetMilestoneByProjectId(clientContext, item.Project); if (lstMilestone.Count == 0) { string ProjectUpdate = BalMilestone.UpdateMilestone(clientContext, taskdata, item.Project.ToString()); } } } } }
public void UploadTimesheetDoc(ClientContext clientContext, HttpFileCollectionBase files, TIM_EmployeeTimesheetModel item, string returnID) { try { string Type = "TimesheetCreation"; for (int j = 0; j < files.Count; j++) { var DocName = files[j].FileName.Split('_')[0]; if (item.FileCount == DocName) { var postedFile = files[j]; string Docitem = "'LID' : '" + returnID + "'"; Docitem += ",'TimesheetID' : '" + item.TimesheetID + "'"; Docitem += ",'DocumentType' : '" + Type + "'"; Docitem += ",'DocumentPath' : '" + files[j].FileName.Substring(DocName.Length + 1) + "'"; int res = BalProjectCreation.UploadDocument(clientContext, postedFile, Docitem); } } } catch (Exception ex) { } }
public string TimesheetApproveAndRejectNotification(ClientContext clientContext, TIM_EmployeeTimesheetModel item, string Action) { string returnID = ""; try { string Subject = "Timesheet Creation Notification"; string MainBody = "<table style='width: 100%; border: 1px solid black'><tbody><tr><th>Timesheet ID</th><td>:</td><td>" + item.TimesheetID + "</td></tr><tr><th>Date</th><td>:</td><td>" + item.TimesheetAddedDate + "</td></tr><tr><th>Manager</th><td>:</td><td>" + item.ManagerName + "</td></tr><tr><th>Employee</th><td>:</td><td>" + item.EmployeeName + "</td></tr><tr><th>Status</th><td>:</td><td>" + Action + "</td></tr></tbody></table>"; string Body = "Dear Member,<br /><br />The following timesheet has been " + Action + " by you.<br /><br />"; string ItemData = "'To': '" + item.ManagerEmail + "'"; ItemData += " ,'Subject': '" + Subject + "'"; ItemData += " ,'Body': '" + Body + getDescriptionFormatted(MainBody) + "'"; returnID = BalEmail.SaveMail(clientContext, ItemData); if (Convert.ToInt32(returnID) > 0) { string NewBody = "<div>Dear Member,<br /><br />Your created timesheet has been " + Action + " by " + item.ManagerName + ". Please find details below.<br /><br />"; string ItemDataNew = "'To': '" + item.EmployeeEmail + "'"; ItemDataNew += " ,'Subject': '" + Subject + "'"; ItemDataNew += " ,'Body': '" + NewBody + getDescriptionFormatted(MainBody) + "'"; returnID = BalEmail.SaveMail(clientContext, ItemDataNew); } } catch { } return(returnID); }