Esempio n. 1
0
 protected void grid_BatchEditCommand(object sender, GridBatchEditingEventArgs e)
 {
     var gid = Guid.Parse(combo.SelectedValue);
     var id = combo.SelectedValue.ToUpper();
     using (IStorageEngine engine = STSdb.FromFile(Server.MapPath(string.Format("App_Data/Housing_{0}.record", id))))
     {
         var table = engine.OpenXTablePortable<HousingKey, HousingValue>("Record");
         foreach (var command in e.Commands)
         {
             var values = command.NewValues;
             var key = new HousingKey { 学校 = gid, 姓名 = values["姓名"].V(), 住址 = values["住址"].V(), 入学年份 = values["入学年份"].V(), 户籍 = values["户籍"].V(), 身份证号 = values["身份证号"].V() };
             var value = new HousingValue { 班号 = values["班号"].V(), 备注 = values["备注"].V(), 时间 = DateTime.Now };
             switch (command.Type)
             {
                 case GridBatchEditingCommandType.Insert:
                     {
                         table[key] = value;
                         engine.Commit();
                         break;
                     }
                 case GridBatchEditingCommandType.Update:
                     {
                         var old = command.OldValues;
                         var okey = new HousingKey { 学校 = gid, 姓名 = old["姓名"].V(), 住址 = old["住址"].V(), 入学年份 = old["入学年份"].V(), 户籍 = old["户籍"].V(), 身份证号 = old["身份证号"].V() };
                         table.Delete(okey);
                         table[key] = value;
                         engine.Commit();
                         break;
                     }
                 case GridBatchEditingCommandType.Delete:
                     {
                         table.Delete(key);
                         engine.Commit();
                         break;
                     }
             }
         }
     }
     grid.Rebind();
 }
Esempio n. 2
0
 protected void im_ok_Click(object sender, EventArgs e)
 {
     var book = new Workbook(file.Value);
     var data = book.Worksheets[0].Cells.ExportDataTable(0, 0, book.Worksheets[0].Cells.Rows.Where(o => o[0].Value != null).Count(), 7, false);
     var campusId = Guid.Parse(Request.QueryString["CampusId"]);
     using (IStorageEngine engine = STSdb.FromFile(Server.MapPath(string.Format("App_Data/Housing_{0}.record", campusId))))
     {
         var table = engine.OpenXTablePortable<HousingKey, HousingValue>("Record");
         foreach (DataRow row in data.Rows)
         {
             try
             {
                 var key = new HousingKey { 学校 = campusId, 姓名 = row[0].V(), 住址 = row[4].V(), 入学年份 = row[2].V(), 户籍 = row[3].V(), 身份证号 = row[1].V() };
                 var value = new HousingValue { 班号 = row[5].V(), 备注 = row[6].V(), 时间 = DateTime.Now };
                 table[key] = value;
                 engine.Commit();
             }
             catch
             {
             }
         }
     }
     Response.Redirect(string.Format("Grid.aspx?OnlineId={0}", Request.QueryString["OnlineId"]), false);
 }
Esempio n. 3
0
 public HousingRecord(HousingKey key, HousingValue value)
 {
     学校 = key.学校;
     姓名 = key.姓名;
     身份证号 = key.身份证号;
     入学年份 = key.入学年份;
     户籍 = key.户籍;
     住址 = key.住址;
     班号 = value.班号;
     时间 = value.时间;
     备注 = value.备注;
 }
Esempio n. 4
0
 public HousingRecordX(HousingKey key, HousingValue value)
     : base(key, value)
 {
 }