public ActionResult Printers(PrinterModel model) { int pageIndex = model.Page ?? 1; using (EquipmentsEntities data = new EquipmentsEntities()) { model.PrinterSearch = (from c in data.TB_Printers.Where(p => p.KayitDurum == "Active" && (String.IsNullOrEmpty(model.SerialNumber) || p.SerialNumber.Contains(model.SerialNumber))).OrderByDescending(p => p.ID) select new PrinterListModel { BasicFeatures = c.BasicFeatures, SerialNumber = c.SerialNumber, Brand = c.Brand, InventoryNumber = c.InventoryNumber, InvoiceContract = c.InvoiceContract, IP = c.IP, Location = c.Location, NetworkName = c.NetworkName, PurchaseDate = c.PurchaseDate, Status = c.Status, UserCode = c.UserCode }).ToPagedList(pageIndex, 15); if (Request.IsAjaxRequest()) { return(PartialView("_Printer", model)); } else { return(View(model)); } } }
public ReturnDto SoftwareAdd(string Name, string Status, DateTime PurchaseDate) { try { using (EquipmentsEntities data = new EquipmentsEntities()) { string kod; int max_id = data.TB_Software.Max(p => p.ID); kod = "Mt-" + max_id; TB_Software m = new TB_Software(); m.UserCode = kod; m.Name = Name; m.Status = Status; m.PurchaseDate = PurchaseDate; m.KayitDurum = "Active"; data.TB_Software.Add(m); data.SaveChanges(); } return(new ReturnDto(true, ReturnDto.Success)); } catch (Exception) { return(new ReturnDto(false, ReturnDto.Failed)); } }
public ActionResult Others(OtherModel model) { int pageIndex = model.Page ?? 1; using (EquipmentsEntities data = new EquipmentsEntities()) { model.OtherSearch = (from c in data.TB_Others.Where(p => p.KayitDurum == "Active" && (String.IsNullOrEmpty(model.Users) || p.Users.Contains(model.Users)) && (String.IsNullOrEmpty(model.SerialNumber) || p.SerialNumber.Contains(model.SerialNumber))).OrderByDescending(p => p.ID) select new OtherListModel { Users = c.Users, Brand = c.Brand, Features = c.Features, InvoiceNumber = c.InvoiceNumber, Location = c.Location, OldUser = c.OldUser, PurchaseDate = c.PurchaseDate, SerialNumber = c.SerialNumber, Specification = c.Specification, UserCode = c.UserCode, }).ToPagedList(pageIndex, 15); if (Request.IsAjaxRequest()) { return(PartialView("_Others", model)); } else { return(View(model)); } } }
public ActionResult Mobile(MobileModel model) { int pageIndex = model.Page ?? 1; using (EquipmentsEntities data = new EquipmentsEntities()) { model.MobileSearch = (from c in data.TB_Mobile.Where(p => p.KayitDurumu == "Active" && (String.IsNullOrEmpty(model.Users) || p.Name.Contains(model.Users)) && (String.IsNullOrEmpty(model.SerialNumber) || p.SerialNumber.Contains(model.SerialNumber))).OrderByDescending(p => p.ID) select new MobileListModel { Demirbas = c.Demirbas, IMEI = c.IMEI, InvoiceNumber = c.InvoiceNumber, MAC = c.MAC, Name = c.Name, Number = c.Number, OldUser = c.OldUser, Phone = c.Phone, PurchaseDate = c.PurchaseDate, SerialNumber = c.SerialNumber, UserCode = c.UserCode }).ToPagedList(pageIndex, 15); if (Request.IsAjaxRequest()) { return(PartialView("_Mobile", model)); } else { return(View(model)); } } }
// GET: Search public ActionResult Notebooks(NotebookModel model) { int pageIndex = model.Page ?? 1; using (EquipmentsEntities data = new EquipmentsEntities()) { model.NotebookSearch = (from c in data.TB_Notebooks.Where(p => p.KayitDurum == "Active" && (String.IsNullOrEmpty(model.Users) || p.Users.Contains(model.Users)) && (String.IsNullOrEmpty(model.SerialNumber) || p.SerialNum.Contains(model.SerialNumber))).OrderByDescending(p => p.ID) select new NotebookListModel { EthMac = c.EthMac, InvoiceNumber = c.InvoiceNumber, OldUser = c.OldUser, PcName = c.PcName, SerialNum = c.SerialNum, PurchaseDate = c.PurchaseDate, Specification = c.Specification, SSD = c.SSD, SSDSerial = c.SSDSerial, UserCode = c.UserCode, Users = c.Users, Vendor = c.Vendor, WifiMac = c.WifiMac, WindowsCdKey = c.WindowsCdKey }).ToPagedList(pageIndex, 15); if (Request.IsAjaxRequest()) { return(PartialView("_Notebook", model)); } else { return(View(model)); } } }
/// <summary> /// DELETE Manufacturer method /// </summary> /// <param name="manufact"></param> /// <returns> /// bool value of method's execution /// </returns> public static bool Remove(Manufact manufact) { using (EquipmentsEntities context = new EquipmentsEntities()) { try { int id = Convert.ToInt32(manufact.Id); var man = context.Manufactures.Single(m => m.Id == id); var equipments = context.Equip.Where(e => e.ManufacturesId == man.Id).ToList(); foreach (var eq in equipments) { eq.ManufacturesId = null; } context.Manufactures.Remove(man); context.SaveChanges(); return(true); } catch (Exception ex) { return(false); } } }
public ReturnDto mobileUpdate(string MobileCode, string Demirbas, string Name, string Phone, string Number, string SerialNumber, string IMEI, string MAC, DateTime PurchaseDate, string InvInvoiceNumber, string Olduser) { try { using (EquipmentsEntities data = new EquipmentsEntities()) { var m = data.TB_Mobile.Where(p => p.UserCode == MobileCode).FirstOrDefault(); m.Demirbas = Demirbas; m.IMEI = IMEI; m.InvoiceNumber = InvInvoiceNumber; m.MAC = MAC; m.Name = Name; m.Number = Number; m.OldUser = Olduser; m.Phone = Phone; m.PurchaseDate = PurchaseDate; m.SerialNumber = SerialNumber; data.SaveChanges(); } return(new ReturnDto(true, ReturnDto.Success)); } catch (Exception) { return(new ReturnDto(false, ReturnDto.Failed)); } }
public ReturnDto VınnUpdate(string VınnCode, string Users, string Operator, string SerialNumber, string IMEI, string DeviceName, string SımCardNo, string PIN1, string PIN2, string PUK1, string PUK2, string Special, string Status, DateTime PurchaseDate, string Olduser) { try { using (EquipmentsEntities data = new EquipmentsEntities()) { var m = data.TB_VINN.Where(p => p.UserCode == VınnCode).FirstOrDefault(); m.IMEI = IMEI; m.DeviceName = DeviceName; m.OldUser = Olduser; m.Operator = Operator; m.PIN1 = PIN1; m.PIN2 = PIN2; m.PUK1 = PUK1; m.PUK2 = PUK2; m.PurchaseDate = PurchaseDate; m.SerialNumber = SerialNumber; m.Special = Special; m.Status = Status; m.SımCardNo = SımCardNo; m.Users = Users; data.SaveChanges(); } return(new ReturnDto(true, ReturnDto.Success)); } catch (Exception) { return(new ReturnDto(false, ReturnDto.Failed)); } }
public ReturnDto OthersUpdate(string OthersCode, string Users, string Brand, string SerialNumber, string Features, string Location, string Specification, DateTime PurchaseDate, string InvoiceNumber, string OldUser) { try { using (EquipmentsEntities data = new EquipmentsEntities()) { var m = data.TB_Others.Where(p => p.UserCode == OthersCode).FirstOrDefault(); m.Brand = Brand; m.Features = Features; m.InvoiceNumber = InvoiceNumber; m.Location = Location; m.PurchaseDate = PurchaseDate; m.OldUser = OldUser; m.SerialNumber = SerialNumber; m.Specification = Specification; m.Users = Users; data.SaveChanges(); } return(new ReturnDto(true, ReturnDto.Success)); } catch (Exception) { return(new ReturnDto(false, ReturnDto.Failed)); } }
/// <summary> /// DELETE Department method /// </summary> /// <param name="depart"></param> /// <returns> /// bool value of method's execution /// </returns> public static bool Remove(Depart depart) { using (EquipmentsEntities context = new EquipmentsEntities()) { try { int id = Convert.ToInt32(depart.Id); DeptEntity dept = context.Depts.Single(d => d.Id == id); context.Depts.Remove(dept); var equipments = context.Equip.Where(e => e.DeptsId == dept.Id).ToList(); foreach (var eq in equipments) { eq.DeptsId = null; } context.SaveChanges(); return(true); } catch (Exception ex) { return(false); } } }
public ReturnDto MonitorsUpdate(string MonitorsCode, string Demirbas, string Brand, string Users, string SerialNumber, string BrandFeatures, string Place, string Status, DateTime PurchaseDate, string InvoiceNumber, string Olduser) { try { using (EquipmentsEntities data = new EquipmentsEntities()) { var m = data.TB_Monitors.Where(p => p.UserCode == MonitorsCode).FirstOrDefault(); m.Brand = Brand; m.BrandFeatures = BrandFeatures; m.Demirbas = Demirbas; m.SerialNumber = SerialNumber; m.InvoiceNumber = InvoiceNumber; m.OldUser = Olduser; m.Place = Place; m.PurchaseDate = PurchaseDate; m.Status = Status; m.Users = Users; data.SaveChanges(); } return(new ReturnDto(true, ReturnDto.Success)); } catch (Exception) { return(new ReturnDto(false, ReturnDto.Failed)); } }
/// <summary> /// GET Equipments method. Get all equipment items from DB /// </summary> /// <returns> /// List of items /// </returns> public static List <EquipView> GetAll() { using (EquipmentsEntities context = new EquipmentsEntities()) { return(context.Equip.Join(context.Depts, e => e.DeptsId, d => d.Id, (e, d) => new { Name = e.EuqipName, DeptsName = d.DeptName, Title = e.EuqipTitle, e.ManufacturesId, e.EquipPrice, e.DateIn, e.EquipSerialNumber, e.EuqipPartNumber, e.Id }).Join(context.Manufactures, e => e.ManufacturesId, m => m.Id, (e, m) => new EquipView { Name = e.Name, DeptsName = e.DeptsName, Title = e.Title, ManufName = m.ManufName, Price = e.EquipPrice, DateIn = e.DateIn, PNumber = e.EuqipPartNumber, SNumber = e.EquipSerialNumber, Id = e.Id }).ToList()); } }
public ReturnDto PrintersUpdate(string PrintersCode, string Brand, string IP, string BasicFeatures, string SerialNumber, string NetworkName, string Location, string InventoryNumber, string InvoiceContract, string Status, DateTime PurchaseDate) { try { using (EquipmentsEntities data = new EquipmentsEntities()) { var m = data.TB_Printers.Where(p => p.UserCode == PrintersCode).FirstOrDefault(); m.BasicFeatures = BasicFeatures; m.Brand = Brand; m.InventoryNumber = InventoryNumber; m.InvoiceContract = InvoiceContract; m.IP = IP; m.Location = Location; m.NetworkName = NetworkName; m.PurchaseDate = PurchaseDate; m.SerialNumber = SerialNumber; m.Status = Status; data.SaveChanges(); } return(new ReturnDto(true, ReturnDto.Success)); } catch (Exception) { return(new ReturnDto(false, ReturnDto.Failed)); } }
/// <summary> /// CREATE Equipment method /// </summary> /// <param name="equipment"></param> /// <returns> /// bool value of method's execution /// </returns> public static bool Create(Equipment equipment) { using (EquipmentsEntities context = new EquipmentsEntities()) { try { EquipEntity newE = new EquipEntity(); newE.EuqipName = equipment.Name; newE.EquipPrice = equipment.Price; newE.EuqipTitle = equipment.Title; newE.EquipSerialNumber = equipment.SerialNumber; newE.EuqipPartNumber = equipment.PartNumber; newE.ManufacturesId = equipment.ManId; newE.DeptsId = equipment.DepId; newE.DateIn = equipment.DateIn; context.Equip.Add(newE); context.SaveChanges(); return(true); } catch (Exception ex) { return(false); } } }
/// <summary> /// Equipment update method /// </summary> /// <param name="equipment"></param> /// <returns> /// bool value of execution: true or false /// </returns> public static bool Update(Equipment equipment) { using (EquipmentsEntities context = new EquipmentsEntities()) { try { int id = Convert.ToInt32(equipment.Id); var equip = context.Equip.SingleOrDefault(e => e.Id == id); equip.EuqipName = equipment.Name; equip.EuqipTitle = equipment.Title; equip.EquipPrice = equipment.Price; equip.EquipSerialNumber = equipment.SerialNumber; equip.EuqipPartNumber = equipment.PartNumber; equip.ManufacturesId = equipment.ManId; equip.DeptsId = equipment.DepId; equip.DateIn = equipment.DateIn; context.SaveChangesAsync(); return(true); } catch (Exception ex) { return(false); } } }
public ReturnDto NotebooksUpdate(string NotebooksCode, string Users, string Vendor, string SerialNum, string PcName, string WifiMac, string EthMac, string OperationSystem, string Specification, string WindowsCdkey, string SSD, string SSDSerial, DateTime PurchaseDate, string InvoiceNumber, string OldUser) { try { using (EquipmentsEntities data = new EquipmentsEntities()) { var m = data.TB_Notebooks.Where(p => p.UserCode == NotebooksCode).FirstOrDefault(); m.EthMac = EthMac; m.InvoiceNumber = InvoiceNumber; m.OldUser = OldUser; m.OperationSystem = OperationSystem; m.PcName = PcName; m.PurchaseDate = PurchaseDate; m.SerialNum = SerialNum; m.Specification = Specification; m.SSD = SSD; m.SSDSerial = SSDSerial; m.Users = Users; m.Vendor = Vendor; m.WifiMac = WifiMac; m.WindowsCdKey = WindowsCdkey; data.SaveChanges(); } return(new ReturnDto(true, ReturnDto.Success)); } catch (Exception) { return(new ReturnDto(false, ReturnDto.Failed)); } }
public ActionResult Monitors(MonitorModel model) { int pageIndex = model.Page ?? 1; using (EquipmentsEntities data = new EquipmentsEntities()) { model.MonitorSearch = (from c in data.TB_Monitors.Where(p => p.KayitDurum == "Active" && (String.IsNullOrEmpty(model.Users) || p.Users.Contains(model.Users)) && (String.IsNullOrEmpty(model.SerialNumber) || p.SerialNumber.Contains(model.SerialNumber))).OrderByDescending(p => p.ID) select new MonitorListModel { BasicFeatures = c.BrandFeatures, Brand = c.Brand, Demirbas = c.Demirbas, InvoiceNumber = c.InvoiceNumber, OldUser = c.OldUser, Place = c.Place, PurchaseDate = c.PurchaseDate, SerialNumber = c.SerialNumber, Status = c.Status, UserCode = c.UserCode, Users = c.Users }).ToPagedList(pageIndex, 15); if (Request.IsAjaxRequest()) { return(PartialView("_Monitor", model)); } else { return(View(model)); } } }
// GET: Equipment public ActionResult Notebooks() { using (EquipmentsEntities data = new EquipmentsEntities()) { ViewBag.notebookList = (from c in data.TB_Notebooks where c.KayitDurum == "Active" select c).ToList(); } return(View()); }
public ActionResult Vınn() { using (EquipmentsEntities data = new EquipmentsEntities()) { ViewBag.vin = (from c in data.TB_VINN where c.KayitDurum == "Active" select c).ToList(); } return(View()); }
public ActionResult Mobile() { using (EquipmentsEntities data = new EquipmentsEntities()) { ViewBag.Mobile = (from c in data.TB_Mobile where c.KayitDurumu == "Active" select c).ToList(); } return(View()); }
public ActionResult Software() { using (EquipmentsEntities data = new EquipmentsEntities()) { ViewBag.Software = (from c in data.TB_Software where c.KayitDurum == "Active" select c).ToList(); } return(View()); }
public ReturnDto NotebooksAdd(string Users, string Vendor, string SerialNum, string PcName, string WifiMac, string EthMac, string OperationSystem, string Specification, string WindowsCdkey, string SSD, string SSDSerial, DateTime PurchaseDate, string InvoiceNumber, string OldUser) { try { using (EquipmentsEntities data = new EquipmentsEntities()) { var t = data.TB_Notebooks.Where(p => p.SerialNum == SerialNum).Select(p => p.SerialNum).FirstOrDefault(); var t1 = data.TB_Notebooks.Where(p => p.EthMac == EthMac).Select(p => p.EthMac).FirstOrDefault(); var t2 = data.TB_Notebooks.Where(p => p.WifiMac == WifiMac).Select(p => p.WifiMac).FirstOrDefault(); if (SerialNum == t) { return(new ReturnDto(false, ReturnDto.SerialError)); } if (WifiMac == t2) { return(new ReturnDto(false, ReturnDto.WifiErro)); } if (EthMac == t1) { return(new ReturnDto(false, ReturnDto.EthMac)); } string kod; int max_id = data.TB_Notebooks.Max(p => p.ID); kod = "Mv-" + max_id; TB_Notebooks m = new TB_Notebooks(); m.EthMac = EthMac; m.InvoiceNumber = InvoiceNumber; m.KayıtTarihi = DateTime.Now; m.OldUser = OldUser; m.OperationSystem = OperationSystem; m.PcName = PcName; m.PurchaseDate = PurchaseDate; m.SerialNum = SerialNum; m.Specification = Specification; m.SSD = SSD; m.SSDSerial = SSDSerial; m.UserCode = kod; m.Users = Users; m.Vendor = Vendor; m.WifiMac = WifiMac; m.KayitDurum = "Active"; m.WindowsCdKey = WindowsCdkey; data.TB_Notebooks.Add(m); data.SaveChanges(); } return(new ReturnDto(true, ReturnDto.Success)); } catch (Exception) { return(new ReturnDto(false, ReturnDto.Failed)); } }
public ActionResult Printers() { using (EquipmentsEntities data = new EquipmentsEntities()) { ViewBag.Printers = (from c in data.TB_Printers where c.KayitDurum == "Active" select c).ToList(); } return(View()); }
/// <summary> /// GET Manufacturers method /// </summary> /// <returns></returns> public static List <Manufact> GetAll() { using (EquipmentsEntities context = new EquipmentsEntities()) { return(context.Manufactures.Select(m => new Manufact { Id = m.Id, Name = m.ManufName }).ToList()); } }
/// <summary> /// GET all Departments items method /// </summary> /// <returns> /// list of Departments items from DB /// </returns> public static List <Depart> GetAll() { using (EquipmentsEntities context = new EquipmentsEntities()) { return(context.Depts.Select(d => new Depart { Id = d.Id, Name = d.DeptName }).ToList()); } }
/// <summary> /// Filtering equipments method by Department name /// </summary> /// <param name="dept"></param> /// <returns> /// List of equipments /// </returns> public static List <EquipView> GetByDept(string dept) { using (EquipmentsEntities context = new EquipmentsEntities()) { var listEquips = context.Equip.Join(context.Depts, e => e.DeptsId, d => d.Id, (e, d) => new { Name = e.EuqipName, DeptsName = d.DeptName, Title = e.EuqipTitle, e.ManufacturesId, e.EquipPrice, e.DateIn, e.EquipSerialNumber, e.EuqipPartNumber, e.Id }).Join(context.Manufactures, e => e.ManufacturesId, m => m.Id, (e, m) => new EquipView { Name = e.Name, DeptsName = e.DeptsName, Title = e.Title, ManufName = m.ManufName, Price = e.EquipPrice, DateIn = e.DateIn, PNumber = e.EuqipPartNumber, SNumber = e.EquipSerialNumber, Id = e.Id }).ToList(); List <EquipView> newListEq = new List <EquipView>(); foreach (var e in listEquips) { var str = e.DeptsName; str = str.Replace(" ", ""); if (str == dept) { newListEq.Add(new EquipView { Name = e.Name, Id = e.Id, Title = e.Title, DateIn = e.DateIn, DeptsName = e.DeptsName, ManufName = e.ManufName, PNumber = e.PNumber, SNumber = e.SNumber, Price = e.Price }); } } return(newListEq); } }
/// <summary> /// GET Manufacturer method by Id /// </summary> /// <param name="id"></param> /// <returns> /// Manufacturer model /// </returns> public static Manufact GetItem(string id) { using (EquipmentsEntities context = new EquipmentsEntities()) { int nId = Convert.ToInt32(id); return(context.Manufactures.Where(m => m.Id == nId).Select(m => new Manufact { Id = m.Id, Name = m.ManufName }).FirstOrDefault()); } }
/// <summary> /// GET Department by Id method /// </summary> /// <param name="id"></param> /// <returns> /// Department model /// </returns> public static Depart GetItem(string id) { using (EquipmentsEntities context = new EquipmentsEntities()) { int nId = Convert.ToInt32(id); return(context.Depts.Where(d => d.Id == nId).Select(d => new Depart { Id = d.Id, Name = d.DeptName }).FirstOrDefault()); } }
/// <summary> /// GET Equipment item by Id /// </summary> /// <param name="id"></param> /// <returns> /// Equipment model with connecting data /// </returns> public static EquipView GetItem(string id) { using (EquipmentsEntities context = new EquipmentsEntities()) { int nId = Convert.ToInt32(id); var listEquips = context.Equip.Join(context.Depts, e => e.DeptsId, d => d.Id, (e, d) => new { Name = e.EuqipName, DeptsName = d.DeptName, Title = e.EuqipTitle, e.ManufacturesId, e.EquipPrice, e.DateIn, e.EquipSerialNumber, e.EuqipPartNumber, e.Id }).Join(context.Manufactures, e => e.ManufacturesId, m => m.Id, (e, m) => new EquipView { Name = e.Name, DeptsName = e.DeptsName, Title = e.Title, ManufName = m.ManufName, Price = e.EquipPrice, DateIn = e.DateIn, PNumber = e.EuqipPartNumber, SNumber = e.EquipSerialNumber, Id = e.Id }).ToList(); foreach (var e in listEquips) { if (e.Id == nId) { return new EquipView { Name = e.Name, Id = e.Id, Title = e.Title, DateIn = e.DateIn, DeptsName = e.DeptsName, ManufName = e.ManufName, PNumber = e.PNumber, SNumber = e.SNumber, Price = e.Price } } ; } return(null); } }
public ReturnDto VınnAdd(string Users, string Operator, string IMEI, string SerialNumber, string DeviceName, string SımCardNo, string PIN1, string PIN2, string PUK1, string PUK2, string Special, string Status, DateTime PurchaseDate, string Olduser) { try { using (EquipmentsEntities data = new EquipmentsEntities()) { var t = data.TB_VINN.Where(p => p.SerialNumber == SerialNumber).Select(p => p.SerialNumber).FirstOrDefault(); if (SerialNumber == t) { return(new ReturnDto(false, ReturnDto.SerialError)); } else { string kod; int max_id = data.TB_VINN.Max(p => p.ID); kod = "Mt-" + max_id; TB_VINN m = new TB_VINN(); m.UserCode = kod; m.Users = Users; m.Operator = Operator; m.SerialNumber = SerialNumber; m.IMEI = IMEI; m.DeviceName = DeviceName; m.SımCardNo = SımCardNo; m.PIN1 = PIN1; m.PIN2 = PIN2; m.PUK1 = PUK1; m.PUK2 = PUK2; m.Special = Special; m.Status = Status; m.PurchaseDate = PurchaseDate; m.OldUser = Olduser; m.KayitDurum = "Active"; data.TB_VINN.Add(m); data.SaveChanges(); } return(new ReturnDto(true, ReturnDto.Success)); } } catch (Exception) { return(new ReturnDto(false, ReturnDto.Failed)); } }