예제 #1
0
 public String Create(WorkshopModel workshopModel)
 {
     using (var connection = new MySqlConnection(Constant.getDatabaseConnectionString()))
     {
         /*
          * FactoryModel factory = connection
          *  .Query<FactoryModel>("SELECT * FROM factory WHERE factoryName=@fn", new
          *  {
          *      fn = workshopModel.Factory
          *  }).FirstOrDefault();
          */
         FactoryModel factory = connection
                                .Query <FactoryModel>("SELECT * FROM factory WHERE factoryName=@fn AND factory.city IN (SELECT city.id FROM city WHERE city.cityName=@cn)", new
         {
             fn = workshopModel.Factory,
             cn = workshopModel.City
         }).FirstOrDefault();
         int rows = connection
                    .Execute(
             "INSERT INTO workshop(workshopName, workshopPhoneNumber, workshopAddress, remark, factory) VALUES (@wn, @wpn, @wa, @r, @f)", new
         {
             wn  = workshopModel.WorkshopName,
             wpn = workshopModel.WorkshopPhoneNumber,
             wa  = workshopModel.WorkshopAddress,
             r   = workshopModel.Remark,
             f   = factory.Id
         });
         return(rows == 1 ? "success" : "error");
     }
 }
예제 #2
0
        public FactorySerializer GetFactoryById(int id)
        {
            FactoryModel      factory = this._factoryDao.GetById(id);
            FactorySerializer result  = new FactorySerializer(factory);

            return(result);
        }
예제 #3
0
        public static void LoadAttribute(List <Assembly> BusinessDll, ModulePlugin mp)
        {
            List <WinformControllerAttributeInfo> cmdControllerList = new List <WinformControllerAttributeInfo>();

            for (int k = 0; k < BusinessDll.Count; k++)
            {
                //System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFrom(BusinessDll[k]);
                System.Reflection.Assembly assembly = BusinessDll[k];
                Type[] types = assembly.GetTypes();
                for (int i = 0; i < types.Length; i++)
                {
                    WinformControllerAttribute[] winC = ((WinformControllerAttribute[])types[i].GetCustomAttributes(typeof(WinformControllerAttribute), true));

                    if (winC.Length > 0)
                    {
                        WinformControllerAttributeInfo cmdC = new WinformControllerAttributeInfo();
                        cmdC.controllerName  = types[i].Name;
                        cmdC.defaultViewName = winC[0].DefaultViewName;
                        //cmdC.winformController = (AbstractController)Activator.CreateInstance(types[i], null);
                        cmdC.winformController = (AbstractController)FactoryModel.GetObject(types[i], mp.database, mp.container, mp.cache, mp.plugin.name, null);
                        cmdC.MethodList        = new List <WinformMethodAttributeInfo>();
                        cmdC.ViewList          = new List <WinformViewAttributeInfo>();

                        MethodInfo[] property = types[i].GetMethods();
                        for (int n = 0; n < property.Length; n++)
                        {
                            WinformMethodAttribute[] WinM = (WinformMethodAttribute[])property[n].GetCustomAttributes(typeof(WinformMethodAttribute), true);
                            if (WinM.Length > 0)
                            {
                                WinformMethodAttributeInfo cmdM = new WinformMethodAttributeInfo();
                                cmdM.methodName = property[n].Name;
                                cmdM.methodInfo = property[n];
                                if (WinM[0].OpenDBKeys != null && WinM[0].OpenDBKeys.ToString().Trim() != "")
                                {
                                    cmdM.dbkeys = WinM[0].OpenDBKeys.Split(new char[] { ',' }).ToList();
                                }
                                cmdC.MethodList.Add(cmdM);
                            }
                        }

                        WinformViewAttribute[] viewAttribute = (WinformViewAttribute[])types[i].GetCustomAttributes(typeof(WinformViewAttribute), true);
                        for (int n = 0; n < viewAttribute.Length; n++)
                        {
                            WinformViewAttributeInfo winView = new WinformViewAttributeInfo();
                            winView.Name          = viewAttribute[n].Name;
                            winView.DllName       = viewAttribute[n].DllName;
                            winView.ViewTypeName  = viewAttribute[n].ViewTypeName;
                            winView.IsDefaultView = winView.Name == cmdC.defaultViewName ? true : false;

                            //Assembly _assembly = Assembly.LoadFrom(winView.DllName);
                            winView.ViewType = assembly.GetType(winView.ViewTypeName, false, true);
                            cmdC.ViewList.Add(winView);
                        }
                        cmdControllerList.Add(cmdC);
                    }
                }
            }

            mp.cache.Add(mp.plugin.name + "@" + GetCacheKey(), cmdControllerList);
        }
