public static bool AddTheTheDonorsProject(TheDonorsProject tb) { try { db = new UcasProEntities(); db.TheDonorsProjects.Add(tb); db.SaveChanges(); return true; } catch (Exception ex) { Xprema.XpremaException e = new Xprema.XpremaException(); e.CodeNumber = 6; e.OtherDescription = ex.InnerException.InnerException.Message; File.WriteAllText("t.txt", ex.InnerException.InnerException.Message); e.UserDescription = "Error in Save Changed"; if (ex.InnerException.InnerException.Message.Contains("Violation of PRIMARY KEY constraint 'PK_TheDonorsProjects'. Cannot insert duplicate key in object 'dbo.TheDonorsProjects'")) { e.UserDescriptionArabic = "الممول مضاف مسبقا للمشروع"; } else e.UserDescriptionArabic = e.OtherDescription;//"خطاء في اضافة البيانات"; throw e; } }
public static bool NewContract(Contract Ct) { try { db = new UcasProEntities(); db.Configuration.ProxyCreationEnabled = false; db.Configuration.LazyLoadingEnabled = false; db.Contracts.Add(Ct); db.SaveChanges(); return true; } catch (Exception ex) { Xprema.XpremaException e = new Xprema.XpremaException(); e.CodeNumber = 6; e.OtherDescription = ex.InnerException.InnerException.Message; File.WriteAllText("t.txt", ex.InnerException.InnerException.Message); e.UserDescription = "Error in Save Changed"; if (ex.InnerException.InnerException.Message.Contains("Violation of PRIMARY KEY constraint 'PK_Contracts'. Cannot insert duplicate key in object 'dbo.Contracts'")) { e.UserDescriptionArabic = "الموظف موجود عقده في المشروع مسبقا"; } else e.UserDescriptionArabic = e.OtherDescription;//"خطاء في اضافة البيانات"; throw e; } }
public static bool EditContract(Contract Ct) { try { db = new UcasProEntities(); db.Configuration.LazyLoadingEnabled = false; db.Configuration.ProxyCreationEnabled = false; var q = db.Contracts.Where(p => p.ID == Ct.ID).SingleOrDefault(); q.Employee_ID = Ct.Employee_ID; q.TotalSalary = Ct.TotalSalary; q.SelaryAmount = Ct.SelaryAmount; q.StartDate = Ct.StartDate; q.EndDate = Ct.EndDate; q.Status = Ct.Status; db.SaveChanges(); return true; } catch (Exception ex) { Xprema.XpremaException e = new Xprema.XpremaException(); e.CodeNumber = 6; e.OtherDescription = ex.InnerException.InnerException.Message; e.UserDescription = "Error in Save Changed"; e.UserDescriptionArabic = "خطاء في حفظ البيانات"; throw e; } }
public static bool EditProjectExpens(ProjectExpens tb) { try { db = new UcasProEntities(); db.Configuration.LazyLoadingEnabled = false; db.Configuration.ProxyCreationEnabled = false; var q = db.ProjectExpenses.Where(p => p.ID == tb.ID).SingleOrDefault(); q.ExpensesName = tb.ExpensesName; q.DateofProcess = tb.DateofProcess; q.BillNumber = tb.BillNumber; q.RequiarAmount = tb.RequiarAmount; q.CashingNumber = tb.CashingNumber; q.ProjectSubActivity_ID = tb.ProjectSubActivity_ID; q.Supplier_ID = tb.Supplier_ID; db.SaveChanges(); return true; } catch (Exception ex) { Xprema.XpremaException e = new Xprema.XpremaException(); e.CodeNumber = 6; e.OtherDescription = ex.InnerException.InnerException.Message; e.UserDescription = "Error in Save Changed"; e.UserDescriptionArabic = "خطاء في حفظ البيانات"; throw e; } }
public static bool EditProjectProfile(ProjectProfile ptb) { try { db = new UcasProEntities(); db.Configuration.LazyLoadingEnabled = false; db.Configuration.ProxyCreationEnabled = false; var q = db.ProjectProfiles.Where(p => p.ID == ptb.ID).SingleOrDefault(); q.ProjectName = ptb.ProjectName; q.ProjectDescription = ptb.ProjectDescription; q.StartDate = ptb.StartDate; q.EndDate = ptb.EndDate; q.Status = ptb.Status; q.Coin = ptb.Coin; q.TotalCost = ptb.TotalCost; db.SaveChanges(); return true; } catch (Exception ex) { Xprema.XpremaException e = new Xprema.XpremaException(); e.CodeNumber = 6; e.OtherDescription = ex.InnerException.InnerException.Message; e.UserDescription = "Error in Add"; e.UserDescriptionArabic = "خطاء في اضافة البيانات"; throw e; } }
public static bool EditSalary(Monthlysalary tb) { try { db = new UcasProEntities(); db.Configuration.LazyLoadingEnabled = false; db.Configuration.ProxyCreationEnabled = false; var q = db.Monthlysalaries.Where(p => p.ID == tb.ID).SingleOrDefault(); q.ContractID = tb.ContractID; q.IssueDate = tb.IssueDate; q.Amount = tb.Amount; q.Formonth = tb.Formonth; db.SaveChanges(); return true; } catch (Exception ex) { Xprema.XpremaException e = new Xprema.XpremaException(); e.CodeNumber = 6; e.OtherDescription = ex.InnerException.InnerException.Message; e.UserDescription = "Error in Save Changed"; e.UserDescriptionArabic = "خطاء في حفظ البيانات"; throw e; } }
public static bool EditSubActivity(ProjectSubActivity SActv) { try { db = new UcasProEntities(); db.Configuration.LazyLoadingEnabled = false; db.Configuration.ProxyCreationEnabled = false; var q = db.ProjectSubActivities.Where(p => p.ID == SActv.ID).SingleOrDefault(); q.SubActivityName = SActv.SubActivityName; q.Description = SActv.Description; q.Startdate = SActv.Startdate; q.enddate = SActv.enddate; q.TotalCost = SActv.TotalCost; q.Status = SActv.Status; q.Progress = SActv.Progress; db.SaveChanges(); return true; } catch (Exception ex) { Xprema.XpremaException e = new Xprema.XpremaException(); e.CodeNumber = 6; e.OtherDescription = ex.InnerException.InnerException.Message; e.UserDescription = "Error in Save Changed"; e.UserDescriptionArabic = "خطاء في حفظ البيانات"; throw e; } }
public static bool AddDonor(TheDonor tb) { db = new UcasProEntities(); db.Configuration.LazyLoadingEnabled = false; db.Configuration.ProxyCreationEnabled = false; db.TheDonors.Add(tb); db.SaveChanges(); return true; }
public static bool NewUser(UserTb tb) { db = new UcasProEntities(); db.UserTbs.Add(tb); db.SaveChanges(); return true; }
public static bool NewAttachment(Attachment tb) { db = new UcasProEntities(); //db.Configuration.ProxyCreationEnabled = false; // db.Configuration.LazyLoadingEnabled = false; db.Attachments.Add(tb); db.SaveChanges(); return true; }
public static bool addEmployee(Employee emp) { db = new UcasProEntities(); db.Employees.Add(emp); db.SaveChanges(); return true; }
public static bool DeleteAttachment(int ID) { db = new UcasProEntities(); db.Configuration.LazyLoadingEnabled = false; db.Configuration.ProxyCreationEnabled = false; var q = db.Attachments.Where(p => p.IDX == ID).SingleOrDefault(); db.Attachments.Remove(q); db.SaveChanges(); return true; }
public static bool newSupplier(Supplier Sup) { db = new UcasProEntities(); db.Configuration.ProxyCreationEnabled = false; db.Configuration.LazyLoadingEnabled = false; db.Suppliers.Add(Sup); db.SaveChanges(); return true; }
public static bool DeleteAmountsReceived(int ID) { try { db = new UcasProEntities(); db.Configuration.LazyLoadingEnabled = false; db.Configuration.ProxyCreationEnabled = false; var q = db.AmountsReceiveds.Where(p => p.ID == ID).SingleOrDefault(); db.AmountsReceiveds.Remove(q); db.SaveChanges(); return true; } catch (Exception ) { return false; } }
public static bool EditAttachment(Attachment tb) { db = new UcasProEntities(); db.Configuration.LazyLoadingEnabled = false; db.Configuration.ProxyCreationEnabled = false; var q = db.Attachments.Where(p => p.IDX == tb.IDX).SingleOrDefault(); q.AttachmentName = tb.AttachmentName; q.CreateDate = tb.CreateDate; q.ProjectProfile_ID = tb.ProjectProfile_ID; db.SaveChanges(); return true; }
public static bool NewAmountsReceived(AmountsReceived tb) { try { db = new UcasProEntities(); db.Configuration.ProxyCreationEnabled = false; db.Configuration.LazyLoadingEnabled = false; db.AmountsReceiveds.Add(tb); db.SaveChanges(); return true; } catch (Exception ) { return false; } }
public static bool DeleteEmployee(int ID) { try { db = new UcasProEntities(); var q = db.Employees.Where(p => p.ID == ID).SingleOrDefault(); db.Employees.Remove(q); db.SaveChanges(); return true; } catch (Exception ) { return false; } }
public static bool EditEmployee(Employee emp) { db = new UcasProEntities(); var q = db.Employees.Where(p => p.ID == emp.ID).SingleOrDefault(); q.EmployeeName = emp.EmployeeName; q.EmployeejobNumber = emp.EmployeejobNumber; q.EmployeeGender = emp.EmployeeGender; q.PhoneNumber = emp.PhoneNumber; q.Mobilenumber = emp.Mobilenumber; q.Email = emp.Email; q.EmployeeNationalNumber = emp.EmployeeNationalNumber; db.SaveChanges(); return true; }
public static bool EditSupplier(Supplier Sup) { db = new UcasProEntities(); db.Configuration.LazyLoadingEnabled = false; db.Configuration.ProxyCreationEnabled = false; var q = db.Suppliers.Where(p => p.ID == Sup.ID).SingleOrDefault(); q.Name = Sup.Name; q.SuppliersNatural = Sup.SuppliersNatural; q.PhoneNumber = Sup.PhoneNumber; q.Fax = Sup.Fax; q.Email = Sup.Email; q.Adderss = Sup.Adderss; db.SaveChanges(); return true; }
public static bool DeleteDonor(int xid) { try { db = new UcasProEntities(); var q = db.TheDonors.Where(p => p.ID == xid).SingleOrDefault(); db.TheDonors.Remove(q); db.SaveChanges(); return true; } catch (Exception) { return false; } }
public static bool EditDonor(TheDonor tb) { db = new UcasProEntities(); db.Configuration.LazyLoadingEnabled = false; db.Configuration.ProxyCreationEnabled = false; var q = db.TheDonors.Where(p => p.ID == tb.ID).SingleOrDefault(); q.Name = tb.Name; q.agentName = tb.agentName; q.PhoneNumber = tb.PhoneNumber; q.Fax = tb.Fax; q.Email = tb.Email; q.Adderss = tb.Adderss; db.SaveChanges(); return true; }
public static bool AddNewProject(ProjectProfile tb) { try { db = new UcasProEntities(); db.ProjectProfiles.Add(tb); db.SaveChanges(); return true; } catch (Exception ex) { Xprema.XpremaException e = new Xprema.XpremaException(); e.CodeNumber = 6; e.OtherDescription = ex.InnerException.InnerException.Message; e.UserDescription = "Error in Add"; e.UserDescriptionArabic = "خطاء في اضافة البيانات"; throw e; } }
public static bool EditUser(UserTb tb) { try { db = new UcasProEntities(); var q = db.UserTbs.Where(p => p.ID == tb.ID).SingleOrDefault(); q.ID = tb.ID; q.UserName = tb.UserName; q.Password = tb.Password; q.TypeUser = tb.TypeUser; db.SaveChanges(); return true; } catch (Exception ex) { // throw ex; Xprema.XpremaException e = new Xprema.XpremaException(); e.CodeNumber = 6; e.OtherDescription = ex.InnerException.InnerException.Message; File.WriteAllText("t.txt", ex.InnerException.InnerException.Message); e.UserDescription = "Error in Save Changed"; if (ex.InnerException.InnerException.Message.Contains("Cannot insert duplicate key row in object 'dbo.UserTbs' with unique index 'IX_UserTbs'")) { e.UserDescriptionArabic = "اسم المستخدم موجود يرجى تغير الاسم"; } else e.UserDescriptionArabic = e.OtherDescription;//"خطاء في اضافة البيانات"; throw e; } }
public static bool NewSalary(Monthlysalary tb) { try { db = new UcasProEntities(); db.Monthlysalaries.Add(tb); db.SaveChanges(); return true; } catch (Exception ex) { Xprema.XpremaException e = new Xprema.XpremaException(); e.CodeNumber = 6; e.OtherDescription = ex.InnerException.InnerException.Message; e.UserDescription = "Error in Save Changed"; e.UserDescriptionArabic = "خطاء في اضافة البيانات"; throw e; } }
public static bool EditProControl(ProjectControl tb) { try { db = new UcasProEntities(); db.Configuration.LazyLoadingEnabled = false; db.Configuration.ProxyCreationEnabled = false; var q = db.ProjectControls.Where(p => p.ID == tb.ID).SingleOrDefault(); q.UserID = tb.UserID; q.ProjectID = tb.ProjectID; q.Status = tb.Status; db.SaveChanges(); return true; } catch (Exception) { return false; } }
public static bool NewProjectExpens(ProjectExpens tb) { try { db = new UcasProEntities(); db.Configuration.ProxyCreationEnabled = false; db.Configuration.LazyLoadingEnabled = false; db.ProjectExpenses.Add(tb); db.SaveChanges(); return true; } catch (Exception ex) { Xprema.XpremaException e = new Xprema.XpremaException(); e.CodeNumber = 6; e.OtherDescription = ex.InnerException.InnerException.Message; e.UserDescription = "Error in Save Changed"; e.UserDescriptionArabic = "خطاء في اضافة البيانات"; throw e; } }
public static bool EditAmountsReceived(AmountsReceived tb) { try { db = new UcasProEntities(); db.Configuration.LazyLoadingEnabled = false; db.Configuration.ProxyCreationEnabled = false; var q = db.AmountsReceiveds.Where(p => p.ID == tb.ID).SingleOrDefault(); q.TheDonorsProjectID = tb.TheDonorsProjectID; q.Date = tb.Date; q.Cost = tb.Cost; db.SaveChanges(); return true; } catch (Exception) { return false; } }
public static bool DeleteProControl(int xid) { try { ProjectControl tb = new ProjectControl(); db = new UcasProEntities(); tb = db.ProjectControls.Where(pr => pr.ID == xid).SingleOrDefault(); if (tb.ID != 0) { db.ProjectControls.Remove(tb); db.SaveChanges(); return true; } return false; } catch (Exception) { return false; } }
public static bool EditTheDonorsProject(TheDonorsProject tb) { try { db = new UcasProEntities(); db.Configuration.LazyLoadingEnabled = false; db.Configuration.ProxyCreationEnabled = false; var q = db.TheDonorsProjects.Where(p => p.ID == tb.ID).SingleOrDefault(); q.DonorsID = tb.DonorsID; q.TotalCost = tb.TotalCost; db.SaveChanges(); return true; } catch (Exception ex) { Xprema.XpremaException e = new Xprema.XpremaException(); e.CodeNumber = 6; e.OtherDescription = ex.InnerException.InnerException.Message; File.WriteAllText("t.txt", ex.InnerException.InnerException.Message); e.UserDescription = "Error in Save Changed"; if (ex.InnerException.InnerException.Message.Contains("Violation of PRIMARY KEY constraint 'PK_TheDonorsProjects'. Cannot insert duplicate key in object 'dbo.TheDonorsProjects'")) { e.UserDescriptionArabic = "الممول مضاف مسبقا للمشروع"; } else e.UserDescriptionArabic = e.OtherDescription;//"خطاء في اضافة البيانات"; throw e; } }
public static bool DeleteDonorsProject(int xid) { try { db = new UcasProEntities(); TheDonorsProject tb = new TheDonorsProject(); tb = db.TheDonorsProjects.Where(f => f.ID == xid).Single(); if (tb.ID != 0) { db.TheDonorsProjects.Remove(tb); db.SaveChanges(); return true; } return false; } catch (Exception) { return false; } }