//申请提交按钮功能 private void ApplicationSubmit_Click(object sender, RoutedEventArgs e) { if (ApplicationMaintenanceCount.Text.Length == 0 || ApplicationEquipmentNumber.Text.Length == 0) { MessageBox.Show("错误:装备编号或申请数量为空!"); } else if (Convert.ToInt32(ApplicationMaintenanceCount.Text) < 0) { MessageBox.Show("错误:申请数量不能负数!"); } else if (ApplicationReasons.Text.Length > 100) { MessageBox.Show("错误:申请原因字数不能超过100!"); } else if (UITemp.GetRyidStatus) { if (UITemp.UserInfoTemp.Position == "") { UITemp.UserInfoTemp.Position = "信息暂无"; } string Date = DateTime.Now.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToLongTimeString().ToString();;//获取当前时间 string StrSQL = "insert into ApplyMaintain values('" + UITemp.UserInfoTemp.Ryid + "','" + UITemp.UserInfoTemp.RyName + "','" + UITemp.UserInfoTemp.Position + "','" + Date + "','" + ApplicationEquipmentNumber.Text + "'," + ApplicationMaintenanceCount.Text + ",'" + ApplicationReasons.Text + "','未操作')"; try { SqlCommand cmd = new SqlCommand(StrSQL, Temp.GetConn()); cmd.ExecuteNonQuery(); } catch { MessageBox.Show("申请失败!"); return; } MessageBox.Show("申请成功,请耐心等待批准结果。。。"); TableToApply.DataTableSelect(ApplyTableSql, "更新"); //申请成功更新:申请历史表格 UpDataLog(); //更新操作日志 UpDateRLR(0); //更新左下部操作提示 ApplicationHistoryCount.Content = TableToApply.Rows; //更新申请总计 if (mmiw_OpenSign == 1) { mmiw.updata(TableToApply.Getdt(), TableToApply.Rows);//更新查看详细信息窗口的总行数 } } else { MessageBox.Show("个人信息拉取失败或个人信息未填写充分,无法提交申请!"); } }
int admiw_OpenSign; //详细信息窗口标记,0为未打开过! public OrdinaryUsers_Databorrow() { InitializeComponent(); ApplyTableSql = "select * from ApplyData where Ryid='" + UITemp.UserInfoTemp.Ryid + "'"; HistoryTableSql = "select * from DataLend where RyId='" + UITemp.UserInfoTemp.Ryid + "'"; InitTabelToApply(); //申请历史表格初始化 InitTableToHistory(); //借阅历史表格初始化 TableToApply.DataTableSelect(ApplyTableSql, "更新"); Initttalbm(); ApplicationHistoryCount.Content = TableToApply.Rows;//申请总计 TableToHistory.DataTableSelect(HistoryTableSql, "更新"); Inittthlbm(); BorrowHistoryCount.Content = TableToHistory.Rows; //借阅历史总计 UpDateRLR(1); //更新左下侧操作历史 }
int mmiw_OpenSign = 0; //详细信息窗口标记,0为未打开过! public OrdinaryUsers_MaintenanceApplication() { InitializeComponent(); ApplyTableSql = "select * from ApplyMaintain where Ryid='" + UITemp.UserInfoTemp.Ryid + "'"; HistoryTableSql = "select * from ArmsRepair where RyId='" + UITemp.UserInfoTemp.Ryid + "'"; InitTabelToApply(); //申请历史表格初始化 InitTableToHistory(); //借阅历史表格初始化 TableToApply.DataTableSelect(ApplyTableSql, "更新"); Initttalbm(); ApplicationHistoryCount.Content = TableToApply.Rows;//申请总计 TableToHistory.DataTableSelect(HistoryTableSql, "更新"); Inittthlbm(); MaintenanceHistoryCount.Content = TableToHistory.Rows; //借阅历史总计 UpDateRLR(1); //更新左下侧操作历史 }
//申请提交按钮功能 private void ApplicationSubmit_Click(object sender, RoutedEventArgs e) { if (ApplicationDataCount.Text.Length == 0 || ApplicationDataNumber.Text.Length == 0) { MessageBox.Show("错误:资料编号或申请数量为空!"); } else if (Convert.ToInt32(ApplicationDataCount.Text) < 0) { MessageBox.Show("错误:申请数量不能负数!"); } else if (ApplicationReasons.Text.Length > 100) { MessageBox.Show("错误:申请原因字数不能超过100!"); } else if (UITemp.GetRyidStatus) { if (UITemp.UserInfoTemp.Position == "") { UITemp.UserInfoTemp.Position = "信息暂无"; } string Date = DateTime.Now.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToLongTimeString().ToString();;//获取当前时间 string StrSQL1 = "insert into ApplyData values('" + UITemp.UserInfoTemp.Ryid + "','" + UITemp.UserInfoTemp.RyName + "','" + UITemp.UserInfoTemp.Position + "','" + Date + "','" + ApplicationDataNumber.Text + "'," + ApplicationDataCount.Text + ",'" + ApplicationReasons.Text + "','未操作')"; string StrSQL2 = "select * from ArmsData where DataNo ='" + ApplicationDataNumber.Text + "'"; SqlCommand CMD_1 = new SqlCommand(StrSQL2, Temp.GetConn()); SqlDataReader Sdr_1 = CMD_1.ExecuteReader(); if (!Sdr_1.Read()) { MessageBox.Show("错误:暂无编号为 " + ApplicationDataNumber.Text + " 的资料!"); } else { if (Convert.ToInt32(Sdr_1[3].ToString()) < Convert.ToInt32(ApplicationDataCount.Text)) { MessageBox.Show("编号为 " + ApplicationDataNumber.Text + " 的资料,暂不能满足申请数量!"); return; } Sdr_1.Close(); try { CMD_1.CommandText = StrSQL1; CMD_1.ExecuteNonQuery(); } catch { MessageBox.Show("申请失败!"); return; } MessageBox.Show("申请成功,请耐心等待批准结果。。。"); TableToApply.DataTableSelect(ApplyTableSql, "更新"); //申请成功更新:申请历史表格 UpDataLog(); //更新操作日志 UpDateRLR(0); //更新左下部操作提示 ApplicationHistoryCount.Content = TableToApply.Rows; //更新申请总计 if (admiw_OpenSign == 1) { admiw.updata(TableToApply.Getdt(), TableToApply.Rows);//更新查看详细信息窗口的总行数 } } Sdr_1.Close(); } else { MessageBox.Show("个人信息拉取失败或个人信息未填写充分,无法提交申请!"); } }
private void ApplicationSubmit_Click(object sender, RoutedEventArgs e)//待修改 { if (ApplicationEquipmentCount.Text.Length == 0 || ApplicationEquipmentNumber.Text.Length == 0 || TransferredUnit.Text.Length == 0) { MessageBox.Show("错误:装备编号或申请数量或调入单位为空!"); } else if (Convert.ToInt32(ApplicationEquipmentCount.Text) < 0) { MessageBox.Show("错误:申请数量不能负数!"); } else if (ApplicationReasons.Text.Length > 100) { MessageBox.Show("错误:申请原因字数不能超过100!"); } else if (UITemp.GetRyidStatus) { string Date = DateTime.Now.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToLongTimeString().ToString();; //获取当前时间 if (AllotType.SelectedIndex == 0) { AType = "价拨"; } else { AType = "调拨"; } if (UITemp.UserInfoTemp.Position == "") { UITemp.UserInfoTemp.Position = "信息暂无"; } string StrSQL = "insert into ApplyEquip values('" + UITemp.UserInfoTemp.Ryid + "','" + UITemp.UserInfoTemp.RyName + "','" + UITemp.UserInfoTemp.Position + "','" + Date + "','" + ApplicationEquipmentNumber.Text + "'," + ApplicationEquipmentCount.Text + ",'" + AType + "','" + TransferredUnit.Text + "','" + ApplicationReasons.Text + "','未操作')"; string StrSQL2 = "select * from ArmsSurplus where ZbId ='" + ApplicationEquipmentNumber.Text + "'"; SqlCommand CMD_1 = new SqlCommand(StrSQL2, Temp.GetConn()); SqlDataReader Sdr_1 = CMD_1.ExecuteReader(); if (!Sdr_1.Read()) { MessageBox.Show("错误:仓库暂无编号为 " + ApplicationEquipmentNumber.Text + " 的装备!"); } else { if (Convert.ToInt32(Sdr_1[3].ToString()) < Convert.ToInt32(ApplicationEquipmentCount.Text)) { MessageBox.Show("编号为 " + ApplicationEquipmentNumber.Text + " 的装备,库存不能满足申请数量!"); return; } Sdr_1.Close(); try { CMD_1.CommandText = StrSQL; CMD_1.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show("申请失败!" + ex); return; } MessageBox.Show("申请成功,请耐心等待批准结果。。。"); TableToApply.DataTableSelect(ApplyTableSql, "更新"); //申请成功更新:申请历史表格 UpDataLog(); //更新操作日志 UpDateRLR(0); //更新左下部操作提示 ApplicationHistoryCount.Content = TableToApply.Rows; //更新申请总计 if (aemiw_OpenSign == 1) { aemiw.updata(TableToApply.Getdt(), TableToApply.Rows);//更新查看详细信息窗口的总行数 } } Sdr_1.Close(); } else { MessageBox.Show("个人信息拉取失败或个人信息未填写充分,无法提交申请!"); } }