private void InitDataGridView() { DataTable dt = UserRoleDAO.GetDatasByUserId(this.userId); InitFuncs initFuncs = new InitFuncs(); initFuncs.InitDataGridView(this.dataGridView, dt); }
private void InitDataGridViewChild() { DataTable dt = MatSplitChildDAO.GetDatas(); InitFuncs initFuncs = new InitFuncs(); initFuncs.InitDataGridView(this.dgvMatChild, dt); }
/// <summary> /// 新增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnClear_Click(object sender, EventArgs e) { InitFuncs initFuncs = new InitFuncs(); initFuncs.ClearData(this.panelMenuChild); this.comboBoxMainMenu.Focus(); this.isAdd = true; }
private void BargainBindAddhctype_Load(object sender, EventArgs e) { (new InitFuncs()).Num_limited(this.panel1); //初始化无码数据 InitFuncs inf = new InitFuncs(); inf.InitComboBox(this.s_HcType, "[合同]幅面"); }
private void Add_materialForm_Load(object sender, EventArgs e) { //限制值类型文本框的输入 (new InitFuncs()).Num_limited(this.panel1); //初始化界面 InitFuncs inf = new InitFuncs(); // inf.InitComboBox(s_Units, "[物料]计量单位");//初始化“列”单位Units inf.InitComboBox(s_QualityDegree, "[物料]质量等级");//初始化“列”质量等级QualityDegree inf.InitComboBox(this.s_ColorType,"[物料]色彩"); inf.InitComboBox(this.s_Format, "[物料]幅面"); inf.InitComboBox(this.s_Speed, "[物料]速度等级"); inf.InitComboBox(this.s_ProductType, "[物料]产品种类"); inf.InitComboBox(this.s_types, "[物料]机种"); inf.InitComboBox(this.s_ConfigType, "[物料]配置类型"); inf.InitComboBox(this.s_Brand, "[机型]品牌"); if (this.type == "edit") { s_MatID.ReadOnly = true; string strsql = "select * from T_MatInf where MatID='{0}'"; strsql = string.Format(strsql, this.matId); inf.ShowDatas(this.panel1, strsql); } else { s_MatID.ReadOnly = false; s_InputTime.Text = DBUtil.getServerTime().ToString(); this.s_MatID.Text = this.matId;//单据模块用 } }
private void InitDataGridViewChildTemp(string strReceiptId) { DataTable dt = MatSplitChildDAO.GetDatasByReceiptId(strReceiptId); InitFuncs initFuncs = new InitFuncs(); initFuncs.InitDataGridView(this.dgvMatChild, dt); }
/// <summary> /// 定义一个通用显示在Tab的方法 /// </summary> /// <param name="name">列名</param> /// <param name="tablename">表名</param> /// <param name="Id">主码</param> /// <param name="Panelname">Panelname</param> /// <param name="datagrid">dgv</param> public void Data_ToTab(string name, string tablename, string Id, Panel Panelname,DataGridView datagrid) { string ID = datagrid.SelectedRows[0].Cells[name].Value.ToString().Trim(); string strSql = "select * from {0} where " + Id + "='{1}'"; strSql = string.Format(strSql, tablename, ID); InitFuncs initFuncs = new InitFuncs(); initFuncs.ShowDatas(Panelname, strSql); }
/// <summary> /// 新增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCancel_Click(object sender, EventArgs e) { this.s_RoleId.ReadOnly = false; this.s_RoleId.Focus(); InitFuncs initFuncs = new InitFuncs(); initFuncs.ClearData(this.panelRoles); SetTreeViewNull(this.treeViewMenus.Nodes); }
private void InitDataGridView() { DataTable dt = ReceiptModalDAO.GetDatas(); InitFuncs initFuncs = new InitFuncs(); initFuncs.InitDataGridView(this.dataGridViewRecMod, dt); this.dataGridViewRecMod.ClearSelection(); this.dataGridViewRecMod.Rows[this.curRowIndex].Selected = true; }
/// <summary> /// 重置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnClear_Click(object sender, EventArgs e) { InitFuncs initFuncs = new InitFuncs(); initFuncs.ClearData(this.panelRecMain); initFuncs.ClearData(this.panelRecDet); this.listBoxMain.Items.Clear(); this.listBoxMainTop.Items.Clear(); this.listBoxMainBottom.Items.Clear(); this.listBoxDetail.Items.Clear(); }
private void UserRoleForm_Load(object sender, EventArgs e) { //初始化DataGridView InitDataGridView(); //初始化ComboBox InitFuncs initFuncs = new InitFuncs(); initFuncs.InitComboBox(this.comboBoxRole, "T_Roles", "RoleName"); string strUserName = (new DBUtil()).Get_Single_val("T_Users", "UserName", "UserId", this.userId); this.txtUserName.Text = strUserName; }
/// <summary> /// 初始化显示数据表 /// </summary> public void initDataGridView() { DataTable dt = UsersDAO.GetDatasOfUsers(); InitFuncs initFuncs = new InitFuncs(); initFuncs.InitDataGridView(this.dataGridViewUsers, dt); this.dataGridViewUsers.RowHeadersWidth = 45; this.dataGridViewUsers.ClearSelection(); this.dataGridViewUsers.Rows[this.curRowIndex].Selected = true; }
private void BargainForm_Load(object sender, EventArgs e) { //限制值类型文本框的输入 (new InitFuncs()).Num_limited(this.panel1); s_SaleUser.KeyDown+=new KeyEventHandler(InfoFind.UserName_KeyDown); // 合同:无码数据初始化 InitFuncs inf = new InitFuncs(); //inf.InitComboBox(this.s_ResponseHour, "[合同]响应速度"); inf.InitComboBox(this.t_ContMaintetype, "[合同]签约类型"); //区域:有码数据初始化 inf.InitComboBox(this.t_UseType, "TB_machusedtype", "usedname"); //区域 inf.InitComboBox(this.t_ContMaintetype, "tb_maintetype", "maintetypename"); //保修类别 //合同:有码数据初始化 s_Jftype.SelectedIndex = 0; s_ContractType.SelectedIndex = 0; t_ContMaintetype.SelectedIndex = 0; s_FeeType.SelectedIndex = 0; s_PreChargeMethod.SelectedIndex = 0; s_Payouttype.SelectedIndex = 0; if (this.Type == "add") { this.s_Bargstatus.SelectedIndex = 1; s_BargId.ReadOnly = false; this.panel3.Enabled = false; //不允许设置相关物料 //this.panel4.Enabled = false; } else if (this.Type == "edit") { this.panel3.Enabled = true; //this.panel4.Enabled = true; string sel_sql = "select * from T_Bargains where sysid=" + this.BargSysId ; inf.ShowDatas(this.panel1, sel_sql); //以下两行必须在ShowDatas后 t_CustCode.Text = (new DBUtil()).Get_Single_val("T_CustomerInf", "custname", "custid", s_CustCode.Text.Trim()); this.custid_ = s_CustCode.Text.Trim(); this.t_UseType.Text = (new DBUtil()).Get_Single_val("TB_machusedtype", "usedname", "used_type", this.s_UseType.Text.Trim()); this.t_ContMaintetype.Text = (new DBUtil()).Get_Single_val("tb_maintetype", "maintetypename", "maintetypecode", this.s_ContMaintetype.Text.Trim()); this.t_CustCode.Text = (new DBUtil()).Get_Single_val("T_CustomerMac", "Mdepart", "sysid", this.n_MachineId.Text.Trim()); //显示计费用信息 show_fee_lst(this.BargSysId); } }
private void button1_Click(object sender, EventArgs e) { if (Util.ControlTextIsNUll(this.s_Ititle)) { MessageBox.Show("发票抬头不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.s_Ititle.Focus(); return; } //数据处理 InitFuncs inf = new InitFuncs(); DBUtil dbUtil = new DBUtil(); string sqlexe = ""; string sql_ = ""; if (type == "add") { //bool isExist = false; //sql_ = "select Ititle from T_CustomerInvoice where Custid='" + this.custid + "' and Ititle='" + this.s_Ititle.Text.Trim() + "'"; //isExist = dbUtil.yn_exist_data(sql_); //if (isExist) //{ // MessageBox.Show("该类发票已存在!"); // return; //} sqlexe = inf.Build_Insert_Sql(this.panel1, "T_CustomerInvoice"); } else { //bool isExist = false; //sql_ = "select Ititle from T_CustomerInvoice where Custid='" + this.custid + "' and Ititle='" + this.s_Ititle.Text.Trim() + "' and sysid!=" + this.sysid_; //isExist = dbUtil.yn_exist_data(sql_); //if (isExist) //{ // MessageBox.Show("该类发票已存在!"); // return; //} string swhere = " where custid='" + this.custid + "' and sysid=" + this.sysid_; sqlexe = inf.Build_Update_Sql(this.panel1, "T_CustomerInvoice", swhere); } try { (new SqlDBConnect()).ExecuteNonQuery(sqlexe); MessageBox.Show("保存成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); customerfpFormChange(); } catch (Exception w) { MessageBox.Show(w.ToString()); } }
private void button1_Click(object sender, EventArgs e) { if (Util.ControlTextIsNUll(this.s_ModelName)) { MessageBox.Show("机型名称不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.s_ModelName.Focus(); return; } //数据处理 InitFuncs inf = new InitFuncs(); DBUtil dbUtil = new DBUtil(); string sqlexe = ""; string sql_ = ""; if (this.type == "add") { sql_ = "select ModelName from T_Model where ModelName='" + this.s_ModelName .Text .Trim ()+ "'"; if (dbUtil.yn_exist_data(sql_)) { MessageBox.Show("该机器名称已存在!"); this.s_ModelName.Focus(); return; } sqlexe = inf.Build_Insert_Sql(this.panelmodel, "T_Model"); } else { sql_ = "select ModelName from T_Model where ModelName='" + this.s_ModelName.Text.Trim() + "'" + " and SysID!=" + this.ID; if (dbUtil.yn_exist_data(sql_)) { MessageBox.Show("该机器名称已存在!"); this.s_ModelName.Focus(); return; } string swhere = " where SysID=" + this.ID ; sqlexe = inf.Build_Update_Sql(this.panelmodel, "T_Model", swhere); } try { (new SqlDBConnect()).ExecuteNonQuery(sqlexe); MessageBox.Show("保存成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); macmodelchange(); } catch (Exception w) { MessageBox.Show(w.ToString()); } }
private void buttonOK_Click(object sender, EventArgs e) { if (Util.ControlTextIsNUll(s_AssName)) { MessageBox.Show("请输入配套名称!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } try { InitFuncs initFuncs = new InitFuncs(); bool isExist; string sql = ""; string sql_ = ""; if (this.Type == "add") { sql = initFuncs.Build_Insert_Sql(this.panel1, "T_MatAssemblyMain"); sql_="select AssName from T_MatAssemblyMain where Ltrim(Rtrim(assname)) like '"+ this.s_AssName.Text.Trim()+"'"; } else if (this.Type == "edit") { sql_ = "select AssName from T_MatAssemblyMain where Ltrim(Rtrim(assname)) like '{0}' and Ltrim(Rtrim(sysid)) not like {1}"; sql_ = string.Format(sql_, this.s_AssName.Text.Trim(), this.Sysid); string sqlwhere = "where sysid=" + this.Sysid; sql = initFuncs.Build_Update_Sql(this.panel1, "T_MatAssemblyMain", sqlwhere); } //验证修改的名称是否已存在 isExist = (new DBUtil()).yn_exist_data(sql_); if (isExist == false) { (new SqlDBConnect()).ExecuteNonQuery(sql); matAssemblyMainFormChange(); MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); } else { MessageBox.Show("该配套名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void initDataGridView() { DataTable dt = (new SqlDBConnect()).Get_Dt(this.Basesql +" "+this.whereTJ); InitFuncs initFuncs = new InitFuncs(); initFuncs.InitDataGridView(this.dataGridView1, dt); this.dataGridView1.ClearSelection(); if(this.curRowIndex>0) this.dataGridView1.Rows[this.curRowIndex].Selected = true; this.dataGridView1.Columns["物料编号"].Width = 105; this.dataGridView1.Columns["物料名称"].Width = 250; this.dataGridView1.Columns["型号规格"].Width = 80; this.dataGridView1.Columns["计量单位"].Width = 80; this.toolStripStatusLabel1.Text = " 记录数:" + (this.dataGridView1.Rows.Count).ToString().Trim(); }
private void FormCustContactAdd_Load(object sender, EventArgs e) { InitFuncs inf = new InitFuncs(); inf.InitComboBox(this.s_CType, "[客户]联系人类别"); s_custId.Text = this.custid; if (this.type == "edit") { string strSql = "select * from T_CustContacts where CustID='{0}' and sysid={1}"; strSql = string.Format(strSql, this.custid, this.sysid_); (new InitFuncs()).ShowDatas(this.panel1, strSql); if (s_Sex.Text.Trim() == "男") t_nan.Checked = true; else t_nu.Checked = true; } }
public void Resetdata(TextBox controls,Panel panelname) { controls.ReadOnly = false; controls.Focus(); InitFuncs initFuncs = new InitFuncs(); initFuncs.ClearData(panelname); }
/// <summary> /// 初始化DataGridView /// </summary> /// <param name="dataGridView">dgv</param> /// <param name="dt">数据集</param> public void InitDataGridView(DataGridView dataGridView, DataTable dt) { InitFuncs IniF = new InitFuncs(); IniF.InitDataGridView(dataGridView, dt); }
private void ReceiptModalConfigForm_Load(object sender, EventArgs e) { InitFuncs initFuncs = new InitFuncs(); initFuncs.InitComboBox(this.comboBoxReceName, "T_ReceiptModal", "ReceName"); initFuncs.InitComboBox(this.comboBoxReceiptTypeID, "T_ReceiptModal", "ReceTypeID"); }
/// <summary> /// 查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { //以中文字段名显示 //Return_Sql = "select * from " + tableName + " where "; //英文字段名 //for (int i = 0; i < lb_sql.Items.Count; i++) //{ // Return_Sql += " " + lb_sql.Items[i].ToString().Trim(); //} Return_Sql = ""; if (lb_sql.Items.Count > 0) { if (this.strSql.Contains(" where ")) Return_Sql += this.strSql + " and "; else Return_Sql += this.strSql + " where "; for (int i = 0; i < lb_sql.Items.Count; i++) { Return_Sql += " " + lb_sql.Items[i].ToString().Trim(); } } else Return_Sql = this.strSql; try { SqlDBConnect db = new SqlDBConnect(); DataTable dt = new DataTable(); dt = db.Get_Dt(Return_Sql); if (dt == null || dt.Rows.Count <= 0) { MessageBox.Show("没有符合条件的记录存在!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } InitFuncs initFuncs = new InitFuncs(); initFuncs.InitDataGridView(this.dataGridView, dt); this.Height = 450; } catch (Exception ex) { MessageBox.Show(ex.ToString() + "\n" + Return_Sql, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void FormCustomerMaInvoiceAdd_Load(object sender, EventArgs e) { InitFuncs inf = new InitFuncs(); //inf.InitComboBox(this.t_IType, "[发票]发票种类"); inf.InitComboBox(this.t_IType, "T_Invoice", "ITName"); //发票类型 inf.InitComboBox(this.t_kpcorp, "T_StoreHouse", "SHName"); //所属公司 //开票内容,从物料表中取,要对应到具体的物料(以A打头的物料) this.s_matid.Items.Clear(); string matid_="", matname_=""; string sql_ = "select matid,matname from T_matinf where Matid like 'A%'"; DataTable dt = (new SqlDBConnect()).Get_Dt(sql_); for (int m = 0; m < dt.Rows.Count; m++) { matid_ = dt.Rows[m]["matid"].ToString().Trim(); matname_ = dt.Rows[m]["matname"].ToString().Trim(); this.s_matid.Items.Add("["+matid_+"]"+matname_); } // s_CmSysId.Text = Cmsysid; if (this.type == "edit") { string strSql = "select * from T_CustomerMaInvoice where CmSysId='{0}'and sysid='{1}'"; strSql = string.Format(strSql, this.Cmsysid,this.sysid); (new InitFuncs()).ShowDatas(this.panelkp, strSql); this.t_kpcorp.Text = (new DBUtil()).Get_Single_val("T_StoreHouse", "Shname", "shid", this.s_kpcorp.Text.Trim()); this.t_IType.Text = (new DBUtil()).Get_Single_val("T_Invoice", "ITName", "Itcode", this.s_IType.Text.Trim()); } }
private void MacModelFormAdd_Load(object sender, EventArgs e) { //限制值类型文本框的输入 (new InitFuncs()).Num_limited(this.panelmodel); InitFuncs inf = new InitFuncs(); //无码初始化 inf.InitComboBox(this.s_ProdCtgrID, "[机型]分类"); inf.InitComboBox(this.s_ModelType, "[机型]机型类别"); inf.InitComboBox(this.s_ModelGrade, "[机型]机器等级"); inf.InitComboBox(this.s_Modelbrand, "[机型]品牌"); if (this.type == "edit") { string strsql = "select * from T_Model where SysID='{0}'"; strsql = string.Format(strsql, this.ID); (new InitFuncs()).ShowDatas(this.panelmodel, strsql); } }
private void EditBargFeeForm_Load(object sender, EventArgs e) { //有免印张数,无免印张数,有基本张数 if (this.Jftype == "有基本张数") { this.n_MyNum.Text = ""; this.n_MyNum.ReadOnly = true; this.n_BaseNum.ReadOnly = false; } if (this.Jftype == "有免印张数") { this.n_BaseNum.Text = ""; this.n_MyNum.ReadOnly = false; this.n_BaseNum.ReadOnly = true; } if (this.Jftype == "无免印张数") { this.n_BaseNum.Text = ""; this.n_MyNum.Text = ""; this.n_MyNum.ReadOnly = true; this.n_BaseNum.ReadOnly = true; } //限制值类型文本框的输入 (new InitFuncs()).Num_limited(this.panel1); InitFuncs inf = new InitFuncs(); inf.InitComboBox(this.s_HcType, "[合同]幅面"); this.t_BargId.Text = this.BargId; s_HcType.SelectedIndex = 0; if (this.Type == "add") { //s_BargId.Text = this.BargId; n_barsysid.Text = this.BarSysId; this.s_HcType.Enabled = true; } else { string sql_ = "select * from T_bargFee where barsysid=" + this.BarSysId +" and hctype='"+this.hctype+"'"; (new InitFuncs()).ShowDatas(this.panel1, sql_); this.s_HcType.Enabled = false; } //有免印张数,无免印张数,有基本张数 if (this.Jftype == "有基本张数") { this.n_MyNum.Text = ""; this.n_MyNum.ReadOnly = true; this.n_BaseNum.ReadOnly = false; } if (this.Jftype == "有免印张数") { this.n_BaseNum.Text = ""; this.n_MyNum.ReadOnly = false; this.n_BaseNum.ReadOnly = true; } if (this.Jftype == "无免印张数") { this.n_BaseNum.Text = ""; this.n_MyNum.Text = ""; this.n_MyNum.ReadOnly = true; this.n_BaseNum.ReadOnly = true; } }
private void FinancialForm_Load(object sender, EventArgs e) { InitFuncs initFuncs = new InitFuncs(); initFuncs.InitComboBox(this.comboBoxPayMethod, "T_PayMethod", "PMName"); this.txtCustId.KeyDown += new KeyEventHandler(InfoFind.CustId_KeyDown); this.txtCustName.KeyDown += new KeyEventHandler(InfoFind.CustName_KeyDown); if (this.financialType == "收入") { this.Text = "应收账务核销"; this.labelInfo.Text = "应收账务"; this.btnAutoVeri.Visible = false; } if (this.financialType == "支出") { this.Text = "应付账务核销"; this.labelInfo.Text = "应付账务"; this.btnAutoVeri.Visible = true; } this.curUserName = (this.MdiParent as MainForm).userName; this.curWorkMonth = (this.MdiParent as MainForm).curWorkMonth;//获得主窗体的当前工作月 this.txtCustId.Focus(); }
private void butsave_Click(object sender, EventArgs e) { if (Util.ControlTextIsNUll(this.s_wsCode)) { MessageBox.Show("请输入工单编号!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DBUtil dbUtil = new DBUtil(); List<string> SqlLst = new List<string>(); //数据处理 string strSql = ""; InitFuncs initFuncs = new InitFuncs(); try { if (this.type == "add") { string sql = "select * from T_worksheet where wsCode='" + this.s_wsCode.Text.Trim() + "'"; bool ynExistID = dbUtil.yn_exist_data(sql); if (ynExistID == true) { MessageBox.Show("该工单号已存在!"); s_wsCode.Focus(); return; } strSql = initFuncs.Build_Insert_Sql(this.panel1, "T_worksheet"); } else if (this.type == "edit") { strSql = initFuncs.Build_Update_Sql(this.panel1, "T_worksheet", " where Sysid=" + this.sysid_); } //执行SQL try { //保存工单 SqlLst.Add(strSql); //有对应召唤单的情况下,修改召唤单的状态为返回 if (this.n_CallBillSysId.Text.Trim() != "") { strSql = "update T_CustomerCall set endflag='2' where sysid=" + this.n_CallBillSysId.Text; SqlLst.Add(strSql); } // (new SqlDBConnect()).Exec_Tansaction(SqlLst); MessageBox.Show("保存成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); addWorkFormChange_(); this.DialogResult = DialogResult.OK; } catch (Exception ew) { // MessageBox.Show(ew.ToString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void AddWorkForm_Load(object sender, EventArgs e) { //限制值类型文本框的输入 (new InitFuncs()).Num_limited(this.panel1); this.lb_bargainType.Text = ""; this.lb_xysj.Text = ""; string sql_ = ""; //有码数据初始化 InitFuncs inf = new InitFuncs(); inf.InitComboBox(this.t_workResult, "TB_workResult", "repairstatusname"); //行动结果 inf.InitComboBox(this.t_ServiceType, "tb_maintetype", "maintetypename"); //服务类别 inf.InitComboBox(this.t_WorkType, "T_WorkType", "wcName"); //工作类别 inf.InitComboBox(this.t_WorkContent, "T_WorkType", "wcName"); //工作内容 // 无码数据初始化 inf.InitComboBox(this.s_wsStyle, "[派工]方式"); inf.InitComboBox(this.s_ActionResults, "[派工]行动结果"); inf.InitComboBox(this.s_UrgentDegree, "[召唤]紧急程度"); inf.InitComboBox(this.s_CallType, "[召唤]召唤类型"); inf.InitComboBox(this.s_wsStyle, "[召唤]方式"); inf.InitComboBox(this.s_ReportAttach, "[派工]报告附表"); inf.InitComboBox(this.s_ClearItem, "[派工]清洁项目"); inf.InitComboBox(this.s_ClearResult, "[派工]清洁结果"); inf.InitComboBox(this.s_Becauseof1, "[派工]取消原因"); inf.InitComboBox(this.s_Becauseof2, "[派工]原因备注"); //查询受理单编号 this.callid_ = (new DBUtil()).Get_Single_val("T_worksheet", "CallBillSysId", "sysid", this.sysid_); //显示受理单的相关内容(有受理单的情况) if (this.callid_.Trim() != "") { // 合同:无码数据初始化 this.panelWorkSheet.Visible = true; this.lb_zhd.Visible = true; this.n_CallBillSysId.Visible = true; //显示召唤单 Show_CustCall(this.callid_); t_CustCode.Text = (new DBUtil()).Get_Single_val("T_CustomerInf", "custname", "custid", s_CustCode.Text.Trim()); this.s_CustId.Text = this.s_CustCode.Text.Trim(); // t_WorkType.Text = (new DBUtil()).Get_Single_val("T_worktype", "wcname", "wcid", s_WorkType.Text.Trim()); } else { // 合同:无码数据初始化 this.panelWorkSheet.Visible = false; this.lb_zhd.Visible = false; this.n_CallBillSysId.Visible = false; this.Height = 325; } return; if (type == "add") { n_machineid.Text = this.machineid; //获取客户编号 this.custid_ = (new DBUtil()).Get_Single_val("t_CustomerMac","custid","sysid",this.machineid); this.s_mtype.Text = (new DBUtil()).Get_Single_val("t_CustomerMac", "mtype", "sysid", this.machineid); s_CustCode.Text = this.custid_; s_CustId.Text = this.custid_; t_CustCode.Text = (new DBUtil()).Get_Single_val("T_CustomerInf", "custname", "custid", this.custid_); s_wsCode.Focus(); } else { sql_ = "select * from T_workSheet where sysid=" + this.sysid_; inf.ShowDatas(this.panel1, sql_); this.machineid = this.n_machineid.Text.Trim(); //查找或获取关联值 t_CustCode.Text = (new DBUtil()).Get_Single_val("T_CustomerInf", "custname", "custid", s_CustCode.Text.Trim()); this.t_workResult.Text = (new DBUtil()).Get_Single_val("TB_workResult", "repairstatusname", "repairstatuscode", this.s_workResult.Text.Trim()); this.t_WorkContent.Text = (new DBUtil()).Get_Single_val("T_WorkType", "wcName", "wcid", this.s_WorkContent.Text.Trim()); this.t_ServiceType.Text = (new DBUtil()).Get_Single_val("tb_maintetype", "maintetypename", "maintetypecode", this.s_ServiceType.Text.Trim()); // if (s_AffectiveFlg.Text.ToLower().Trim() == "false") { radioButton1.Checked = true; radioButton2.Checked = false; } else { radioButton1.Checked = false; radioButton2.Checked = true; } } }
/// <summary> /// 单击某行提供修改功能 /// </summary> private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (this.dataGridView1.SelectedRows[0].Cells["sysid"].Value == null) return; if (this.dataGridView1.SelectedRows[0].Cells["sysid"].Value.ToString().Trim() == "") return; this.btnAddDoc.Enabled = true; this.btnGetAttach.Enabled = true; this.btnDel.Enabled = true; this.Type = "edit"; InitFuncs inf = new InitFuncs(); string barsysid=this.dataGridView1.SelectedRows[0].Cells["barsysid"].Value.ToString().Trim(); string AttachName = this.dataGridView1.SelectedRows[0].Cells["附件名称"].Value.ToString().Trim(); string sel_sql = "select * from T_BargAttach where barsysid=" + barsysid + " and AttachName='" + AttachName+"'"; inf.ShowDatas(this.panel1, sel_sql); }
private void button1_Click(object sender, EventArgs e) { #region 输入验证 if (Util.ControlTextIsNUll(this.s_CName)) { MessageBox.Show("联系人姓名不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.s_CName.Focus(); return; } if (this.s_Tel.Text.Trim() != "" && Util.IsNumberic(this.s_Tel) == false) { MessageBox.Show("输入电话错误!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.s_Tel.Focus(); return; } #endregion //数据处理 InitFuncs inf = new InitFuncs(); DBUtil dbUtil = new DBUtil(); string sqlexe = ""; string sql_ = ""; if (type == "add") { bool isExist = false; sql_ = "select CName from T_CustContacts where Custid='" + this.custid + "' and Cname='" + this.s_CName.Text.Trim() + "'"; isExist = dbUtil.yn_exist_data(sql_); if (isExist) { MessageBox.Show("该联系人已存在!"); return; } sqlexe = inf.Build_Insert_Sql(this.panel1, "T_CustContacts"); } else { bool isExist = false; sql_ = "select CName from T_CustContacts where Custid='" + this.custid + "' and Cname='" + this.s_CName.Text.Trim() + "' and sysid!="+this.sysid_; isExist = dbUtil.yn_exist_data(sql_); if (isExist) { MessageBox.Show("该联系人已存在!"); return; } string swhere = " where custid='" + this.custid + "' and sysid=" + this.sysid_ ; sqlexe = inf.Build_Update_Sql(this.panel1, "T_CustContacts", swhere); } try { (new SqlDBConnect()).ExecuteNonQuery(sqlexe); MessageBox.Show("保存成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); customerContactFormChange(); } catch (Exception w) { MessageBox.Show(w.ToString()); } }