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 NewSubActivity(ProjectSubActivity SActv) { try { db = new UcasProEntities(); db.Configuration.ProxyCreationEnabled = false; db.Configuration.LazyLoadingEnabled = false; db.ProjectSubActivities.Add(SActv); 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; } }