public bool DeleteMetting(int Meeting_id) { LogFileModule logFileModule = new LogFileModule(); String LogData = ""; db.Configuration.LazyLoadingEnabled = false; try { var M_Topic = db.M_Topic.Where(x => x.Meeting_Id == Meeting_id).ToList(); if (M_Topic.Count == 0) { var widgets = db.M_M_Attachments.Where(x => x.Meeting_Id == Meeting_id).ToList(); if (widgets.Count > 0) { foreach (M_M_Attachments widget in widgets) { db.M_M_Attachments.Remove(widget); } } db.SaveChanges(); var DelMeeting = db.M_Meeting.First(x => x.Meeting_Id == Meeting_id); db.M_Meeting.Remove(DelMeeting); db.SaveChanges(); /* Add it to log file */ LogData = "data:" + JsonConvert.SerializeObject(DelMeeting, logFileModule.settings); logFileModule.logfile(10, "حذف الإجتماع", "Delete Meeting", LogData); } } catch (Exception e) { return(false); } return(true); }
private bool saveChangeEmployee() { if (validationForm()) { try { //////////////////////// add New Employee Structure ///////////////////////////////// db.Configuration.LazyLoadingEnabled = false; var ChangeEmployeeStructure = db.Employee_Structure.Create(); int employeeSturctureFormId = int.Parse(employeeSturctureFrom.SelectedValue); var currentEmployeeStructure = db.Employee_Structure.First(x => x.Employee_Structure_Id == employeeSturctureFormId); ChangeEmployeeStructure.Structure_Id = currentEmployeeStructure.Structure_Id; ChangeEmployeeStructure.Employee_Id = int.Parse(employeeTo.SelectedValue); ChangeEmployeeStructure.Status_Structure = true; ChangeEmployeeStructure.Default_Structure = false; ChangeEmployeeStructure.Type_Delegation = false; db.Employee_Structure.Add(ChangeEmployeeStructure); db.SaveChanges(); LogData = "data:" + JsonConvert.SerializeObject(ChangeEmployeeStructure, logFileModule.settings); logFileModule.logfile(1009, "تغيير المسمي الموظيفي", "Change Job Title", LogData); //////////////////////// Change Currnet Structure to New Employee ///////////////////////////////// int newEmployeeSturctureId = ChangeEmployeeStructure.Employee_Structure_Id; currentEmployeeStructure.Employee_Delegation = newEmployeeSturctureId; currentEmployeeStructure.Status_Structure = false; db.Entry(currentEmployeeStructure).State = EntityState.Modified; db.SaveChanges(); LogData = "data:" + JsonConvert.SerializeObject(currentEmployeeStructure, logFileModule.settings); logFileModule.logfile(1009, "تغيير المسمي الموظيفي", "Change Job Title", LogData); //////////////////////// Change Old Structure To New Employee ///////////////////////////////// var changelistEmpStur = db.Employee_Structure.Where(x => x.Employee_Delegation == employeeSturctureFormId).ToList(); foreach (Employee_Structure oneEmployeeSturcture in changelistEmpStur) { oneEmployeeSturcture.Employee_Delegation = newEmployeeSturctureId; db.Entry(oneEmployeeSturcture).State = EntityState.Modified; } db.SaveChanges(); var changelistEmpStur1 = db.Employee_Structure.Where(x => x.Employee_Delegation == newEmployeeSturctureId).ToList(); LogData = "data:" + JsonConvert.SerializeObject(changelistEmpStur1, logFileModule.settings); logFileModule.logfile(1009, "تغيير المسمي الموظيفي", "Change Job Title", LogData); } catch (Exception exceptionLog) { string exceptionStackTrace = exceptionLog.StackTrace; string exceptionGetType = exceptionLog.GetType().ToString(); string exceptionMessage = exceptionLog.Message; string exceptionData = "data:{\"StackTrace\":\"" + exceptionStackTrace + "\",\"GetType\":\"" + exceptionGetType + "\",\"Message\":\"" + exceptionMessage + "\"}"; logFileModule.logfile(1025, "حدث خطأ في حفظ تغيير المسمي الوظيفي", "An error occurred in saving the Job Title", exceptionData); messageForm = "Erorr to save data in system"; return(false); } return(true); } else { return(false); } }
public bool SaveMeeting(int Meeting_Id, int Board_Id, string Meeting_Name_Ar, string Meeting_Name_En, DateTime Meeting_Date, DateTime Meeting_Time, int Meeting_Status_Id, string Meeting_Minutes, int Board_Location_Id, FileUpload M_Attachments) { try { db.Configuration.LazyLoadingEnabled = false; M_Meeting Meeting = db.M_Meeting.Create(); if (Meeting_Id != 0) { Meeting = db.M_Meeting.First(x => x.Meeting_Id == Meeting_Id); } Meeting.Board_Id = Board_Id; Meeting.Meeting_Name_Ar = Meeting_Name_Ar; Meeting.Meeting_Name_En = Meeting_Name_En; Meeting.Meeting_Date = Meeting_Date; Meeting.Meeting_Time = Meeting_Time.TimeOfDay; Meeting.Meeting_Status = Meeting_Status_Id; Meeting.Meeting_Minutes = Meeting_Minutes; Meeting.Board_Location_Id = Board_Location_Id; if (Meeting_Id != 0) { db.Entry(Meeting).State = System.Data.EntityState.Modified; } else { Meeting.Create_Date = DateTime.Parse(CDate.Text); db.M_Meeting.Add(Meeting); } db.SaveChanges(); if (Meeting_Id != 0) { MeetingID = Meeting_Id; } else { MeetingID = Meeting.Meeting_Id; } AttachmentFile(MeetingID, M_Attachments, @"~\Pages\Eminutes\media\M_Attachments\"); /* Add it to log file */ LogData = "data:" + JsonConvert.SerializeObject(Meeting, logFileModule.settings); if (Meeting_Id != 0) { logFileModule.logfile(10, "تعديل بيانات إجتماع", "update Meeting", LogData); } else { logFileModule.logfile(10, "إضافة إجتماع", "Add Meeting", LogData); } } catch { return(false); } return(true); }
private bool saveEmployeeDelegation() { if (validationForm()) { try { db.Configuration.LazyLoadingEnabled = false; var delegationEmployeeStructure = db.Employee_Structure.Create(); var currentEmployeeStructure = db.Employee_Structure.First(x => x.Employee_Structure_Id == currentStructureUserId); delegationEmployeeStructure.Structure_Id = currentEmployeeStructure.Structure_Id; delegationEmployeeStructure.Employee_Id = int.Parse(employeeDelegation.SelectedValue); delegationEmployeeStructure.Status_Structure = true; delegationEmployeeStructure.Default_Structure = false; delegationEmployeeStructure.Type_Delegation = true; delegationEmployeeStructure.Date_Delegation = DateTime.Now; delegationEmployeeStructure.Employee_Delegation = currentStructureUserId; db.Employee_Structure.Add(delegationEmployeeStructure); db.SaveChanges(); LogData = "data:" + JsonConvert.SerializeObject(delegationEmployeeStructure, logFileModule.settings); logFileModule.logfile(1009, "تفويض معاملات", "Delegation transaction", LogData); currentEmployeeStructure.Employee_Delegation = delegationEmployeeStructure.Employee_Structure_Id; currentEmployeeStructure.Type_Delegation = false; currentEmployeeStructure.Date_Delegation = DateTime.Now; db.Entry(currentEmployeeStructure).State = EntityState.Modified; db.SaveChanges(); LogData = "data:" + JsonConvert.SerializeObject(currentEmployeeStructure, logFileModule.settings); logFileModule.logfile(1009, "تفويض معاملات", "Delegation transaction", LogData); } catch (Exception exceptionLog) { string exceptionStackTrace = exceptionLog.StackTrace; string exceptionGetType = exceptionLog.GetType().ToString(); string exceptionMessage = exceptionLog.Message; string exceptionData = "data:{\"StackTrace\":\"" + exceptionStackTrace + "\",\"GetType\":\"" + exceptionGetType + "\",\"Message\":\"" + exceptionMessage + "\"}"; logFileModule.logfile(1025, "حدث خطأ في حفظ التفويض", "An error occurred in saving the Delegation", exceptionData); if (SessionWrapper.LoggedUser.Language_id == 1) { messageForm = "حدث خطأ في حفظ البيانات في النظام"; } else { messageForm = "Erorr to save data in system"; } return(false); } return(true); } else { return(false); } }
public bool AU_Emplooyees(int EmployeeID, string Email, string Phone, int lang, int calander) { try { db.Configuration.LazyLoadingEnabled = false; Employee Emp = db.Employees.First(x => x.Employee_Id == EmployeeID); Emp.Employee_Email = Email; Emp.Employee_Phone = Phone; Emp.Language_id = lang; Emp.Calendar_id = calander; string ImagepathProfile = UploadFile(1); string ImagepathSignature = UploadFile(2); if (ImagepathProfile != "") { Emp.Employee_Profile = ImagepathProfile; } if (ImagepathSignature != "") { Emp.Employee_Signature = ImagepathSignature; } //----------------------------Employee Structure------------------------------------------- var Emp_Stru = db.Employee_Structure.Where(x => x.Employee_Id == EmployeeID).ToList(); for (int i = 0; i < Emp_Stru.Count; i++) { int E_S = 0; int.TryParse(Emp_Stru[i].Structure_Id.ToString(), out E_S); Employee_Structure stu = db.Employee_Structure.First(x => x.Employee_Id == EmployeeID && x.Structure_Id == E_S); if (E_S.ToString() == DefaultStructure.SelectedValue) { stu.Default_Structure = true; } else { stu.Default_Structure = false; } Emp.Employee_Structure.Add(stu); } //----------------------------End Employee Structure------------------------------------------- db.Entry(Emp).State = System.Data.EntityState.Modified; db.SaveChanges(); /* Add it to log file */ LogData = "data:" + JsonConvert.SerializeObject(Emp, logFileModule.settings); logFileModule.logfile(10, "تعديل بيانات الموظف", "Update Employee Info", LogData); SessionWrapper.LoggedUser = Emp; SessionWrapper.Language = db.Lanuage_Detials.Where(x => x.Language_Master_ID == lang).ToList(); } catch { return(false); } return(true); }
private bool AddGroup(string arabic_name, string english_name) { try { Group group = db.Groups.Create(); group.Group_Name_Ar = arabic_name; group.Group_Name_En = english_name; db.Groups.Add(group); db.SaveChanges(); //PriorityDataSource.DataBind(); } catch { return(false); } return(true); }
private bool AddPermission(string arabic_name, string english_name, int parent_id, string url, string icon) { try { db.Configuration.LazyLoadingEnabled = false; Permission Per = db.Permissions.Create(); Per.Permission_Name_Ar = arabic_name; Per.Permission_Name_En = english_name; Per.Parent = parent_id; Per.Url_Path = url; Per.Permission_Icon = icon; Per.System_Id = int.Parse(txtSystem.SelectedValue.ToString()); db.Permissions.Add(Per); db.SaveChanges(); /* Add it to log file */ LogData = "data:" + JsonConvert.SerializeObject(Per, logFileModule.settings); logFileModule.logfile(10, "إضافة صلاحية جديدة", "add new permission", LogData); Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "HideTheModel(); notify('top', 'right', 'fa fa-check', 'success', 'animated fadeInRight', 'animated fadeOutRight',' Save Status : ',' The Permission add successfully ! ');", true); //PriorityDataSource.DataBind(); } catch { Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "notify('top', 'right', 'fa fa-delete', 'danger', 'animated fadeInRight', 'animated fadeOutRight',' Save Status : ','System Error');", true); return(false); } return(true); }
public static string DeleteEmplooye(int Employee_Id) { string returnDeleteEmp = "0"; LogFileModule logFileModule = new LogFileModule(); String LogData = ""; try { ECMSEntities db = new ECMSEntities(); var widgets = db.Employee_Structure.Where(x => x.Employee_Id == Employee_Id).ToList(); if (widgets.Count > 0) { foreach (Employee_Structure widget in widgets) { db.Employee_Structure.Remove(widget); } } var DelEmp = db.Employees.First(x => x.Employee_Id == Employee_Id); db.Employees.Remove(DelEmp); db.SaveChanges(); returnDeleteEmp = "1"; /* Add it to log file */ LogData = "data:" + JsonConvert.SerializeObject(DelEmp, logFileModule.settings); logFileModule.logfile(10, "حذف الموظف", "Delete Employee", LogData); } catch (Exception e) { } return(JsonConvert.SerializeObject(returnDeleteEmp)); }
public bool UpateMetting(int Meeting_id) { LogFileModule logFileModule = new LogFileModule(); String LogData = ""; db.Configuration.LazyLoadingEnabled = false; try { var Meeting = db.M_Meeting.First(x => x.Meeting_Id == Meeting_id); if (Meeting.Meeting_Status == 1) { Meeting.Meeting_Status = 2; } else if (Meeting.Meeting_Status == 2) { Meeting.Meeting_Status = 3; } else if (Meeting.Meeting_Status == 3) { Meeting.Meeting_Status = 1; } db.Entry(Meeting).State = System.Data.EntityState.Modified; db.SaveChanges(); /* Add it to log file */ LogData = "data:" + JsonConvert.SerializeObject(Meeting, logFileModule.settings); logFileModule.logfile(10, "تعيل حالة الإجتماع", "Update Meeting Stats", LogData); } catch (Exception e) { return(false); } return(true); }
public bool UpdateTopic(int Topic_id) { LogFileModule logFileModule = new LogFileModule(); String LogData = ""; db.Configuration.LazyLoadingEnabled = false; try { var Topic = db.M_Topic.First(x => x.Topic_Id == Topic_id); if (Topic.Topic_Status == 1) { Topic.Topic_Status = 2; } else if (Topic.Topic_Status == 2) { Topic.Topic_Status = 1; } db.Entry(Topic).State = System.Data.EntityState.Modified; db.SaveChanges(); /* Add it to log file */ LogData = "data:" + JsonConvert.SerializeObject(Topic, logFileModule.settings); logFileModule.logfile(10, "تعديل حالة الموضوع", "Update Topic stats", LogData); } catch (Exception e) { return(false); } return(true); }
public bool UpdateBoardStatus(int board_id, int type_process) { try { db.Configuration.LazyLoadingEnabled = false; M_Board board = db.M_Board.Find(board_id); if (board == null) { return(false); } board.Board_Status_Id = type_process; db.Entry(board).State = System.Data.EntityState.Modified; db.SaveChanges(); return(true); /*Add it to log file */ LogData = "data:" + JsonConvert.SerializeObject(board, logFileModule.settings); logFileModule.logfile(10, "تغير حالة المجلس/اللجنة", "Update the board", LogData); }catch (Exception er) { /*Add it to log file */ LogData = "data:" + JsonConvert.SerializeObject(er, logFileModule.settings); logFileModule.logfile(10, "حدث خطاء في النظام", "An Exception has occurred", LogData); return(false); } }
public void logfile(int controlId, string logName, string logDescription, String noteData) { try { using (var dbLog = new ECMSEntities()) { Log_File logFileInsert = dbLog.Log_File.Create(); logFileInsert.Log_Date = DateTime.Now; if (controlId != 0) { if (SessionWrapper.LoggedUser != null) { logFileInsert.Login_Id = SessionWrapper.LoggedUser.Employee_Id; } else { logFileInsert.Login_Id = 1; } logFileInsert.Form_Id = currentPage(); } logFileInsert.Log_Name = logName; logFileInsert.Log_Description = logDescription; logFileInsert.Log_Note = noteData; dbLog.Log_File.Add(logFileInsert); dbLog.SaveChanges(); } }catch (Exception er) { } }
protected void Save_Click(object sender, EventArgs e) { try { string message = ""; int board_id = int.Parse(Request["BoardId"]); int EmployeeId = int.Parse(txtEmployees.SelectedValue); // check if member exist M_Board_Member IsMemberExisted = db.M_Board_Member.FirstOrDefault(x => x.Board_Id == board_id && x.Employee_Id == EmployeeId); if (IsMemberExisted == null) { // Create new member M_Board_Member member = db.M_Board_Member.Create(); member.Board_Id = board_id; member.Employee_Id = EmployeeId; member.Member_Type_Id = int.Parse(txtType.SelectedValue); db.M_Board_Member.Add(member); message = "Member Added successfully.."; if (SessionWrapper.LoggedUser.Language_id == 1) { message = "تم اضافة عضو بنجاح"; } } else { // Update exist member M_Board_Member member = db.M_Board_Member.Find(IsMemberExisted.Board_Member_Id); member.Board_Id = board_id; member.Employee_Id = EmployeeId; member.Member_Type_Id = int.Parse(txtType.SelectedValue); member.Board_Member_Id = IsMemberExisted.Board_Member_Id; db.Entry(member).State = System.Data.EntityState.Modified; message = "Member updated successfully.."; if (SessionWrapper.LoggedUser.Language_id == 1) { message = "تم تحديث صلاحية عضو بنجاح"; } } db.SaveChanges(); LtrMessage.Text = "<div class='alert alert-success' role='alert'>" + message + "</div>"; // Reload data List <M_Board_Member> ListMember = db.M_Board_Member.Where(x => x.Board_Id == board_id).ToList(); fillDropDown(); LoadMember(ListMember, board_id); } catch { string messages = "System Error..."; if (SessionWrapper.LoggedUser.Language_id == 1) { messages = "حدث خطاء في النظام..."; } LtrMessage.Text = "<div class='alert alert-danger' role='alert'>" + messages + "</div>"; } }
private bool AddGroup(string arabic_name, string english_name) { try { db.Configuration.LazyLoadingEnabled = false; Group group = db.Groups.Create(); group.Group_Name_Ar = arabic_name; group.Group_Name_En = english_name; db.Groups.Add(group); db.SaveChanges(); /* Add it to log file */ LogData = "data:" + JsonConvert.SerializeObject(group, logFileModule.settings); logFileModule.logfile(10, "إنشاء مجموعة جديدة", "create new group", LogData); //PriorityDataSource.DataBind(); } catch { return(false); } return(true); }
public bool SaveTopic(int Topic_Id, int Meeting_Id, string Topic_Name_Ar, string Topic_Name_En, int Topic_Status_Id, int Structure_Id, string Arabic_Description, string English_Description, string Arabic_Recommendation, string English_Recommendation, string Arabic_RecommendationDoc, string English_RecommendationDoc) { try { db.Configuration.LazyLoadingEnabled = false; M_Topic Topic = db.M_Topic.Create(); if (Topic_Id != 0) { Topic = db.M_Topic.First(x => x.Topic_Id == Topic_Id); } Topic.Meeting_Id = Meeting_Id; Topic.Topic_Status = Topic_Status_Id; if (Structure_Id > 0) { Topic.Structure_Id = Structure_Id; } else { Topic.Structure_Id = null; } Topic.Topic_Name_Ar = Topic_Name_Ar; Topic.Topic_Name_En = Topic_Name_En; Topic.Topic_Description_Ar = Arabic_Description; Topic.Topic_Description_En = English_Description; Topic.Topic_Recommendation_Ar = Arabic_Recommendation; Topic.Topic_Recommendation_En = English_Recommendation; Topic.Topic_Recommendation_Doc_Ar = Arabic_RecommendationDoc; Topic.Topic_Recommendation_Doc_En = English_RecommendationDoc; if (Topic_Id != 0) { db.Entry(Topic).State = System.Data.EntityState.Modified; } else { Topic.Create_Date = DateTime.Now.Date; db.M_Topic.Add(Topic); } db.SaveChanges(); /* Add it to log file */ LogData = "data:" + JsonConvert.SerializeObject(Topic, logFileModule.settings); if (Meeting_Id != 0) { logFileModule.logfile(10, "تعديل بيانات موضوع", "update Topic", LogData); } else { logFileModule.logfile(10, "إضافة موضوع", "Add Topic", LogData); } } catch { return(false); } return(true); }
protected void Save_Click(object sender, EventArgs e) { if (IsUpdate) { UpdateLocation(); } else { try { M_Board_Location locations = db.M_Board_Location.Create(); locations.Board_Id = int.Parse(txtBoard.SelectedValue); locations.Board_Location_Name_Ar = txtArabicName.Text; locations.Board_Location_Name_En = txtEnglishName.Text; locations.Board_Location_Description_Ar = txtArabicDescription.Text; locations.Board_Location_Description_En = txtEnglishDescription.Text; locations.Board_Location_OnMap = txtMapLocation.Text; locations.Board_Location_URLVideo = txtVideoURL.Text; db.M_Board_Location.Add(locations); db.SaveChanges(); string messages = "Location Added successfully.."; if (SessionWrapper.LoggedUser.Language_id == 1) { messages = "تم اضافة الموقع بنجاح"; } LtrMessage.Text = "<div class='alert alert-success' role='alert'>" + messages + "</div>"; LoadLocations(); Clear(); } catch { string messages = "System Error..."; if (SessionWrapper.LoggedUser.Language_id == 1) { messages = "حدث خطاء في النظام..."; } LtrMessage.Text = "<div class='alert alert-danger' role='alert'>" + messages + "</div>"; } } }
private bool insert_tree_record(string Name_Ar, string Name_En, int parent_id) { try { Structure stru = db.Structures.Create(); stru.Structure_Name_Ar = Name_Ar; stru.Structure_Name_En = Name_En; stru.Structure_Parent = parent_id; db.Structures.Add(stru); db.SaveChanges(); } catch { return(false); } return(true); }
private bool insert_tree_record(string Name_Ar, string Name_En, int parent_id, string StructureCode, bool IsJob, bool IsManager) { try { Structure stru = db.Structures.Create(); stru.Structure_Name_Ar = Name_Ar; stru.Structure_Name_En = Name_En; stru.Structure_Parent = parent_id; stru.Code = StructureCode; stru.Is_Job_Title = IsJob; stru.Is_Manager = IsManager; db.Structures.Add(stru); db.SaveChanges(); } catch { return(false); } return(true); }
private bool AddPermission(string arabic_name, string english_name, int parent_id, string url, string icon) { try { Permission Per = db.Permissions.Create(); Per.Permission_Name_Ar = arabic_name; Per.Permission_Name_En = english_name; Per.Parent = parent_id; Per.Url_Path = url; Per.Permission_Icon = icon; db.Permissions.Add(Per); db.SaveChanges(); //PriorityDataSource.DataBind(); } catch { return(false); } return(true); }
public bool AU_Emplooyees(string ArabicName, string EnglishName, string Email, string PassWord, string Phone, bool Active, int GroupID) { bool T = false; try { Employee Emp = db.Employees.Create(); Emp.Employee_Name_Ar = ArabicName; Emp.Employee_Name_En = EnglishName; Emp.Employee_Email = Email; Emp.Employee_Password = PassWord; Emp.Employee_Phone = Phone; Emp.Employee_Active = Active; Emp.Group_Id = GroupID; db.Employees.Add(Emp); db.SaveChanges(); } catch { return(false); } return(true); }
public bool DeleteTopic(int Topic_id) { LogFileModule logFileModule = new LogFileModule(); String LogData = ""; db.Configuration.LazyLoadingEnabled = false; try { var DelTopic = db.M_Topic.First(x => x.Topic_Id == Topic_id); db.M_Topic.Remove(DelTopic); db.SaveChanges(); /* Add it to log file */ LogData = "data:" + JsonConvert.SerializeObject(DelTopic, logFileModule.settings); logFileModule.logfile(10, "حذف الموضوع", "Delete Topic", LogData); } catch (Exception e) { return(false); } return(true); }
private bool insertNotification(int treatmentIdNotf) { try { using (ECMSEntities dbEcms = new ECMSEntities()) { Treatment_Master treatmentMasterNotf = new Treatment_Master(); treatmentMasterNotf = dbEcms.Treatment_Master.FirstOrDefault(x => x.Treatment_Id == treatmentIdNotf && x.Required_Reply == true); if (treatmentMasterNotf != null) { List <Treatment_Detial> listTreatmentDetialNotf = new List <Treatment_Detial>(); listTreatmentDetialNotf = treatmentMasterNotf.Treatment_Detial.Where(x => x.Treatment_Copy_To == false).ToList <Treatment_Detial>(); string linkNotif = ""; for (int i = 0; i < listTreatmentDetialNotf.Count; i++) { linkNotif = "../../../../Pages/Treatment/ShowTreatment.aspx?getTreatmentId=" + treatmentIdNotf + "&getTabId=4&getTreatmentDetialId=" + 0 + "&getNotificationId="; Notification_Master notificationMaster = new Notification_Master(); notificationMaster = dbEcms.Notification_Master.Create(); notificationMaster.Notification_Date = DateTime.Now; notificationMaster.Is_Read = false; notificationMaster.From_Employee_Structure_Id = listTreatmentDetialNotf[i].To_Employee_Structure_Id; notificationMaster.To_Employee_Structure_Id = currentStructureUserId; notificationMaster.Master_Id = treatmentIdNotf; notificationMaster.Notification_Description_Ar = "لم يتم الرد علي المعاملة"; notificationMaster.Notification_Description_En = "The transaction was not answered"; notificationMaster.Notification_Link = linkNotif; notificationMaster.Is_Show_Reply = true; notificationMaster.Date_Show_Reply = treatmentMasterNotf.Required_Reply_Date; notificationMaster.Notification_Show_Id = 4; dbEcms.Notification_Master.Add(notificationMaster); dbEcms.SaveChanges(); } } } return(true); } catch { return(false); } }
public void ProcessRequest(HttpContext context) { if (context.Request["BoardId"] == null || context.Request["EmpId"] == null || context.Request["MemberTableId"] == null) { context.Response.Redirect("~/Pages/Eminutes/Home.aspx"); } int board_id = int.Parse(context.Request["BoardId"].ToString()); int emp_id = int.Parse(context.Request["EmpId"].ToString()); int member_id = int.Parse(context.Request["MemberTableId"].ToString()); try { var member = new M_Board_Member { Board_Member_Id = member_id }; db.Entry(member).State = System.Data.EntityState.Deleted; db.SaveChanges(); } catch { } context.Response.Redirect("~/Pages/Eminutes/BoardManagment/BoardMember.aspx?BoardId=" + board_id); }
private bool saveTreatment() { if (validationForm()) { try { var newTreatment = db.Treatments.Create(); newTreatment.Create_Date = DateTime.Now; newTreatment.Update_Date = DateTime.Now; newTreatment.Treatment_Date = DateTime.Parse(treatmentDate.Text); newTreatment.Treatment_Procedure_Id = int.Parse(standardProcedure.SelectedValue); newTreatment.Treatment_Type_Id = int.Parse(typeTreatment.SelectedValue); newTreatment.Prepared_Administration_Id = int.Parse(preparedManagement.SelectedValue); newTreatment.Treatment_Class_Id = int.Parse(classificationSubject.SelectedValue); newTreatment.Treatment_Subject = subjectTreatement.Text; newTreatment.Treatment_Confidentiality_Id = int.Parse(secretLevel.SelectedValue); newTreatment.Treatment_Priority_id = int.Parse(priorityLevel.SelectedValue); newTreatment.Treatment_Delivery_Id = int.Parse(speedUp.SelectedValue); newTreatment.Treatment_Body = speech.Text; newTreatment.Required_Reply = checkRequiredReply(); newTreatment.Treatment_Status_Id = 1; newTreatment.Treatment_Number = getTreatmentNumber(); newTreatment.From_Employee_Structure_Id = currentStructureUserId; if (checkRequiredReply()) { newTreatment.Required_Reply_Date = DateTime.Parse(replyDate.Text); } /////////////////////////////////////// Start Insert To ///////////////////////////////////// Treatment_Detial treatmentDetial; for (int i = 0; i < treatmentTo.Items.Count; i++) { if (treatmentTo.Items[i].Selected) { treatmentDetial = new Treatment_Detial(); treatmentDetial.To_Employee_Structure_Id = int.Parse(treatmentTo.Items[i].Value); treatmentDetial.Parent = 0; treatmentDetial.Assignment_Status_Id = 1; treatmentDetial.Is_Read = false; treatmentDetial.Is_Delete = false; treatmentDetial.Treatment_Copy_To = false; newTreatment.Treatment_Detial.Add(treatmentDetial); } } /////////////////////////////////////// End Insert To ///////////////////////////////////// /////////////////////////////////////// Start Insert Copy To ///////////////////////////////////// for (int i = 0; i < treatmentCopyTo.Items.Count; i++) { if (treatmentCopyTo.Items[i].Selected) { treatmentDetial = new Treatment_Detial(); treatmentDetial.To_Employee_Structure_Id = int.Parse(treatmentCopyTo.Items[i].Value); treatmentDetial.Parent = 0; treatmentDetial.Assignment_Status_Id = 1; treatmentDetial.Is_Read = false; treatmentDetial.Is_Delete = false; treatmentDetial.Treatment_Copy_To = true; newTreatment.Treatment_Detial.Add(treatmentDetial); } } /////////////////////////////////////// End Insert Copy To ///////////////////////////////////// db.Treatments.Add(newTreatment); db.SaveChanges(); } catch { messageForm = "Erorr to save data in system"; return(false); } return(true); } else { return(false); } }
private bool saveTreatment() { if (validationForm()) { try { db.Configuration.LazyLoadingEnabled = false; var newTreatment = db.Treatment_Master.Create(); newTreatment.Create_Date = DateTime.Now; newTreatment.Update_Date = DateTime.Now; newTreatment.Treatment_Date = DateTime.Parse(treatmentDate.Text); newTreatment.Treatment_Procedure_Id = int.Parse(standardProcedure.SelectedValue); newTreatment.Treatment_Type_Id = int.Parse(typeTreatment.SelectedValue); newTreatment.Prepared_Administration_Id = int.Parse(preparedManagement.SelectedValue); newTreatment.Treatment_Class_Id = int.Parse(classificationSubject.SelectedValue); newTreatment.Treatment_Subject = subjectTreatement.Text; newTreatment.Treatment_Confidentiality_Id = int.Parse(secretLevel.SelectedValue); newTreatment.Treatment_Priority_id = int.Parse(priorityLevel.SelectedValue); newTreatment.Treatment_Delivery_Id = int.Parse(speedUp.SelectedValue); newTreatment.Treatment_Body = speech.Text; newTreatment.Required_Reply = checkRequiredReply(); newTreatment.Treatment_Status_Id = 1; newTreatment.Treatment_Number = getTreatmentNumber(); newTreatment.From_Employee_Structure_Id = currentStructureUserId; newTreatment.Treatment_Mother = 0; if (checkRequiredReply()) { newTreatment.Required_Reply_Date = DateTime.Parse(replyDate.Text); } /////////////////////////////////////// Start Insert Send To ///////////////////////////////////// Treatment_Detial treatmentDetial; var selectedItemsTreatmentTo = from li in treatmentTo.Items.Cast <ListItem>() where li.Selected == true select li; foreach (var itemTreatmentTo in selectedItemsTreatmentTo) { treatmentDetial = new Treatment_Detial(); treatmentDetial.To_Employee_Structure_Id = int.Parse(itemTreatmentTo.Value); treatmentDetial.Parent = 0; treatmentDetial.Assignment_Status_Id = 1; treatmentDetial.Is_Read = false; treatmentDetial.Is_Delete = false; treatmentDetial.Treatment_Copy_To = false; newTreatment.Treatment_Detial.Add(treatmentDetial); } /////////////////////////////////////// End Insert Send To ///////////////////////////////////// /////////////////////////////////////// Start Insert Copy To ///////////////////////////////////// var selectedItemsTreatmentCopyTo = from li in treatmentCopyTo.Items.Cast <ListItem>() where li.Selected == true select li; foreach (var itemTreatmentCopyTo in selectedItemsTreatmentCopyTo) { treatmentDetial = new Treatment_Detial(); treatmentDetial.To_Employee_Structure_Id = int.Parse(itemTreatmentCopyTo.Value); treatmentDetial.Parent = 0; treatmentDetial.Assignment_Status_Id = 1; treatmentDetial.Is_Read = false; treatmentDetial.Is_Delete = false; treatmentDetial.Treatment_Copy_To = true; newTreatment.Treatment_Detial.Add(treatmentDetial); } /////////////////////////////////////// End Insert Copy To ///////////////////////////////////// db.Treatment_Master.Add(newTreatment); db.SaveChanges(); treatmentId = newTreatment.Treatment_Id; /////////////////////////////////////// Start Add Attachment ///////////////////////////////////// Attachment addAtachtmentTreatment; foreach (HttpPostedFile postfiles in addAttachments1111.PostedFiles) { if (postfiles.ContentLength > 0 && postfiles.FileName != "") { addAtachtmentTreatment = new Attachment(); addAtachtmentTreatment.Attachment_Path = UploadFile(postfiles); addAtachtmentTreatment.Attachment_Name = postfiles.FileName; addAtachtmentTreatment.Treatment_Id = newTreatment.Treatment_Id; addAtachtmentTreatment.Attachment_Type = 1; db.Attachments.Add(addAtachtmentTreatment); db.SaveChanges(); } } /////////////////////////////////////// End Add Attachment ///////////////////////////////////// if (insertNotification(newTreatment.Treatment_Id)) { } LogData = "data:" + JsonConvert.SerializeObject(newTreatment, logFileModule.settings); logFileModule.logfile(1009, "إضافة معاملة جديدة", "Create New Treatment", LogData); } catch (Exception exceptionLog) { string exceptionStackTrace = exceptionLog.StackTrace; string exceptionGetType = exceptionLog.GetType().ToString(); string exceptionMessage = exceptionLog.Message; string exceptionData = "data:{\"StackTrace\":\"" + exceptionStackTrace + "\",\"GetType\":\"" + exceptionGetType + "\",\"Message\":\"" + exceptionMessage + "\"}"; logFileModule.logfile(1025, "حدث خطأ في حفظ المعاملة", "An error occurred in saving the transaction", exceptionData); if (SessionWrapper.LoggedUser.Language_id == 1) { messageForm = "حدث خطأ في حفظ البيانات في النظام"; } else { messageForm = "Erorr to save data in system"; } return(false); } return(true); } else { return(false); } }
protected void Save_Click(object sender, EventArgs e) { if (IsUpdate) { update(); } else { string str = string.Empty; try { // Create Board info M_Board board = db.M_Board.Create(); board.Board_Name_Ar = txtArabicName.Text; board.Board_Name_En = txtEnglishName.Text; board.Board_Description_Ar = txtArabicDescription.Text; board.Board_Description_En = txtEnglishDescription.Text; board.Board_Type_Id = int.Parse(txtTypeofBoard.SelectedValue.ToString()); board.Board_Status_Id = 1; // int.Parse(txtStatusofBoard.SelectedValue.ToString()); board.Board_Classification_Id = int.Parse(txtClassification.SelectedValue.ToString()); board.Parent = int.Parse(txtParent.SelectedValue.ToString()); board.Create_Date = DateTime.Now; if (txtTypeofBoard.SelectedValue == "3" && (txtStartDate.Value.ToString() == "" || txtStartDate.Value.ToString() == "")) { if (SessionWrapper.LoggedUser.Language_id == 1) { LtrMessage.Text = "<div class='alert alert-warning' role='alert'>الرجاء اختيار تاريخ البداية والنهاية</div>"; } else { LtrMessage.Text = "<div class='alert alert-warning' role='alert'>Please Select start date & end date...</div>"; } return; } else if ((txtTypeofBoard.SelectedValue == "3")) { board.Start_Date = DateTime.Parse(txtStartDate.Value.ToString()); board.End_Date = DateTime.Parse(txtEndDate.Value.ToString()); } string message = ""; db.M_Board.Add(board); db.SaveChanges(); int board_id = db.M_Board.Max(x => x.Board_Id); if (addAttachments != null) { AttachmentFile(board_id, addAttachments, @"~\Pages\Eminutes\media\M_Attachments\"); } // Update exist member M_Board_Member member = db.M_Board_Member.Create(); member.Board_Id = board_id; member.Employee_Id = SessionWrapper.LoggedUser.Employee_Id; member.Member_Type_Id = 1; // رئيس db.M_Board_Member.Add(member); db.SaveChanges(); if (SessionWrapper.LoggedUser.Language_id == 1) { message = "Board add success..."; } else { message = "تم اضافة المجلس/اللجنة بنجاح"; } LtrMessage.Text = "<div class='alert alert-success' role='alert'>" + message + "</div>"; clear(); } catch { string message = "System Error..."; if (SessionWrapper.LoggedUser.Language_id == 1) { message = "حدث خطاء ..."; } LtrMessage.Text = "<div class='alert alert-danger' role='alert'>" + message + "</div>"; } } }
public bool AU_Emplooyees(int EmployeeID, string ArabicName, string EnglishName, string Email, string Phone, bool Active, int GroupID, int lang, int calander) { try { db.Configuration.LazyLoadingEnabled = false; Employee Emp = db.Employees.Create(); if (EmployeeID != 0) { Emp = db.Employees.First(x => x.Employee_Id == EmployeeID); } Emp.Employee_Name_Ar = ArabicName; Emp.Employee_Name_En = EnglishName; Emp.Employee_Email = Email; Employee_Structure Emp_Stu = new Employee_Structure();; if (EmployeeID == 0) { string New_Password = StringCipher.RandomString(7); string Encrypted_Password = StringCipher.Encrypt(New_Password, "Password"); // emp.Employee_Password.ToString(); Emp.Employee_Password = Encrypted_Password; string sever_name = Request.Url.Authority.ToString(); /* SendEmail send = new SendEmail(); * bool EmailResult = send.ResetEmail(Email, New_Password, sever_name); * if (EmailResult) * { * Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "show_model_sucess();", true); * }*/ } Emp.Employee_Phone = Phone; Emp.Employee_Active = Active; Emp.Group_Id = GroupID; Emp.Language_id = lang; Emp.Calendar_id = calander; string ImagepathProfile = UploadFile(1); string ImagepathSignature = UploadFile(2); if (ImagepathProfile != "") { Emp.Employee_Profile = ImagepathProfile; } else if (EmployeeID == 0) { ImagepathProfile = "Profile.JPG"; } if (ImagepathSignature != "") { Emp.Employee_Signature = ImagepathSignature; } else if (EmployeeID == 0) { ImagepathSignature = "Signature.JPG"; } /////////////////////////////////////// Employee_Structure ///////////////////////////////////// Boolean DefaultStructure = false; for (int i = 0; i < Emp_Structure.Items.Count; i++) { int id = 0; Boolean IsFound = false; int.TryParse(Emp_Structure.Items[i].Value, out id); var Emp_Stru_found = db.Employee_Structure.Where(x => x.Employee_Id == EmployeeID && x.Structure_Id == id).ToList(); if (Emp_Stru_found.Count > 0) { IsFound = true; } if (Emp_Structure.Items[i].Selected) { if (!IsFound) { Emp_Stu = new Employee_Structure(); Emp_Stu.Structure_Id = int.Parse(Emp_Structure.Items[i].Value); Emp_Stu.Status_Structure = true; Emp_Stu.Type_Delegation = false; if (!DefaultStructure) { Emp_Stu.Default_Structure = true; DefaultStructure = true; } else { Emp_Stu.Default_Structure = false; } Emp.Employee_Structure.Add(Emp_Stu); } else { Emp_Stu = db.Employee_Structure.First(x => x.Employee_Id == EmployeeID && x.Structure_Id == id); Emp_Stu.Status_Structure = true; Emp_Stu.Type_Delegation = false; if (!DefaultStructure) { Emp_Stu.Default_Structure = true; DefaultStructure = true; } else { Emp_Stu.Default_Structure = false; } Emp.Employee_Structure.Add(Emp_Stu); } } else if (IsFound) { Emp_Stu = db.Employee_Structure.First(x => x.Employee_Id == EmployeeID && x.Structure_Id == id); Emp_Stu.Status_Structure = false; Emp_Stu.Type_Delegation = false; Emp_Stu.Default_Structure = false; Emp.Employee_Structure.Add(Emp_Stu); } } /////////////////////////////////////// Employee_Structure ///////////////////////////////////// if (EmployeeID != 0) { db.Entry(Emp).State = System.Data.EntityState.Modified; } else { db.Employees.Add(Emp); } db.SaveChanges(); /* Add it to log file */ LogData = "data:" + JsonConvert.SerializeObject(Emp, logFileModule.settings); if (EmployeeID != 0) { logFileModule.logfile(10, "تعديل بيانات موظف", "update Employee", LogData); } else { logFileModule.logfile(10, "إضافة موظف", "Add Employee", LogData); } LogData = "data:" + JsonConvert.SerializeObject(Emp_Stu, logFileModule.settings); logFileModule.logfile(10, "هيكلة موظف", "Employee Structure", LogData); } catch { return(false); } return(true); }