private void GetHcDetails(Hc h) { tbx_part_name.Text = h.part_name; tbx_pn.Text = h.pn; tbx_sn.Text = h.sn; DropDownList_Part_Type.SelectedValue = h.part_type; DropDownList_Condition.SelectedValue = h.condition; tbx_loc.Text = h.loc; tbx_onhand.Text = h.onhand.ToString(); tbx_des.Text = h.part_des; tbx_remark.Text = h.remark; tbx_rec_date.SelectedDate = h.rec_date; }
protected void Grid1_RowSelect(object sender, FineUI.GridRowSelectEventArgs e) { int roleID = GetSelectedDataKeyID(Grid1); if (roleID == -1) { } else { Hc hc = DB.Hcs.Find(roleID); GetHcDetails(hc); } }
protected void btnUpdateSelected_Click(object sender, EventArgs e) { // 在操作之前进行权限检查 if (!CheckPower("HcView")) { CheckPowerFailWithAlert(); return; } int ID = GetSelectedDataKeyID(Grid1); if (ID != -1) { //保存工卡信息 Hc h = DB.Hcs.Where(u => u.ID == ID).FirstOrDefault(); h.part_name = tbx_part_name.Text; h.pn = tbx_pn.Text; h.sn = tbx_sn.Text; h.part_type = DropDownList_Part_Type.SelectedValue; h.condition = DropDownList_Condition.SelectedValue; h.loc = tbx_loc.Text; h.onhand = Convert.ToInt32(tbx_onhand.Text); h.part_des = tbx_des.Text; h.remark = tbx_remark.Text; h.rec_date = Convert.ToDateTime(tbx_rec_date.Text); DB.SaveChanges(); Alert.Show("航材数据更新成功!"); SimpleForm1.Reset(); BindGrid1(); } else { Alert.Show("请选择要更新的航材!"); } }