/// <summary> 格式化 /// </summary> private void dgvDicList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.Value == null) { return; } try { string fieldNmae = dgvDicList.Columns[e.ColumnIndex].DataPropertyName; if (fieldNmae.Equals("enable_flag")) { DataSources.EnumEnableFlag enumEnableFlag = (DataSources.EnumEnableFlag)Convert.ToInt16(e.Value.ToString()); e.Value = DataSources.GetDescription(enumEnableFlag, true); } if (fieldNmae.Equals("data_source")) { DataSources.EnumDataSources enumDataSources = (DataSources.EnumDataSources)Convert.ToInt16(e.Value.ToString()); e.Value = DataSources.GetDescription(enumDataSources, true); } } catch (Exception ex) { Utility.Log.Log.writeLineToLog("【字典码表】" + ex.Message, "client"); } }
/// <summary> 格式化 /// </summary> private void dgvDicList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { try { if (e.Value == null || string.IsNullOrEmpty(e.Value.ToString())) { return; } string fieldNmae = dgvDicList.Columns[e.ColumnIndex].DataPropertyName; if (fieldNmae.Equals("create_time") || fieldNmae.Equals("update_time")) { long ticks = (long)e.Value; e.Value = Common.UtcLongToLocalDateTime(ticks); } if (fieldNmae.Equals("enable_flag")) { DataSources.EnumEnableFlag enumEnableFlag = (DataSources.EnumEnableFlag)Convert.ToInt16(e.Value.ToString()); e.Value = DataSources.GetDescription(enumEnableFlag, true); } if (fieldNmae.Equals("data_source")) { DataSources.EnumDataSources enumDataSources = (DataSources.EnumDataSources)Convert.ToInt16(e.Value.ToString()); e.Value = DataSources.GetDescription(enumDataSources, true); } } catch (Exception ex) { Utility.Log.Log.writeLineToLog("【字典码表】" + ex.Message, "client"); } }
private void gvWorkList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.Value == null || e.Value.ToString() == string.Empty) { return; } string fieldNmae = dgvWorkList.Columns[e.ColumnIndex].DataPropertyName; if (fieldNmae.Equals("create_time") || fieldNmae.Equals("update_time")) { long ticks = (long)e.Value; e.Value = Common.UtcLongToLocalDateTime(ticks); } if (fieldNmae.Equals("data_source")) { DataSources.EnumDataSources enumDataSources = (DataSources.EnumDataSources)Convert.ToInt16(e.Value.ToString()); //e.Value = enumDataSources.ToString(); e.Value = DataSources.GetDescription(enumDataSources, true); } if (fieldNmae.Equals("status")) { //DataSources.EnumStatus enumDataSources = (DataSources.EnumStatus)Convert.ToInt16(e.Value.ToString()); //e.Value = enumDataSources.ToString(); //e.Value = DataSources.GetDescription(enumDataSources, true); } }
/// <summary> 单击事件 /// </summary> private void dgvDicList_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (editRowIndex < 0 && dgvDicList.CurrentRow != null) { object obj = dgvDicList.CurrentRow.Cells["data_source"].Value; if (obj == null || string.IsNullOrEmpty(obj.ToString())) { return; } DataSources.EnumDataSources enumDataSources = (DataSources.EnumDataSources)Convert.ToInt32(obj.ToString()); bool flag = enumDataSources == DataSources.EnumDataSources.SELFBUILD; Func <bool, bool> fc = delegate(bool status) { base.btnAdd.Enabled = status; base.btnEdit.Enabled = status; base.btnDelete.Enabled = status; return(true); }; this.BeginInvoke(fc, new object[] { flag }); } } catch (Exception ex) { Utility.Log.Log.writeLineToLog("【字典码表】" + ex.Message, "client"); MessageBoxEx.ShowWarning("操作失败!"); } }
private void dgvRecord_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.Value == null || string.IsNullOrEmpty(e.Value.ToString())) { return; } string fieldNmae = this.dgvRecord.Columns[e.ColumnIndex].Name; if (fieldNmae == this.columnCreateTime.Name) { e.Value = Common.UtcLongToLocalDateTime(e.Value); } if (fieldNmae == data_source.DataPropertyName) { DataSources.EnumDataSources enumStatus = (DataSources.EnumDataSources)Convert.ToInt16(e.Value.ToString()); e.Value = DataSources.GetDescription(enumStatus, true); } if (fieldNmae.Equals("status")) { DataSources.EnumStatus enumStatus = (DataSources.EnumStatus)Convert.ToInt16(e.Value.ToString()); e.Value = DataSources.GetDescription(enumStatus, true); } if (columnAddress.Name == dgvRecord.Columns[e.ColumnIndex].Name) { string address = string.Empty; object obj = dgvRecord.Rows[e.RowIndex].Cells["province"].Value; if (obj != null && !string.IsNullOrEmpty(obj.ToString())) { if (dicArea.ContainsKey(obj.ToString())) { address += dicArea[obj.ToString()]; } } obj = dgvRecord.Rows[e.RowIndex].Cells["city"].Value; if (obj != null && !string.IsNullOrEmpty(obj.ToString())) { if (dicArea.ContainsKey(obj.ToString())) { address += dicArea[obj.ToString()]; } } obj = dgvRecord.Rows[e.RowIndex].Cells["county"].Value; if (obj != null && !string.IsNullOrEmpty(obj.ToString())) { if (dicArea.ContainsKey(obj.ToString())) { address += dicArea[obj.ToString()]; } } if (e.Value != null && !string.IsNullOrEmpty(e.Value.ToString())) { address += e.Value.ToString(); } e.Value = address; } }
/// <summary> 格式化 /// </summary> private void dgvDicList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.Value == null) { return; } string fieldNmae = dgvDicList.Columns[e.ColumnIndex].DataPropertyName; if (fieldNmae.Equals("enable_flag")) { DataSources.EnumEnableFlag enumEnableFlag = (DataSources.EnumEnableFlag)Convert.ToInt16(e.Value.ToString()); e.Value = DataSources.GetDescription(enumEnableFlag, true); } if (fieldNmae.Equals("data_source")) { DataSources.EnumDataSources enumDataSources = (DataSources.EnumDataSources)Convert.ToInt16(e.Value.ToString()); e.Value = DataSources.GetDescription(enumDataSources, true); } }
private void gvWareHouseList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.Value == null || e.Value.ToString().Length == 0) { return; } string fieldNmae = dgvWareHouseList.Columns[e.ColumnIndex].DataPropertyName; if (fieldNmae.Equals("create_time") || fieldNmae.Equals("update_time")) { long ticks = (long)e.Value; e.Value = Common.UtcLongToLocalDateTime(ticks); } if (fieldNmae.Equals("data_source")) { DataSources.EnumDataSources enumDataSources = (DataSources.EnumDataSources)Convert.ToInt16(e.Value.ToString()); e.Value = DataSources.GetDescription(enumDataSources, true); } if (fieldNmae.Equals("status")) { DataSources.EnumStatus enumDataSources = (DataSources.EnumStatus)Convert.ToInt16(e.Value.ToString()); e.Value = DataSources.GetDescription(enumDataSources, true); } if (fieldNmae.Equals("cargospacenum")) { if (dt_CargoSpace_Num != null && dt_CargoSpace_Num.Rows.Count > 0) { string wh_id = dgvWareHouseList.Rows[e.RowIndex].Cells["wh_id"].Value == null ? "0" : dgvWareHouseList.Rows[e.RowIndex].Cells["wh_id"].Value.ToString(); for (int i = 0; i < dt_CargoSpace_Num.Rows.Count; i++) { if (dt_CargoSpace_Num.Rows[i]["wh_id"].ToString() == wh_id) { e.Value = dt_CargoSpace_Num.Rows[i]["Num"]; break; } } } //string wh_id = gvWareHouseList.Rows[e.RowIndex].Cells["wh_id"].Value == null ? "0" : gvWareHouseList.Rows[e.RowIndex].Cells["wh_id"].Value.ToString(); //DataTable dt_cargo_space = DBHelper.GetTable("查询关联的仓库库位信息", "tb_cargo_space", "*", " wh_id='" + wh_id + "' and enable_flag=1", "", ""); //e.Value = dt_cargo_space.Rows.Count; } }
/// <summary> 单击事件 /// </summary> private void dgvDicList_CellClick(object sender, DataGridViewCellEventArgs e) { if (editRowIndex < 0 && dgvDicList.CurrentRow != null) { object obj = dgvDicList.CurrentRow.Cells["data_source"].Value; if (obj == null || string.IsNullOrEmpty(obj.ToString())) { return; } DataSources.EnumDataSources enumDataSources = (DataSources.EnumDataSources)Convert.ToInt32(obj.ToString()); bool flag = enumDataSources == DataSources.EnumDataSources.SELFBUILD; Func <bool, bool> fc = delegate(bool status) { base.btnAdd.Enabled = status; base.btnEdit.Enabled = status; base.btnDelete.Enabled = status; return(true); }; this.BeginInvoke(fc, new object[] { flag }); } }
/// <summary> /// 加载仓库档案信息 /// </summary> private void LoadInfo(string wareHouseId) { if (!string.IsNullOrEmpty(wareHouseId)) { //1.加载仓库档案主信息 DataTable dt = DBHelper.GetTable("查看一条仓库档案信息", "v_warehouse_companyname_username", "*", " wh_id='" + wareHouseId + "'", "", ""); if (dt != null && dt.Rows.Count > 0) { tb_warehouse tb_warehouse_Model = new tb_warehouse(); CommonFuncCall.SetModlByDataTable(tb_warehouse_Model, dt); CommonFuncCall.SetShowControlValue(this, tb_warehouse_Model, "View"); lblcom_id.Text = dt.Rows[0]["com_name"].ToString(); DataSources.EnumDataSources enumDataSources = (DataSources.EnumDataSources)Convert.ToInt16(tb_warehouse_Model.data_source); lbldata_source.Text = DataSources.GetDescription(enumDataSources, true); if (!string.IsNullOrEmpty(tb_warehouse_Model.county)) { lblwh_address.Text = CommonFuncCall.GetAddress(tb_warehouse_Model.county) + " " + lblwh_address.Text; } else { if (!string.IsNullOrEmpty(tb_warehouse_Model.city)) { lblwh_address.Text = CommonFuncCall.GetAddress(tb_warehouse_Model.city) + " " + lblwh_address.Text; } else { if (!string.IsNullOrEmpty(tb_warehouse_Model.province)) { lblwh_address.Text = CommonFuncCall.GetAddress(tb_warehouse_Model.province) + " " + lblwh_address.Text; } } } } } }