コード例 #1
0
        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;
            }
        }
コード例 #2
0
ファイル: SalariesCmd.cs プロジェクト: ainma007/UcasProject
        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;
            }
        }
コード例 #3
0
        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;
               
            }
        }
コード例 #4
0
ファイル: ContractCmd.cs プロジェクト: ainma007/UcasProject
        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;
            }
        }
コード例 #5
0
ファイル: ContractCmd.cs プロジェクト: ainma007/UcasProject
        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;
            }
        }
コード例 #6
0
      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;
            }
        }
コード例 #7
0
 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;
       }
      
   }
コード例 #8
0
      public static List<ProjectProfile> GetAllProjects()
        {
            try
            {
            db = new UcasProEntities();
            var lst = (from p in db.ProjectProfiles 
                      
                       select p).ToList();
            return lst;
            }
            catch (Exception ex)
            {

                Xprema.XpremaException e = new Xprema.XpremaException();
                e.CodeNumber = 6;
                e.OtherDescription = ex.InnerException.InnerException.Message;
                e.UserDescription = "Error ";
                e.UserDescriptionArabic = "خطاء ";
                throw e;
            }
        }
コード例 #9
0
ファイル: UsersCmd.cs プロジェクト: ainma007/UcasProject
       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;
            
           }
       }
コード例 #10
0
ファイル: SalariesCmd.cs プロジェクト: ainma007/UcasProject
        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;
            }
        }
コード例 #11
0
        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;
            }
        }
コード例 #12
0
        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;
            }
        }
コード例 #13
0
        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;
            }
        }