예제 #4
0
        /// <summary>
        /// 初始化头部数据
        /// </summary>
        /// <param name="_dtPoints"></param>
        private void InitTop(DataTable _dtPoints)
        {
            int a = _dtPoints.Columns.Count;

            objRl   = bllRl.GetConfigRL();
            drPoits = _dtPoints.Select("T_UNITID='0'");
            object _objDayDl   = bllDl.GetDLAll(strDl, DateTime.Now.ToString("yyyy-MM-dd 0:00:00"), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            object _objMonthDl = bllDl.GetDLAll(strDl, DateTime.Now.ToString("yyyy-MM-1 0:00:00"), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            object _objYearDl  = bllDl.GetDLAll(strDl, DateTime.Now.ToString("yyyy-1-1 0:00:00"), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            string[] _strPoints = new string[1];
            if (drPoits.Length > 0)
            {
                _strPoints[0] = drPoits[0][2].ToString();
            }
            FactoryModel factory = new FactoryModel();
            double       _val    = factory.Power;
            //val = bllPoint.GetPointVal(_strPoints);
            object _obj = new
            {
                rl    = objRl,
                power = _val,
                day   = _objDayDl,
                month = _objMonthDl,
                year  = _objYearDl
            };

            string result = JsonConvert.SerializeObject(_obj);

            Response.Write(result);
            Response.End();
        }
예제 #5
0
        public IHttpActionResult GetMessageByFactoryId(int factoryId, [FromUri] int top = 10, [FromUri] int hours = 168, [FromUri] string order = "desc")
        {
            try
            {
                FactoryModel factoryModel          = new FactoryModel();
                int          companyId             = factoryModel.GetByIdForInternal(factoryId).CompanyId;
                CompanyModel companyModel          = new CompanyModel();
                CompanyModel.Format_Detail company = companyModel.GetById(companyId);

                var companySubscription = companyModel.GetValidSubscriptionPlanByCompanyId(companyId);
                if (companySubscription == null)
                {
                    throw new Exception("can't find valid subscription plan.");
                }

                DocumentDBHelper docDBHelpler = new DocumentDBHelper(companyId, companySubscription.CosmosDBConnectionString);
                return(Ok(docDBHelpler.GetMessageByFactoryId(factoryId, top, hours, order)));
            }
            catch (Exception ex)
            {
                StringBuilder logMessage = LogHelper.BuildExceptionMessage(ex);
                string        logAPI     = "[Get] " + Request.RequestUri.ToString();
                Global._appLogger.Error(logAPI + logMessage);

                return(Content(HttpStatusCode.InternalServerError, ex));
            }
        }
예제 #6
0
    public void addSeats()
    {
        Boolean odd = false;

        for (int i = 0; i < coach.totalNumberSeats; i++)
        {
            if (false == odd)
            {
                if (i < 12)
                {
                    coach.seats.Add(FactoryModel.seatFactory(seatType.firstClassWindow, i, 20.00, false));
                }
                else
                {
                    coach.seats.Add(FactoryModel.seatFactory(seatType.secondClassWindow, i, 10.00, false));
                }
                odd = true;
            }
            else
            {
                if (i < 12)
                {
                    coach.seats.Add(FactoryModel.seatFactory(seatType.firstClassAlis, i, 20.00, false));
                }
                else
                {
                    coach.seats.Add(FactoryModel.seatFactory(seatType.secondClassAlis, i, 10.00, false));
                }
                odd = false;
            }
        }
    }
예제 #7
0
        public IHttpActionResult CreateFactoryFormData([FromBody] FactoryModel.Format_Create factory)
        {
            int companyId = Global.GetCompanyIdFromToken();

            string logForm = "Form : " + JsonConvert.SerializeObject(factory);
            string logAPI  = "[Post] " + Request.RequestUri.ToString();

            if (!ModelState.IsValid || factory == null)
            {
                Global._appLogger.Warn(logAPI + " || Input Parameter not expected || " + logForm);
                return(Content(HttpStatusCode.BadRequest, HttpResponseFormat.InvaildData()));
            }

            FactoryModel factoryModel = new FactoryModel();

            try
            {
                int id = factoryModel.Create(companyId, factory);
                return(Content(HttpStatusCode.OK, HttpResponseFormat.Success(id)));
            }
            catch (CDSException cdsEx)
            {
                return(Content(HttpStatusCode.BadRequest, CDSException.GetCDSErrorMessageByCode(cdsEx.ErrorId)));
            }
            catch (Exception ex)
            {
                StringBuilder logMessage = LogHelper.BuildExceptionMessage(ex);
                logMessage.AppendLine(logForm);
                Global._appLogger.Error(logAPI + logMessage);

                return(Content(HttpStatusCode.InternalServerError, ex));
            }
        }
예제 #8
0
        public static List <T> ToList <T>(DataTable table, AbstractDatabase Db, IUnityContainer container, ICacheManager cache, string pluginName, string unityname)
        {
            Type     type    = typeof(T);
            List <T> objects = new List <T>();
            T        obj     = FactoryModel.GetObject <T>(Db, container, cache, pluginName, unityname);

            if (table != null && table.Rows.Count > 0)
            {
                while (objects.Count < table.Rows.Count)
                {
                    objects.Add((T)((ICloneable)obj).Clone());
                }

                foreach (PropertyInfo property in type.GetProperties())
                {
                    if (table.Columns.IndexOf(property.Name) >= 0)
                    {
                        for (int index = 0; index < table.Rows.Count; index++)
                        {
                            object val = table.Rows[index][property.Name];
                            if (val == System.DBNull.Value)
                            {
                                val = null;
                            }
                            property.SetValue((object)objects[index], val, null);
                        }
                    }
                }
            }
            return(objects);
        }
예제 #9
0
        public List <object> GetDeviceTree(String city, String factory)
        {
            using (var connection = new SqlConnection(Constant.getDatabaseConnectionString()))
            {
                CityModel c = connection.Query <CityModel>("select * from city where cityName=@cn", new { cn = city })
                              .FirstOrDefault();
                FactoryModel fac = connection
                                   .Query <FactoryModel>("select * from factory where factoryName=@fn and city=@cid", new { fn = factory, cid = c.Id })
                                   .FirstOrDefault();
                List <WorkshopModel> workshops =
                    connection.Query <WorkshopModel>("select * from workshop where factory=@fid", new{ fid = fac.Id })
                    .ToList();
                List <object> result = new List <object>();
                foreach (WorkshopModel w in workshops)
                {
                    List <DeviceModel> devices = connection
                                                 .Query <DeviceModel>("select * from device where workshop=@wid", new { wid = w.Id })
                                                 .ToList();
                    List <object> deviceResult = new List <object>();
                    foreach (DeviceModel d in devices)
                    {
                        deviceResult.Add(new { label = d.DeviceName, id = d.Id });
                    }
                    result.Add(new { label = w.WorkshopName, children = deviceResult });
                }

                return(result);
            }
        }
예제 #10
0
 public void addCoach(coachType type)
 {
     coach             = FactoryModel.coachFactory(type, null, null, false);
     coach.coachNumber = count;
     addSeats();
     coaches.Add(coach);
     count++;
 }
        // GET: Factories/Edit/5
        public ActionResult Edit(int id)
        {
            FactoryModel model = factoryService.GetById(id);

            if (model == null)
            {
                return(HttpNotFound());
            }
            return(View(model));
        }
 public ActionResult Edit(FactoryModel model)
 {
     if (ModelState.IsValid)
     {
         factoryService.Update(model);
         factoryService.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
예제 #13
0
        public String CreateNewFactory(FactorySerializer factorySerializer)
        {
            FactoryModel factoryModel = new FactoryModel();

            factoryModel.FactoryName        = factorySerializer.factoryName;
            factoryModel.FactoryPhoneNumber = factorySerializer.factoryPhoneNumber;
            factoryModel.FactoryAddress     = factorySerializer.factoryAddress;
            factoryModel.Remark             = factorySerializer.remark;
            factoryModel.City = factorySerializer.city;
            return(this._factoryDao.Create(factoryModel));
        }
예제 #14
0
 public static bool SetGlobalRenderState_Prefix(FactoryModel __instance)
 {
     if (GameMain.mainPlayer == null && GameMain.data == null)
     {
         // GameMain.data is destroyed while loading into the game, but we had the planets factory loaded in galaxy select when selecting a custom birth planet.
         // thus unload the data here to prevent nre spam.
         __instance.planet.UnloadFactory();
         return(false);
     }
     return(true);
 }
예제 #15
0
 public String Update(int id, DeviceModel deviceModel)
 {
     using (var connection = new SqlConnection(Constant.getDatabaseConnectionString()))
     {
         CityModel city = connection.Query <CityModel>(
             "SELECT * FROM city WHERE city.cityName=@cn", new
         {
             cn = deviceModel.City
         }).FirstOrDefault();
         FactoryModel factory = connection.Query <FactoryModel>(
             "SELECT * FROM factory WHERE factory.factoryName=@fn", new
         {
             fn = deviceModel.Factory
         }).FirstOrDefault();
         WorkshopModel workshop = connection.Query <WorkshopModel>(
             "SELECT * FROM workshop WHERE workshop.workshopName=@wn", new
         {
             wn = deviceModel.Workshop
         }).FirstOrDefault();
         int rows = connection
                    .Execute(
             "UPDATE device " +
             "SET hardwareDeviceID=@hdid, " +
             "deviceName=@dn, " +
             "city=@c, " +
             "factory=@f, " +
             "workshop=@w, " +
             "deviceState=@ds, " +
             "imageUrl=@iu, " +
             "gatewayId=@gid, " +
             "mac=@m, " +
             "deviceType=@dt, " +
             "remark=@r, " +
             "updateTime=CURRENT_TIMESTAMP " +
             "WHERE device.id=@deviceId",
             new
         {
             deviceId = deviceModel.Id,
             hdid     = deviceModel.HardwareDeviceId,
             dn       = deviceModel.DeviceName,
             c        = city.Id,
             f        = factory.Id,
             w        = workshop.Id,
             ds       = deviceModel.DeviceState,
             iu       = deviceModel.ImageUrl,
             gid      = deviceModel.GatewayId,
             m        = deviceModel.Mac,
             dt       = deviceModel.DeviceType,
             r        = deviceModel.Remark
         });
         return(rows == 1 ? "success" : "error");
     }
 }
예제 #16
0
        public String UpdateFactory(int id, FactorySerializer factorySerializer)
        {
            FactoryModel factoryModel = new FactoryModel();

            factoryModel.Id                 = factorySerializer.id;
            factoryModel.FactoryName        = factorySerializer.factoryName;
            factoryModel.FactoryPhoneNumber = factorySerializer.factoryPhoneNumber;
            factoryModel.FactoryAddress     = factorySerializer.factoryAddress;
            factoryModel.Remark             = factorySerializer.remark;
            factoryModel.City               = factorySerializer.city;
            return(this._factoryDao.Update(id, factoryModel));
        }
예제 #17
0
 public List <WorkshopModel> GetAffiliateWorkshop(String fName)
 {
     using (var connection = new SqlConnection(Constant.getDatabaseConnectionString()))
     {
         FactoryModel factory = connection
                                .Query <FactoryModel>("select * from factory where factoryName=@fn", new { fn = fName })
                                .FirstOrDefault();
         int factoryId = factory.Id;
         List <WorkshopModel> workshops = connection
                                          .Query <WorkshopModel>("select * from workshop where factory=@fid", new { fid = factoryId }).ToList();
         return(workshops);
     }
 }
 public FactorySerializer(FactoryModel factoryModel)
 {
     this.id                 = factoryModel.Id;
     this.factoryName        = factoryModel.FactoryName;
     this.factoryPhoneNumber = factoryModel.FactoryPhoneNumber;
     this.factoryAddress     = factoryModel.FactoryAddress;
     this.remark             = factoryModel.Remark;
     this.createTime         = factoryModel.CreateTime
                               .ToString(Constant.getDateFormatString());
     this.updateTime = factoryModel.UpdateTime
                       .ToString(Constant.getDateFormatString());
     this.city = factoryModel.City;
 }
예제 #19
0
 public void Factory()
 {
     SelectedBuilding     = BuiltObject.CreatePrototype("Factory", 3, 2, 2, 50, 5);
     BuildingPreview      = new GameObject();
     BuildingPreview.name = "BuildingPreviewObject";
     BuildingPreview.AddComponent <MeshFilter>();
     BuildingPreview.AddComponent <MeshRenderer>();
     BuildingPreview.transform.localScale = FactoryModel.transform.localScale;
     BuildingPreview.GetComponent <MeshFilter>().sharedMesh        = FactoryModel.GetComponent <MeshFilter>().sharedMesh;
     BuildingPreview.GetComponent <MeshRenderer>().sharedMaterials = FactoryModel.GetComponent <MeshRenderer>().sharedMaterials;
     BuildingPreview.AddComponent <MeshCollider>();
     BuildingPreview.AddComponent <Factory>();
 }
예제 #20
0
        public override List <string> DatabaseContextFactoryUsings(FactoryModel data)
        {
            var usings = new List <string>
            {
                "Microsoft.EntityFrameworkCore.Design"
            };

            if (Settings.IncludeCodeGeneratedAttribute)
            {
                usings.Add("System.CodeDom.Compiler");
            }
            return(usings);
        }
예제 #21
0
        static void oth5(FactoryModel __instance)
        {
            var _this      = __instance;
            var entityData = _this.gpuiManager.objectRenderers;

            if (!_this.disableFactoryEntities)
            {
                SetShowModelData(entityData);
            }
            _this.disableCargos          = showItemT[0];
            _this.disableTraffics        = showItemT[1];
            _this.disableLogisticDrones  = showItemT[2];
            _this.disableFactoryEntities = showItemT[3];
        }
예제 #22
0
        public override List <string> DatabaseContextFactoryUsings(FactoryModel data)
        {
            var usings = new List <string>
            {
                "System",
                "System.Data.Entity.Infrastructure"
            };

            if (Settings.IncludeCodeGeneratedAttribute)
            {
                usings.Add("System.CodeDom.Compiler");
            }
            return(usings);
        }
예제 #23
0
 public String Create(DeviceModel deviceModel)
 {
     using (var connection = new MySqlConnection(Constant.getDatabaseConnectionString()))
     {
         CityModel city = connection.Query <CityModel>(
             "SELECT * FROM city WHERE city.cityName=@cn", new
         {
             cn = deviceModel.City
         }).FirstOrDefault();
         FactoryModel factory = connection.Query <FactoryModel>(
             "SELECT * FROM factory WHERE factory.factoryName=@fn", new
         {
             fn = deviceModel.Factory
         }).FirstOrDefault();
         WorkshopModel workshop = connection.Query <WorkshopModel>(
             "SELECT * FROM workshop WHERE workshop.workshopName=@wn", new
         {
             wn = deviceModel.Workshop
         }).FirstOrDefault();
         GatewayModel gateway = connection.Query <GatewayModel>("select * from gateway where gatewayName=@gn",
                                                                new { gn = deviceModel.GatewayId }).FirstOrDefault();
         int deviceType = connection.Query <int>(
             "select id from config where configTag=@ct and configValue=@cv", new
         {
             ct = "deviceType",
             cv = deviceModel.DeviceType
         }).FirstOrDefault();
         int rows = connection.Execute(
             "INSERT INTO " +
             "device(hardwareDeviceID, deviceName, city, factory, workshop, deviceState, imageUrl, gatewayId, mac, deviceType, remark)" +
             " VALUES (@hdid, @dn, @c, @f, @w, @ds, @iu, @gid, @m, @dt, @r)", new
         {
             hdid = deviceModel.HardwareDeviceId,
             dn   = deviceModel.DeviceName,
             c    = city.Id,
             f    = factory.Id,
             w    = workshop.Id,
             ds   = deviceModel.DeviceState,
             iu   = deviceModel.ImageUrl,
             gid  = gateway.Id,
             m    = deviceModel.Mac,
             dt   = deviceType,
             r    = deviceModel.Remark
         });
         return(rows == 1 ? "success" : "error");
     }
 }
예제 #24
0
 public IHttpActionResult GetFactoryById(int factoryId)
 {
     try
     {
         FactoryModel model = new FactoryModel();
         //RedisCacheHelper.SetKeyValue(cacheKey, JsonConvert.SerializeObject(company));
         return(Content(HttpStatusCode.OK, model.External_GetById(factoryId, UserToken.CompanyId)));
     }
     catch (CDSException cdsEx)
     {
         return(Content(HttpStatusCode.BadRequest, CDSException.GetCDSErrorMessageByCode(cdsEx.ErrorId)));
     }
     catch (Exception ex)
     {
         return(Content(HttpStatusCode.InternalServerError, ex));
     }
 }
예제 #25
0
        public async Task PostSuccess(string factoryName, string factoryPhoneNumber, string factoryAddress, string remark, string city)
        {
            var data = new FactoryModel
            {
                FactoryName        = factoryName,
                FactoryPhoneNumber = factoryPhoneNumber,
                FactoryAddress     = factoryAddress,
                Remark             = remark,
                City = city
            };
            var content  = new StringContent(data.ToJson(), Encoding.UTF8, "text/json");
            var response = await this._httpClient.PostAsync("api/factory", content);

            var result = response.Content.ReadAsStringAsync().Result;

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            Assert.Contains("\"c\":200,\"m\":\"success\",\"d\":\"success\"", result);
        }
예제 #26
0
        public IHttpActionResult GetFactoryById(int id)
        {
            FactoryModel factoryModel = new FactoryModel();

            try
            {
                FactoryModel.Format_Detail factory = factoryModel.GetById(id);
                return(Content(HttpStatusCode.OK, factory));
            }
            catch (CDSException cdsEx)
            {
                return(Content(HttpStatusCode.BadRequest, CDSException.GetCDSErrorMessageByCode(cdsEx.ErrorId)));
            }
            catch (Exception ex)
            {
                return(Content(HttpStatusCode.InternalServerError, ex));
            }
        }
예제 #27
0
        public IHttpActionResult GetAllFactoryByCompanyId()
        {
            FactoryModel factoryModel = new FactoryModel();

            try
            {
                int companyId = Global.GetCompanyIdFromToken();
                List <FactoryModel.Format_Detail> factoryList = factoryModel.GetAllByCompanyId(companyId);
                return(Content(HttpStatusCode.OK, factoryList));
            }
            catch (CDSException cdsEx)
            {
                return(Content(HttpStatusCode.BadRequest, CDSException.GetCDSErrorMessageByCode(cdsEx.ErrorId)));
            }
            catch (Exception ex)
            {
                return(Content(HttpStatusCode.InternalServerError, ex));
            }
        }
예제 #28
0
        public CodeOutput GenerateFactory()
        {
            if (!CanWriteFactory())
            {
                return(null);
            }

            var data = new FactoryModel
            {
                classModifier = Settings.DbContextClassModifiers,
                contextName   = Settings.DbContextName
            };

            var co = new CodeOutput(Settings.DbContextName + "Factory" + Settings.FileExtension, "Database context factory", GlobalUsings);

            co.AddUsings(Template.DatabaseContextFactoryUsings(data));
            co.AddCode(Template.Transform(Template.DatabaseContextFactory(), data));
            return(co);
        }
예제 #29
0
        public static T ToObject <T>(DataTable dt, int Rowindex, AbstractDatabase Db, IUnityContainer container, ICacheManager cache, string pluginName, string unityname)
        {
            T obj = FactoryModel.GetObject <T>(Db, container, cache, pluginName, unityname);

            if (Rowindex >= dt.Rows.Count)
            {
                return(obj);
            }
            //列名
            string columnName;
            //属性名
            string propertyName;
            //列数量
            int column = dt.Columns.Count;
            //属性数量
            int propertyNum = obj.GetType().GetProperties().Length;

            //遍历所有列
            for (int i = 0; i < column; i++)
            {
                //遍历所有属性
                for (int j = 0; j < propertyNum; j++)
                {
                    columnName   = dt.Columns[i].ColumnName.ToUpper();
                    propertyName = obj.GetType().GetProperties()[j].Name.ToUpper();
                    if (columnName == propertyName)
                    {
                        string fullName    = dt.Rows[Rowindex][columnName].GetType().FullName;
                        object objectValue = dt.Rows[Rowindex][i];
                        //如果datatable中的对应项是空类型
                        if (fullName == "System.DBNull")
                        {
                            obj.GetType().GetProperties()[j].SetValue(obj, null, null);
                        }
                        else
                        {
                            obj.GetType().GetProperties()[j].SetValue(obj, objectValue, null);
                        }
                    }
                }
            }
            return(obj);
        }
        public ActionResult Create(FactoryModel model)
        {
            if (ModelState.IsValid)
            {
                factoryService.Add(model);
                factoryService.SaveChanges();
                //var list = new SelectList(new List<SelectListItem>
                //{
                //     new SelectListItem { Selected = true, Text = model.Name.ToString(), Value =model.Id.ToString()},

                //});
                var model2 = factoryService.GetQuery(q => q.Name == model.Name).FirstOrDefault();
                TempData["FabrikaId"] = model2.Id;
                TempData.Keep(key: "FabrikaId");
                return(RedirectToAction("YeniKayit", "Account"));
            }

            return(View(model));
        }
예제 #31
0
		public static DominDriveDesignModel GetDominDriveDesignModel(FactoryModel element)
		{
			return DslModeling::DomainRoleInfo.GetLinkedElement(element, FactoryModelDomainRoleId) as DominDriveDesignModel;
		}
예제 #32
0
 public FactoryViewModel()
 {
     FactoryModel = new FactoryModel();
 }
예제 #33
0
		/// <summary>
		/// Constructor
		/// Creates a DominDriveDesignModelHasFactoryModels link in the same Partition as the given DominDriveDesignModel
		/// </summary>
		/// <param name="source">DominDriveDesignModel to use as the source of the relationship.</param>
		/// <param name="target">FactoryModel to use as the target of the relationship.</param>
		public DominDriveDesignModelHasFactoryModels(DominDriveDesignModel source, FactoryModel target)
			: base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(DominDriveDesignModelHasFactoryModels.DominDriveDesignModelDomainRoleId, source), new DslModeling::RoleAssignment(DominDriveDesignModelHasFactoryModels.FactoryModelDomainRoleId, target)}, null)
		{
		}
예제 #34
0
		public static void SetDominDriveDesignModel(FactoryModel element, DominDriveDesignModel newDominDriveDesignModel)
		{
			DslModeling::DomainRoleInfo.SetLinkedElement(element, FactoryModelDomainRoleId, newDominDriveDesignModel);
		}