public static void Update(int id, BranchStock bs)
        {
            ServicesPortalApiEntities db = new ServicesPortalApiEntities();
            var data = db.BranchStocks.Where(m => m.Id == id).FirstOrDefault();

            data.Quantity = bs.Quantity;
            data.ItemID   = bs.ItemID;
            db.SaveChanges();
        }
        public static void Update(int id, User us)
        {
            ServicesPortalApiEntities db = new ServicesPortalApiEntities();


            var data = db.Users.Where(m => m.id == id).FirstOrDefault();

            data.Status = false;
            db.SaveChanges();
        }
        public static List <SelectListItem> Model()
        {
            ServicesPortalApiEntities db    = new ServicesPortalApiEntities();
            List <SelectListItem>     items = new List <SelectListItem>();
            var vlu = db.Models.ToList();

            items.Add(new SelectListItem {
                Text = "Select Model", Value = ""
            });
            foreach (var itm in vlu)
            {
                items.Add(new SelectListItem {
                    Text = itm.Models, Value = itm.id.ToString()
                });
            }
            return(items);
        }
        public static List <SelectListItem> Category()
        {
            ServicesPortalApiEntities db    = new ServicesPortalApiEntities();
            List <SelectListItem>     items = new List <SelectListItem>();
            var vlu = db.Categories.ToList();

            items.Add(new SelectListItem {
                Text = "Select Category  ", Value = ""
            });
            foreach (var itm in vlu)
            {
                items.Add(new SelectListItem {
                    Text = itm.Catgory, Value = itm.Id.ToString()
                });
            }
            return(items);
        }
        public static List <SelectListItem> Designation(int Id)
        {
            ServicesPortalApiEntities db    = new ServicesPortalApiEntities();
            List <SelectListItem>     items = new List <SelectListItem>();
            var vlu = db.Designations.Where(m => m.CompanyId == Id).ToList();

            items.Add(new SelectListItem {
                Text = "Select Designation", Value = ""
            });
            foreach (var itm in vlu)
            {
                items.Add(new SelectListItem {
                    Text = itm.Description, Value = itm.id.ToString()
                });
            }
            return(items);
        }
        public static List <SelectListItem> ItemAttribute()
        {
            ServicesPortalApiEntities db        = new ServicesPortalApiEntities();
            List <SelectListItem>     itemstype = new List <SelectListItem>();
            var vlu = db.ItemAttributeTypes.ToList();

            itemstype.Add(new SelectListItem {
                Text = "Select Attribute", Value = ""
            });
            foreach (var itm in vlu)
            {
                itemstype.Add(new SelectListItem {
                    Text = itm.ItemAttribute, Value = itm.Id.ToString()
                });
            }
            return(itemstype);
        }
        public static List <SelectListItem> Item()
        {
            ServicesPortalApiEntities db    = new ServicesPortalApiEntities();
            List <SelectListItem>     items = new List <SelectListItem>();
            var vlu = db.inventryItems.ToList();

            items.Add(new SelectListItem {
                Text = "Select items", Value = ""
            });
            foreach (var itm in vlu)
            {
                items.Add(new SelectListItem {
                    Text = itm.SubCategory.Category.Catgory + " | " + itm.SubCategory.SubCat + " | " + itm.Model.Models, Value = itm.id.ToString()
                });
            }
            return(items);
        }
Example #8
0
        public static void Update(int id, Organization or)
        {
            ServicesPortalApiEntities db = new ServicesPortalApiEntities();
            var data = db.Organizations.Where(m => m.id == id).FirstOrDefault();

            data.OrganizaationName = or.OrganizaationName;
            data.Address           = or.Address;
            data.City     = or.City;
            data.Province = or.Province;
            data.ZipCode  = or.ZipCode;
            data.Country  = or.Country;
            data.Call     = or.Call;
            data.Lendline = or.Lendline;
            data.Fax      = or.Fax;
            data.Email    = or.Email;
            data.Url      = or.Url;
            db.SaveChanges();
        }
        public static void UpdateItem(int Id, inventryItem itm)
        {
            ServicesPortalApiEntities db = new ServicesPortalApiEntities();
            var data = db.inventryItems.Where(m => m.id == Id).FirstOrDefault();

            if (data != null)
            {
                data.AvgSalePrice        = itm.AvgSalePrice;
                data.AvgPurchasePrice    = itm.AvgPurchasePrice;
                data.BottemPrice         = itm.BottemPrice;
                data.InternalPrice       = itm.InternalPrice;
                data.TradesPrice         = itm.TradesPrice;
                data.QoutedPrice         = itm.QoutedPrice;
                data.SalesDescription    = itm.SalesDescription;
                data.PurchaseDescription = itm.PurchaseDescription;
            }
            db.SaveChanges();
        }
 public ActionResult Login1(string user, string Password)
 {
     using (ServicesPortalApiEntities db = new ServicesPortalApiEntities())
     {
         var data = db.Users.Where(m => m.Password == Password && (m.Email == user || m.UserName == user)).FirstOrDefault();
         if (data != null)
         {
             if (data.UserType == "SuperAdmin")
             {
                 Session[Shared.Current_Admin] = data;
                 Session["SAname"]             = data.FullName;
                 Session["Type"] = data.UserType;
                 Session["img"]  = data.PictuerPath;
                 return(RedirectToAction("Index", "SuperAdmin"));
             }
             else if (data.UserType == "HeadOffice")
             {
                 Session[Shared.Current_Admin] = data;
                 Session["Cid"]    = data.CompanyId;
                 Session["HAname"] = data.FullName;
                 Session["HType"]  = data.UserType;
                 Session["Himg"]   = data.PictuerPath;
                 Session["Hlogo"]  = data.Company.Logo;
                 return(RedirectToAction("Index", "HeadOffice"));
             }
             else if (data.UserType == "Branch")
             {
                 Session[Shared.Current_Admin] = data;
                 Session["Branchid"]           = data.BranchId;
                 Session["BranchCompanyid"]    = data.CompanyId;
                 Session["BranchAdminname"]    = data.FullName;
                 Session["BranchName"]         = data.Branch.BranchName;
                 Session["Branchimg"]          = data.PictuerPath;
                 Session["Branchlogo"]         = data.Company.Logo;
                 return(RedirectToAction("Index", "Branch"));
             }
             else if (data.UserType == "Staff")
             {
                 if (data.Status == false)
                 {
                     TempData["disable"] = "Your account has been disable";
                     return(RedirectToAction("Login"));
                 }
                 else
                 {
                     Session[Shared.Current_Admin] = data;
                     Session["StaffBranchid"]      = data.BranchId;
                     Session["StaffCompanyid"]     = data.CompanyId;
                     Session["Staffname"]          = data.FullName;
                     Session["StaffBranchName"]    = data.Branch.BranchName;
                     Session["Staffimg"]           = data.PictuerPath;
                     Session["StaffCompanylogo"]   = data.Company.Logo;
                     return(RedirectToAction("Index", "Staff"));
                 }
             }
             else
             {
                 TempData["Error"] = "Invalid User";
                 return(RedirectToAction("Login"));
             }
         }
         else
         {
             var d = db.Users.Where(m => m.Password == Password).FirstOrDefault();
             if (d == null)
             {
                 TempData["Error"] = "Enter Wrong Psssword";
                 return(RedirectToAction("Login"));
             }
             else
             {
                 TempData["Error"] = "Enter Wrong UserName";
                 return(RedirectToAction("Login"));
             }
         }
     }
 }