/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsmDelete_Click(object sender, EventArgs e) { try { Model_ColdstoragePDA coldpda = dataGridView1.SelectedRows[0].Tag as Model_ColdstoragePDA; Model_ColdStorage coldstorage = new Model_ColdStorage(); coldstorage.Idk__BackingField = coldpda.StorageIdk__BackingField; coldstorage.StorageNamek__BackingField = coldpda.StorageNamek__BackingField; coldstorage.StorageTypek__BackingField = coldpda.StorageTypek__BackingField; coldstorage.Driverk__BackingField = coldpda.Driverk__BackingField; coldstorage.DriverTelk__BackingField = coldpda.DriverTelk__BackingField; coldstorage.CreateAtk__BackingField = coldpda.StorageCreateAtk__BackingField; coldstorage.Remarkk__BackingField = coldpda.Remarkk__BackingField; coldstorage.Activedk__BackingField = Enum_Active.Disable; if (MessageBox.Show("是否确定删除?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ResultModelOfModel_ColdStoraged4FqxSXX actiove = cs.EditColdstorage(coldstorage, Convert.ToInt32(coldpda.isDefaultk__BackingField), true, coldpda.StorageDeviceIdk__BackingField, true, coldpda.PDAIdk__BackingField, true, true, true); if (actiove.Code != 0) { MessageBox.Show(actiove.Message); } else { MessageBox.Show("操作成功,冷库已停用"); WarehouseLoad(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (cmbPDA.Text.Trim() == string.Empty) { MessageBox.Show("PDA设备不能为空"); return; } Model_ColdStorage mcs = new Model_ColdStorage(); mcs.Idk__BackingField = mcp.StorageIdk__BackingField; mcs.StorageNamek__BackingField = mcp.StorageNamek__BackingField; mcs.StorageTypek__BackingField = mcp.StorageTypek__BackingField; mcs.Driverk__BackingField = mcp.Driverk__BackingField; mcs.DriverTelk__BackingField = mcp.DriverTelk__BackingField; mcs.Remarkk__BackingField = mcp.Remarkk__BackingField; // mcs.CreateAtk__BackingField = mcp.CreateAtk__BackingField; mcs.CreateAtk__BackingField = mcp.StorageCreateAtk__BackingField; int PDAid = Convert.ToInt32(cmbPDA.SelectedValue); int DefaultDevice; if (checDefault.Checked == true) { //if (MessageBox.Show("是否默认该设备?", "Prompt", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) //{ DefaultDevice = (int)Enum_IsDefault.Eefault; Model_Storage_Device sto = new Model_Storage_Device(); sto.deviceIdk__BackingField = PDAid; sto.isDefaultk__BackingField = DefaultDevice; ResultModelOfModel_Storage_Deviced4FqxSXX st = cs.GetDefaultDevice(sto); if (st.Code != 0) { MessageBox.Show("操作失败"); } //}else // DefaultDevice = (int)Enum_IsDefault.NotDefault; } else { DefaultDevice = (int)Enum_IsDefault.NotDefault; } ResultModelOfModel_ColdStoraged4FqxSXX coldstoreage = cs.EditColdstorage(mcs, DefaultDevice, true, mcp.StorageDeviceIdk__BackingField, true, PDAid, true, true, true); if (coldstoreage.Code != 0) { MessageBox.Show(coldstoreage.Message); } else { MessageBox.Show("操作成功"); _ParentWare.waLoad(); this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 添加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { try { if (txtWarehouseName.Text.Trim() == string.Empty) { MessageBox.Show("仓库名称不能为空"); return; } if (Encoding.Default.GetBytes(txtWarehouseName.Text.Trim()).Length > 100) { MessageBox.Show("仓库名称不能超过100"); return; } if (cmbPDA.Text.Trim() == string.Empty) { MessageBox.Show("PDA设备不能为空"); return; } if (cmbStorageType.Text.Trim() == string.Empty) { MessageBox.Show("存储类型不能为空"); return; } Model_ColdStorage mcs = new Model_ColdStorage(); mcs.StorageNamek__BackingField = txtWarehouseName.Text.Trim(); if (cmbStorageType.Text == "冷库") { mcs.StorageTypek__BackingField = Enum_StorageType.ColdStorage; } else { mcs.StorageTypek__BackingField = Enum_StorageType.CarStorage; } mcs.CreateAtk__BackingField = DateTime.Now; if (rdbEnabled.Checked == true) { mcs.Activedk__BackingField = Enum_Active.Enabled; } else { mcs.Activedk__BackingField = Enum_Active.Disable; } int PDAid = Convert.ToInt32(cmbPDA.SelectedValue); int DefaultDevice; if (checDefault.Checked == true) { DefaultDevice = (int)Enum_IsDefault.Eefault; Model_Storage_Device sto = new Model_Storage_Device(); sto.deviceIdk__BackingField = PDAid; sto.isDefaultk__BackingField = DefaultDevice; ResultModelOfModel_Storage_Deviced4FqxSXX st = cs.GetDefaultDevice(sto); if (st.Code != 0) { MessageBox.Show("操作失败"); } } else { DefaultDevice = (int)Enum_IsDefault.NotDefault; } ResultModelOfModel_ColdStoraged4FqxSXX coldstoreage = cs.EditColdstorage(mcs, DefaultDevice, true, 0, true, PDAid, true, false, true); if (coldstoreage.Code != 0) { MessageBox.Show(coldstoreage.Message); } else { MessageBox.Show("操作成功"); getClear(); WarehouseLoad(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 新增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { try { if (txtLicensePlate.Text.Trim() == string.Empty) { MessageBox.Show("车载系统车牌不能为空"); return; } if (Encoding.Default.GetBytes(txtLicensePlate.Text.Trim()).Length > 100) { MessageBox.Show("车载系统车牌不能超过100"); return; } if (Encoding.Default.GetBytes(txtPilot.Text.Trim()).Length > 50) { MessageBox.Show("车载驾驶员不能超过50"); return; } if (cmbPDA.Text == string.Empty) { MessageBox.Show("PDA设备不能为空"); return; } if (Encoding.Default.GetBytes(txtTelephone.Text.Trim()).Length > 50) { MessageBox.Show("驾驶员电话不能超过50"); return; } if (txtTelephone.Text.Trim() != string.Empty) { if (!IsTelephone(txtTelephone.Text.Trim())) { MessageBox.Show("你输入不是手机/电话号码!"); return; } } if (cmbStorageType.Text == string.Empty) { MessageBox.Show("存储类型不能为空"); return; } if (Encoding.Default.GetBytes(txtRemark.Text.Trim()).Length > 200) { MessageBox.Show("备注不能超过200"); return; } Model_ColdStorage cold = new Model_ColdStorage(); if (cmbStorageType.Text == "冷库") { cold.StorageTypek__BackingField = Enum_StorageType.ColdStorage; } else { cold.StorageTypek__BackingField = Enum_StorageType.CarStorage; } if (IsVehicleNumber(txtLicensePlate.Text.Trim())) { cold.StorageNamek__BackingField = txtLicensePlate.Text.Trim(); } else { MessageBox.Show("你输入的不是车牌号"); return; } cold.Driverk__BackingField = txtPilot.Text.Trim(); cold.DriverTelk__BackingField = txtTelephone.Text.Trim(); cold.Remarkk__BackingField = txtRemark.Text.Trim(); cold.CreateAtk__BackingField = DateTime.Now; if (rdbEnabled.Checked == true) { cold.Activedk__BackingField = Enum_Active.Enabled; } else { cold.Activedk__BackingField = Enum_Active.Disable; } int PDAid = Convert.ToInt32(cmbPDA.SelectedValue); int DefaultDevice; if (checDefault.Checked == true) { DefaultDevice = (int)Enum_IsDefault.Eefault; Model_Storage_Device sto = new Model_Storage_Device(); sto.deviceIdk__BackingField = PDAid; sto.isDefaultk__BackingField = DefaultDevice; ResultModelOfModel_Storage_Deviced4FqxSXX st = cs.GetDefaultDevice(sto); if (st.Code != 0) { MessageBox.Show("操作失败"); } } else { DefaultDevice = (int)Enum_IsDefault.NotDefault; } ResultModelOfModel_ColdStoraged4FqxSXX coldstorage = cs.EditColdstorage(cold, DefaultDevice, true, 0, true, PDAid, true, false, true); if (coldstorage.Code != 0) { MessageBox.Show(coldstorage.Message); } else { MessageBox.Show("操作成功"); qingkong(); MountedListLoad(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button1_Click(object sender, EventArgs e) { try { if (txtLicensePlate.Text.Trim() == string.Empty) { MessageBox.Show("车载系统车牌不能为空"); return; } if (Encoding.Default.GetBytes(txtLicensePlate.Text.Trim()).Length > 100) { MessageBox.Show("车载系统车牌不能超过100"); return; } if (cmbPDA.Text.Trim() == string.Empty) { MessageBox.Show("PDA设备不能为空"); return; } if (cmbStorageType.Text.Trim() == string.Empty) { MessageBox.Show("存储类型不能为空"); return; } if (Encoding.Default.GetBytes(txtPilot.Text.Trim()).Length > 50) { MessageBox.Show("车载驾驶员不能超过50"); return; } if (Encoding.Default.GetBytes(txtTelephone.Text.Trim()).Length > 50) { MessageBox.Show("驾驶员电话不能超过50"); return; } if (txtTelephone.Text.Trim() != string.Empty) { if (!IsTelephone(txtTelephone.Text.Trim())) { MessageBox.Show("你输入不是手机/电话号码!"); return; } } if (Encoding.Default.GetBytes(txtRemark.Text.Trim()).Length > 200) { MessageBox.Show("备注不能超过200"); return; } Model_ColdStorage coldpdalist = new Model_ColdStorage(); coldpdalist.Idk__BackingField = coldpda.StorageIdk__BackingField; if (IsVehicleNumber(txtLicensePlate.Text.Trim())) { coldpdalist.StorageNamek__BackingField = txtLicensePlate.Text; } else { MessageBox.Show("你输入的不是车牌号"); return; } if (cmbStorageType.Text == "冷库") { coldpdalist.StorageTypek__BackingField = Enum_StorageType.ColdStorage; } else { coldpdalist.StorageTypek__BackingField = Enum_StorageType.CarStorage; } coldpdalist.Driverk__BackingField = txtPilot.Text; coldpdalist.DriverTelk__BackingField = txtTelephone.Text; coldpdalist.Remarkk__BackingField = txtRemark.Text; if (rdbEnabled.Checked == true) { coldpdalist.Activedk__BackingField = Enum_Active.Enabled; } else { coldpdalist.Activedk__BackingField = Enum_Active.Disable; } int pdaid = Convert.ToInt32(cmbPDA.SelectedValue); int isDefault; if (checDefault.Checked == true) { //if (MessageBox.Show("是否默认该设备?", "Prompt", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) //{ isDefault = (int)Enum_IsDefault.Eefault; Model_Storage_Device sto = new Model_Storage_Device(); sto.deviceIdk__BackingField = pdaid; sto.isDefaultk__BackingField = isDefault; ResultModelOfModel_Storage_Deviced4FqxSXX st = cs.GetDefaultDevice(sto); if (st.Code != 0) { MessageBox.Show("操作失败"); } //} //else // isDefault = (int)Enum_IsDefault.NotDefault; } else { isDefault = (int)Enum_IsDefault.NotDefault; } ResultModelOfModel_ColdStoraged4FqxSXX edit = cs.EditColdstorage(coldpdalist, isDefault, true, coldpda.StorageDeviceIdk__BackingField, true, pdaid, true, true, true); if (edit.Code != 0) { MessageBox.Show(edit.Message); } else { MessageBox.Show("操作成功"); _Parentmounted.ColdPDALoad(); this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }