public static ListDataRow readRow(DataTable tb, DataSourceSchema dsSchema, DataRow dRow) { List <DataListColumn> fColumns = EUGridUtils.getColumns(dsSchema.Fields); ListDataRow row = new ListDataRow(); foreach (DataListColumn dcol in fColumns) // foreach (FieldSchema fldSchema in _schema.Fields) //foreach (DataColumn col in tb.Columns) { string fName = dcol.field; if (fName.StartsWith(XSqlBuilder.OLD_VERSION_PIX)) { fName = fName.Remove(0, XSqlBuilder.OLD_VERSION_PIX.Length); } if (!dsSchema.Fields.ContainsId(fName)) { row.Add("ck", "false"); continue; } FieldSchema fldSchema = dsSchema.Fields.GetItem(fName); if (fldSchema.DataType == DbType.Binary) { continue; } DataColumn col = tb.Columns[fName]; // if (!string.IsNullOrEmpty(fldSchema.Alias)) // fName = fldSchema.Alias; //if (col == null) // throw new Exception(string.Format(Lang.FieldNotFind, fName)); string value = ""; if (col != null) { value = GetCellString(fldSchema, col, dRow); } row.Add(dcol.field, value); // if (tb.PrimaryKey.Contains(col)) // { // row.Add(dcol, value); //row.Pk.Add(fName, value); // } } return(row); }
public void form() { ListDataRow row = new ListDataRow(); foreach (string fld in this.Request.Form.AllKeys) { row.Add(fld, Request.Form[fld]); } for (int i = 0; i < Request.Files.AllKeys.Length; i++) { string fld = Request.Files.AllKeys[i]; HttpPostedFile file = Request.Files[i]; List <string> updatedFields = new List <string>(); if (file != null && file.ContentLength > 0) { string recFolder = getRecordFolder(fld, row); string fileName = Path.GetFileName(file.FileName); fileName = recFolder + fileName; file.SaveAs(fileName); if (fld.StartsWith("file_")) { fld = fld.Remove(0, 5); } if (!updatedFields.Contains(fld)) { row[fld] = TextType.img + getFileUrl(fileName); } } } update(row); }