예제 #1
0
        public ActionResult Add(ServiceEquipment model)
        {
            var user = CurrentUser;

            using (var db = new MbContext())
            {
                var serviceEquipment =
                    db.ServiceEquipment.FirstOrDefault(
                        x => x.EquipmentId == model.EquipmentId && x.ServiceCompanyId == model.ServiceCompanyId);
                if (serviceEquipment == null)
                {
                    model = new ServiceEquipment()
                    {
                        EquipmentId      = model.EquipmentId,
                        ServiceCompanyId = model.ServiceCompanyId,
                        SortField        = 0,
                        CreateTime       = DateTime.Now,
                        CreateUserId     = user.UserId
                    };
                }
                if (ServiceEquipmentSvr.Instance.Save(model) > 0)
                {
                    return(Content("<script>alert('操作成功');window.location.href='/QRCode/ServiceCompanyBind'</script>"));
                }
                return(Content("<script>alert('操作失败');window.location.href='/QRCode/ServiceCompanyBind'</script>"));
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            //Equipment equipment = new Equipment();
            //equipment.Name = "Computer";
            //equipment.Model = "Apple";
            //equipment.Price = 3000;
            //equipment.IssueDate = DateTime.Now;
            //equipment.Garantee = 3;

            ServiceEquipment seq = new ServiceEquipment();

            //seq.RegisterError(PrintMessage);
            seq.DBName = @"\\sd\City\SDP-181\Задание 03\Account.DB";
            //seq.RegisterMessage(PrintMessage);
            //seq.AddEquipment(equipment);

            SoftWare softWare = new SoftWare();

            softWare.Price         = 100;
            softWare.SoftwareTypes = SoftwareTypes.free;
            softWare.InstalDate    = DateTime.Now;
            if (seq.SearchEquipment("Computer") != null)
            {
                softWare.Equipment = seq.SearchEquipment("Computer")[0];
            }
            ServiceSoftware ss = new ServiceSoftware();

            ss.DBName = @"\\sd\City\SDP-181\Задание 03\Account.DB";
            ss.RegisterError(PrintMessage);
            ss.RegisterMessage(PrintMessage);
            ss.AddSoftware(softWare);
        }
예제 #3
0
        static void Main(string[] args)
        {
            ServiceEquipment service = new ServiceEquipment();

            string data = "";

            service.GetData <string, int>(data);



            #region
            Equipment equipment = new Equipment();
            equipment.Name      = "Computer";
            equipment.Model     = "Apple";
            equipment.Price     = 3000;
            equipment.IssueDate = DateTime.Now;
            equipment.Garantee  = 3;

            LiteDbEntity <Equipment> db_e =
                new LiteDbEntity <Equipment>(@"\\sd\City\SDP-181\Задание 03\Account.DB");

            if (db_e.obj == null)
            {
                System.Console.WriteLine("obj == null");
            }

            db_e.Add(equipment);
            #endregion


            SoftWare softWare = new SoftWare();
            softWare.Price         = 100;
            softWare.SoftwareTypes = SoftwareTypes.free;
            softWare.InstalDate    = DateTime.Now;
            //if(seq.SearchEquipment("Computer")!=null)
            //    softWare.Equipment = seq.SearchEquipment("Computer")[0];

            LiteDbEntity <SoftWare> db_s = new LiteDbEntity <SoftWare>(@"\\sd\City\SDP-181\Задание 03\Account.DB");
            db_s.Add(softWare);
        }