// public ActionResult SaveData() // { // DataTable dt = (DataTable)Session["DataTableModel"]; // if (dt != null) // { // //DataTableBinder binder = new DataTableBinder(); // List<importTable> list = new List<TestProject.Models.importTable>(); //binder.BindDataList<importTable>(dt); // //list= AutoMapper.Mapper.DynamicMap<IDataReader, List<importTable>>(dt.CreateDataReader()); // //BindDataList<Foo>(dt); // importTable acc = null; // foreach (DataRow row in dt.Rows) // { // acc = new importTable(); // //acc.importTableId = Convert.ToInt32(row["importTableId"].ToString()); // //acc.accountBusinessType // acc.importTableId = Convert.ToInt32(row["importTableId"].ToString()); // acc.Id = row["Id"].ToString(); // acc.accountType = row["accountType"].ToString(); // acc.accountSalesRepId = row["accountSalesRepId"].ToString(); // acc.accountSalesRepname = row["accountSalesRepname"].ToString(); // acc.accountTerritory = row["accountTerritory"].ToString(); // acc.accountFrequency = row["accountFrequency"].ToString(); // acc.accountBusinessType = row["accountBusinessType"].ToString(); // acc.accountStatus = row["accountStatus"].ToString(); // acc.accountSource = row["accountSource"].ToString(); // acc.accountNumber = row["accountNumber"].ToString(); // acc.accountTermId = row["accountTermId"].ToString(); // acc.accountTermName = row["accountTermName"].ToString(); // acc.accountTermDays = row["accountTermDays"].ToString(); // acc.accountPaymentTypeId = row["accountPaymentTypeId"].ToString(); // acc.accountPaymentTypeName = row["accountPaymentTypeName"].ToString(); // acc.refNumber = row["refNumber"].ToString(); // acc.companyName = row["companyName"].ToString(); // acc.companyName2 = row["companyName2"].ToString(); // acc.accountContact = row["accountContact"].ToString(); // acc.accountContactTitle = row["accountContactTitle"].ToString(); // acc.accountContactDept = row["accountContactDept"].ToString(); // acc.addressLine = row["addressLine"].ToString(); // acc.addressLine2 = row["addressLine2"].ToString(); // acc.addressLine3 = row["addressLine3"].ToString(); // acc.city = row["city"].ToString(); // acc.state = row["state"].ToString(); // acc.zipCode = row["zipCode"].ToString(); // acc.country = row["country"].ToString(); // acc.longitude = Convert.ToDouble(row["longitude"].ToString()); // acc.latitude = Convert.ToDouble(row["latitude"].ToString()); // acc.mainPhone = row["mainPhone"].ToString(); // acc.fax = row["fax"].ToString(); // acc.mobile = row["mobile"].ToString(); // acc.otherPhone = row["otherPhone"].ToString(); // acc.email = row["email"].ToString(); // acc.emailAlt = row["emailAlt"].ToString(); // acc.website = row["website"].ToString(); // acc.creditLimit = Convert.ToDecimal(row["creditLimit"].ToString()); // acc.balance = Convert.ToDecimal(row["balance"].ToString()); // acc.parentId = row["parentId"].ToString(); // acc.parentAccountNumber = row["parentAccountNumber"].ToString(); // acc.priceLevelId = row["priceLevelId"].ToString(); // acc.priceLevelName = row["priceLevelName"].ToString(); // acc.defaultWarehouse = row["defaultWarehouse"].ToString(); // var tx1 = row["tax1Exempt"]; // string txstr1 = row["tax1Exempt"].ToString(); // acc.tax1Exempt = Convert.ToBoolean(row["tax1Exempt"].ToString().ToLower()); // acc.tax2Exempt = Convert.ToBoolean(row["tax2Exempt"].ToString().ToLower()); // acc.taxCode = row["taxCode"].ToString(); // acc.currency = row["currency"].ToString(); // acc.notes = row["notes"].ToString(); // acc.misc1 = row["misc1"].ToString(); // acc.misc2 = row["misc2"].ToString(); // acc.misc3 = row["misc3"].ToString(); // acc.misc4 = row["misc4"].ToString(); // acc.misc5 = row["misc5"].ToString(); // acc.misc6 = row["misc6"].ToString(); // acc.misc7 = row["misc7"].ToString(); // acc.misc8 = row["misc8"].ToString(); // acc.misc9 = row["misc9"].ToString(); // acc.misc10 = row["misc10"].ToString(); // acc.misc11 = row["misc11"].ToString(); // acc.misc12 = row["misc12"].ToString(); // acc.timeModified = Convert.ToDateTime(row["timeModified"].ToString()); // acc.timeCreated = Convert.ToDateTime(row["timeCreated"].ToString()); // acc.genERPId = Convert.ToInt32(row["genERPId"].ToString()); // acc.impStatusId = Convert.ToInt32(row["impStatusId"].ToString()); // acc.impStatusLog = row["impStatusLog"].ToString(); // acc.active = Convert.ToBoolean(row["active"].ToString().ToLower()); // acc.toDeactivate = Convert.ToBoolean(row["toDeactivate"].ToString()); // acc.accountId = Convert.ToInt32(row["accountId"].ToString()); // acc.tenantId = Convert.ToInt32(row["tenantId"].ToString()); // acc.updatedById = Convert.ToInt32(row["updatedById"].ToString()); // acc.createdById = Convert.ToInt32(row["createdById"].ToString()); // acc.modifyDateTime = Convert.ToDateTime(row["modifyDateTime"].ToString()); // acc.insertDateTime = Convert.ToDateTime(row["insertDateTime"].ToString()); // list.Add(acc); // } // db.importTable.AddRange(list); // db.SaveChanges(); // //Session["DataTableModel"] = null; // } // else // { // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); // } // return View(); // } public ActionResult chooseFields() { DataTable dt = (DataTable)Session["DataTableModel"]; // List<string> columnas = new List<string>(); List <SelectListItem> columns = new List <SelectListItem>(); //{ // new SelectListItem { Text = "Homeowner", Value = ((int)UserType.Homeowner).ToString()}, // new SelectListItem { Text = "Contractor", Value = ((int)UserType.Contractor).ToString()}, //}; Type tipo = typeof(importTable); List <string> requeridos = new List <string>(new string[] { "genERPId", "impStatusId", "tenantId", "createdById", "insertDateTime" }); FieldListVM fields = new FieldListVM(); fields.fieldList = new List <FieldsVM>(); List <PropertyInfo> requiredList = new List <PropertyInfo>(tipo.GetProperties().Where( prop => Attribute.IsDefined( prop, typeof(RequiredAttribute) ))); //foreach (var prop in tipo.GetProperties()) //{ // FieldsVM field = new FieldsVM(); // field.field = prop.Name; // field.column = prop.Name; // fields.fieldList.Add(field); // props[].Name; //} var propNames = tipo.GetProperties(); for (int i = 0; i < tipo.GetProperties().Count(); i++) { FieldsVM field = new FieldsVM(); field.field = propNames[i].Name; field.column = ""; field.required = requeridos.Contains(propNames[i].Name); fields.fieldList.Add(field); } columns.Add(new SelectListItem { Text = "-- None --", Value = "" }); foreach (DataColumn c in dt.Columns) { columns.Add(new SelectListItem { Text = c.ColumnName, Value = c.ColumnName }); } fields.fileColumns = columns; ViewBag.columnList = new SelectList(columns, "Value", "Text"); return(View(fields)); }
private void UpdateField(string[] fieldValues, int index, FloorStatus floorStatus) { FieldsVM.ElementAt(index).BackgroundPath = fieldValues[0]; FieldsVM.ElementAt(index).SkillCastingPath = fieldValues[1]; FieldsVM.ElementAt(index).SkillExecutingPath = fieldValues[2]; FieldsVM.ElementAt(index).PawnImagePath = fieldValues[3]; FieldsVM.ElementAt(index).PawnHP = fieldValues[4]; FieldsVM.ElementAt(index).PawnManna = fieldValues[5]; FieldsVM.ElementAt(index).InfoToolTip = fieldValues[6]; FieldsVM.ElementAt(index).FloorStatus = floorStatus; }