public static bool RegisterUser(Cts_User_Master userDetails)
 {
     using (DBContextDataContext db = new DBContextDataContext())
     {
         try
         {
             var check = db.Cts_User_Masters.Where(x => x.um_userId == userDetails.um_userId).ToList();
             if (check.Count == 0)
             {
                 db.Cts_User_Masters.InsertOnSubmit(userDetails);
                 db.SubmitChanges();
                 if (userDetails.um_id > 0)
                 {
                     return(true);
                 }
                 else
                 {
                     return(false);
                 }
             }
             else
             {
                 return(false);
             }
         }
         catch (Exception ex)
         {
             return(false);
         }
     }
 }
Beispiel #2
0
 public static bool UpdateProfile(int UID, UserMaster update)
 {
     try
     {
         if (UID > 0)
         {
             using (DBContextDataContext db = new DBContextDataContext())
             {
                 List <UserMaster> profile = db.UserMasters.Where(x => x.UID == UID).ToList();
                 foreach (UserMaster row in profile)
                 {
                     row.FirstName        = update.FirstName;
                     row.LastName         = update.LastName;
                     row.Age              = update.Age;
                     row.Gender           = update.Gender;
                     row.DoB              = update.DoB;
                     row.ContactNumber    = update.ContactNumber;
                     row.AltContactNumber = update.AltContactNumber;
                     row.EMail            = update.EMail;
                 }
                 db.SubmitChanges();
                 return(true);
             }
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     { return(false); }
 }
 public static bool UpdateProfile(int umId, Cts_User_Master update)
 {
     try
     {
         if (umId > 0)
         {
             using (DBContextDataContext db = new DBContextDataContext())
             {
                 List <Cts_User_Master> profile = db.Cts_User_Masters.Where(x => x.um_id == umId).ToList();
                 foreach (Cts_User_Master row in profile)
                 {
                     row.um_firstName  = update.um_firstName;
                     row.um_lastName   = update.um_lastName;
                     row.um_contact    = update.um_contact;
                     row.um_PerAddress = update.um_PerAddress;
                     row.um_CorAddress = update.um_CorAddress;
                     row.um_emailId    = update.um_emailId;
                 }
                 db.SubmitChanges();
                 return(true);
             }
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     { return(false); }
 }
 public static bool UpdateProfile(int UID, UserMaster update)
 {
     try
     {
         if (UID > 0)
         {
             using (DBContextDataContext db = new DBContextDataContext())
             {
                 List <UserMaster> profile = db.UserMasters.Where(x => x.UID == UID).ToList();
                 foreach (UserMaster row in profile)
                 {
                     row.LicenseNumber = update.LicenseNumber;
                     row.AddressLine1  = update.AddressLine1;
                     row.AddressLine2  = update.AddressLine2;
                     row.City          = update.City;
                     row.State         = update.State;
                     row.ZipCode       = update.ZipCode;
                     row.SSN           = update.SSN;
                 }
                 db.SubmitChanges();
                 return(true);
             }
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     { return(false); }
 }
        public static bool EditManager(int id, string add, string add1, string city, string state, long code)
        {
            try
            {
                using (DBContextDataContext db = new DBContextDataContext())
                {
                    List <Hanger> hanger = db.Hangers.Where(x => x.Hanger_ID == id).ToList();

                    foreach (Hanger hng in hanger)
                    {
                        hng.Manager_Address_Line_1 = add;
                        hng.Manager_Address_Line_2 = add1;
                        hng.City     = city;
                        hng.State    = state;
                        hng.Zip_Code = code;
                    }
                    db.SubmitChanges();
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }
        public int themThanhVien(eCauThu ct)
        {
            tblCauThu temp = db.tblCauThus.Where(x => x.MaCauThu == ct.MaCauThu).FirstOrDefault();

            if (temp != null)
            {
                return(0);
            }
            tblCauThu newct = new tblCauThu();

            newct.MaCauThu    = ct.MaCauThu;
            newct.TenCauThu   = ct.TenCauThu;
            newct.SoDienThoai = ct.SoDienThoai;
            newct.Email       = ct.Email;
            newct.IdDoiBong   = ct.MaDoiBong;
            db.tblCauThus.InsertOnSubmit(newct);
            db.SubmitChanges();
            return(1);
        }
Beispiel #7
0
 public static bool allotplanes(hangerallot rea)
 {
     if (rea.allotdetails != null)
     {
         using (DBContextDataContext db = new DBContextDataContext())
         {
             db.hangerallots.InsertOnSubmit(rea);
             db.SubmitChanges();
             return(true);
         }
     }
     else
     {
         return(false);
     }
 }
Beispiel #8
0
 public static bool ApproveUsers(int UID, bool status)
 {
     using (DBContextDataContext db = new DBContextDataContext())
     {
         try
         {
             var user = db.UserMasters.Where(x => x.UID == UID).FirstOrDefault();
             user.IsActive = status;
             db.SubmitChanges();
             return(true);
         }
         catch
         {
             return(false);
         }
     }
 }
 public static bool UpdateStatusPackage(int cid, string location, string status, bool active)
 {
     using (DBContextDataContext db = new DBContextDataContext())
     {
         try
         {
             var package = db.Cts_Packages.Where(x => x.pk_consignment_id == cid && x.pk_Package_Status != "Delivered").FirstOrDefault();
             package.pk_Current_location = location;
             package.pk_Package_Status   = status;
             package.pk_isActive         = active;
             db.SubmitChanges();
             return(true);
         }
         catch
         {
             return(false);
         }
     }
 }
 public static bool ApproveUsers(int um_id, bool status, string empId, string name, long salary)
 {
     using (DBContextDataContext db = new DBContextDataContext())
     {
         try
         {
             var user = db.Cts_User_Masters.Where(x => x.um_id == um_id).FirstOrDefault();
             user.um_isActive     = status;
             user.um_IsApprovedOn = DateTime.Now.Date;
             user.um_IsApprovedBy = name;
             user.um_Salary       = salary;
             db.SubmitChanges();
             return(true);
         }
         catch
         {
             return(false);
         }
     }
 }
 public static bool ApprovePackage(int pk_id, bool status, int role, string empId, int cost, string location)
 {
     using (DBContextDataContext db = new DBContextDataContext())
     {
         try
         {
             var user = db.Cts_Packages.Where(x => x.pk_consignment_id == pk_id).FirstOrDefault();
             user.pk_isActive         = status;
             user.pk_Employee_id      = empId;
             user.pk_Accept_Date      = DateTime.Now.Date;
             user.pk_cost             = cost;
             user.pk_Current_location = location;
             db.SubmitChanges();
             return(true);
         }
         catch
         {
             return(false);
         }
     }
 }
 public static bool AddWarehouse(Cts_BranchMaster warehouse)
 {
     using (DBContextDataContext db = new DBContextDataContext())
     {
         try
         {
             db.Cts_BranchMasters.InsertOnSubmit(warehouse);
             db.SubmitChanges();
             if (warehouse.bm_branchCode > 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         catch
         {
             return(false);
         }
     }
 }
Beispiel #13
0
 public static bool AddHangers(Hanger hanger)
 {
     try
     {
         using (DBContextDataContext db = new DBContextDataContext())
         {
             db.Hangers.InsertOnSubmit(hanger);
             db.SubmitChanges();
             if (hanger.Hanger_ID > 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
     catch
     {
         return(false);
     }
 }
Beispiel #14
0
 public static bool AddPlane(Plane _plane)
 {
     try
     {
         using (DBContextDataContext db = new DBContextDataContext())
         {
             db.Planes.InsertOnSubmit(_plane);
             db.SubmitChanges();
             if (_plane.Plane_ID > 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
     catch
     {
         return(false);
     }
 }
 public static bool RegisterPilot(UserMaster pilotDetails)
 {
     using (DBContextDataContext db = new DBContextDataContext())
     {
         try
         {
             db.UserMasters.InsertOnSubmit(pilotDetails);
             db.SubmitChanges();
             if (pilotDetails.UID > 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         catch (Exception ex)
         {
             return(false);
         }
     }
 }
 public static bool AddPackage(Cts_Package _package)
 {
     try
     {
         using (DBContextDataContext db = new DBContextDataContext())
         {
             db.Cts_Packages.InsertOnSubmit(_package);
             db.SubmitChanges();
             if (_package.pk_consignment_id > 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
     catch (Exception Ex)
     {
         return(false);
     }
 }
        public static bool EditPlane(int id, string fname, string lname, long mob, string email)
        {
            try
            {
                using (DBContextDataContext db = new DBContextDataContext())
                {
                    List <Plane> plane = db.Planes.Where(x => x.Plane_ID == id).ToList();

                    foreach (Plane plan in plane)
                    {
                        plan.Owner_first_Name     = fname;
                        plan.Owner_Last_name      = lname;
                        plan.Owner_Contact_number = mob;
                        plan.Owner_Email          = email;
                    }
                    db.SubmitChanges();
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }