/// <summary> /// 绑定客户速查 /// </summary> /// <param name="txtCustCode"></param> public void BindCustomer(TextChooser txtCustCode) { //设置客户编码速查 txtCustCode.SetBindTable("tb_customer", "cust_code", "cust_name"); txtCustCode.GetDataSourced += new TextChooser.GetDataSourceHandler(txtcCustName_GetDataSourced); //txtCustCode.DataBacked += new TextChooser.DataBackHandler(txtcCustName_DataBacked); }
public static void CrossThreadInvoke(TextChooser t, MethodInvoker m) { if (t.InvokeRequired) { t.Invoke(m); } }
/// <summary> 设置容器内空间是否可用 /// </summary> /// <param name="cnl">容器空间</param> /// <param name="isCanUse">是否可用</param> public void SetControlEnable(Control pControl, bool isCanUse) { foreach (Control cnl in pControl.Controls) { if (cnl is TextBox) { TextBox txt = cnl as TextBox; txt.ReadOnly = !isCanUse; } else if (cnl is CheckBox || cnl is DateTimePicker || cnl is ComboBox || cnl is NumericUpDown || cnl is RadioButton || cnl is Button) { cnl.Enabled = isCanUse; } else if (cnl is DataGridView) { DataGridView dgv = cnl as DataGridView; dgv.ReadOnly = !isCanUse; } else if (cnl is ServiceStationClient.ComponentUI.TextBox.TextChooser) { ServiceStationClient.ComponentUI.TextBox.TextChooser tc = (ServiceStationClient.ComponentUI.TextBox.TextChooser)cnl; tc.Enabled = isCanUse; } else if (cnl.HasChildren) { SetControlEnable(cnl, isCanUse); } } }
/// <summary> 绑定供应商名称到选择器 /// </summary> /// <param name="tc"></param> /// <param name="sqlString"></param> private static void Sup_NameBindData(TextChooser tc, string sqlString) { DataTable dt = CommonFuncCall.GetDataSource(sqlString); tc.SetDataSource(dt); if (dt != null) { tc.Search(); } }
/// <summary> /// 设置速查 /// </summary> /// <param name="sqlString"></param> void tc_GetDataSourced(TextChooser tc, string sqlString) { DataTable dvt = CommonFuncCall.GetDataSource(sqlString); tc.SetDataSource(dvt); if (dvt != null) { tc.Search(); } }
/// <summary> 供应商名称速查选择器 /// </summary> /// <param name="ContorlName">控件ID</param> /// <param name="delDataBack">回调函数</param> public static void SupperNameChoose(TextChooser ContorlName, GreetingDelegate delDataBack) { string table = "tb_supplier"; string valueColumn = "sup_full_name"; //设置表和显示字段 ContorlName.SetBindTable(table, valueColumn); ContorlName.GetDataSourced += new TextChooser.GetDataSourceHandler(Sup_NameBindData); if (delDataBack != null) { ContorlName.DataBacked -= new TextChooser.DataBackHandler(delDataBack); ContorlName.DataBacked += new TextChooser.DataBackHandler(delDataBack); } }
void txtcSupplier_GetDataSourced(TextChooser tc, string sqlString) { try { string fileds = "sup_code,sup_full_name"; sqlString = sqlString.Replace("*", fileds); DataTable dvt = CommonFuncCall.GetDataSource(sqlString); tc.SetDataSource(dvt); if (dvt != null) { tc.Search(); } } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); } }
/// <summary> 客户编码速查选择器 /// </summary> /// <param name="ContorlName">控件ID</param> /// <param name="delDataBack">回调函数</param> public static void CusCodeChoose(TextChooser ContorlName, GreetingDelegate delDataBack) { string table = "tb_customer"; string displayColumn = "cust_code"; string valueColumn = "cust_name"; //设置表和显示字段 ContorlName.SetBindTable(table, displayColumn, valueColumn); ContorlName.GetDataSourced += new TextChooser.GetDataSourceHandler(Cus_CodeBindData); if (delDataBack != null) { ContorlName.DataBacked -= new TextChooser.DataBackHandler(delDataBack); ContorlName.DataBacked += new TextChooser.DataBackHandler(delDataBack); } }
/// <summary> 配件车型名称速查选择器 /// </summary> /// <param name="ContorlName">控件ID</param> /// <param name="delDataBack">回调函数</param> public static void PartsCarModelNameChoose(TextChooser ContorlName, GreetingDelegate delDataBack) { string table = "tb_vehicle_models"; string valueColumn = "vm_name"; //设置表和显示字段 ContorlName.SetBindTable(table, valueColumn); ContorlName.GetDataSourced += new TextChooser.GetDataSourceHandler(PartsCarModel_NameBindData); if (delDataBack != null) { ContorlName.DataBacked -= new TextChooser.DataBackHandler(delDataBack); ContorlName.DataBacked += new TextChooser.DataBackHandler(delDataBack); } }
/// <summary> /// 设置速查 /// </summary> /// <param name="sqlString"></param> void tc_GetDataSourced(TextChooser tc, string sqlString) { if (sqlString.Contains("v_vehicle")) { string fileds = string.Format(" license_plate,vin,engine_num,v_model,v_brand,v_color,turner,cust_code,cust_id,cust_name,cont_name,{0} phone ", EncryptByDB.GetDesFieldValue("cont_phone")); sqlString = sqlString.Replace("*", fileds); } DataTable dvt = CommonFuncCall.GetDataSource(sqlString); tc.SetDataSource(dvt); if (dvt != null) { tc.Search(); } }
/// <summary> /// 导入预付 /// </summary> /// <param name="txtcCust"></param> /// <param name="lblCust"></param> void ImportYuFu(TextChooser txtcCust, Label lblCust) { if (txtcCust.Tag == null) { MessageBoxEx.Show(string.Format("请选择{0}!", lblCust.Text.TrimEnd(':'))); txtcCust.Focus(); return; } //frmBalanceDocuments frmDocuments = new frmBalanceDocuments(DataSources.EnumOrderType.PAYMENT, txtcCust.Tag.ToString(), ((int)DataSources.EnumPaymentType.ADVANCES).ToString()); frmPaymentByAdvances frmDocuments = new frmPaymentByAdvances(txtcCust.Tag.ToString()); if (frmDocuments.ShowDialog() == DialogResult.OK) { StringBuilder sbWhere = new StringBuilder(); sbWhere.AppendFormat("order_id in ({0})", frmDocuments.ids); sbWhere.AppendFormat(" and wait_money>0"); DataTable dt = DBHelper.GetTable("", "v_parts_purchase_order_payment", "*", sbWhere.ToString(), "", ""); foreach (DataRow dr in dt.Rows) { DataGridViewRow dgvr = dgvDocuments.Rows[dgvDocuments.Rows.Add()]; dgvr.Cells[colOrderName.Name].Value = "采购订单";//单据名称 dgvr.Cells[colOrderNum.Name].Value = dr["order_num"];//单据编号 dgvr.Cells[colOrderID.Name].Value = dr["sale_billing_id"];//单据ID //dgvr.Cells[colOrderDate.Name].Value = Common.UtcLongToLocalDateTime(dr["receivables_date"]);//单据日期 dgvr.Cells[colMoney.Name].Value = dr["prepaid_money"];//开单金额 dgvr.Cells[colSettledMoney.Name].Value = dr["money"];//已结算金额 dgvr.Cells[colWaitMoney.Name].Value = dr["wait_money"];//未结算金额 } } }
/// <summary> 绑定配件类型名称到选择器 /// </summary> /// <param name="tc"></param> /// <param name="sqlString"></param> private static void PartsType_NameBindData(TextChooser tc, string sqlString) { sqlString = string.Format(@"select dic_name from sys_dictionaries where dic_id not in (select parent_id from sys_dictionaries) and dic_name like '%{0}%'", tc.Text); DataTable dt = CommonFuncCall.GetDataSource(sqlString); tc.SetDataSource(dt); if (dt != null) { tc.Search(); } }
void txtcCustName_GetDataSourced(TextChooser tc, string sqlString) { try { if (sqlString.Contains("tb_customer")) { string fileds = "cust_name,cust_code"; sqlString = sqlString.Replace("*", fileds); } else if (sqlString.Contains("tb_supplier")) { string fileds = "sup_code,sup_full_name"; sqlString = sqlString.Replace("*", fileds); } DataTable dvt = CommonFuncCall.GetDataSource(sqlString); tc.SetDataSource(dvt); if (dvt != null) { tc.Search(); } } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); } }
/// <summary> /// 绑定配件速查 /// </summary> /// <param name="txtcParts"></param> public void BindParts(TextChooser txtcParts) { txtcParts.SetBindTable("tb_parts", "ser_parts_code", "parts_name"); txtcParts.GetDataSourced += new TextChooser.GetDataSourceHandler(txtcParts_GetDataSourced); }
/// <summary> /// 绑定供应商速查 /// </summary> /// <param name="txtcSupplier"></param> public void BindSupplier(TextChooser txtcSupplier) { //设置供应商编码速查 txtcSupplier.SetBindTable("tb_supplier", "sup_code", "sup_full_name"); txtcSupplier.GetDataSourced += new TextChooser.GetDataSourceHandler(txtcSupplier_GetDataSourced); }
/// <summary> /// 导入应收 /// </summary> /// <param name="txtcCust"></param> /// <param name="lblCust"></param> void ImportYingShou2(TextChooser txtcCust, Label lblCust) { if (txtcCust.Tag == null) { MessageBoxEx.Show(string.Format("请选择{0}!", lblCust.Text.TrimEnd(':'))); txtcCust.Focus(); return; } //frmReceivable frmDocuments = new frmReceivable(txtcCust.Tag.ToString()); frmReceivableByVerification frmDocuments = new frmReceivableByVerification(txtcCust.Tag.ToString()); if (frmDocuments.ShowDialog() == DialogResult.OK) { BindDocuments2(frmDocuments.listRows); } }
/// <summary> 配件类型名称速查选择器 /// </summary> /// <param name="ContorlName">控件ID</param> /// <param name="delDataBack">回调函数</param> public static void PartsTypeNameChoose(TextChooser ContorlName, GreetingDelegate delDataBack) { string table = "sys_dictionaries"; string valueColumn = "dic_name"; //设置表和显示字段 ContorlName.SetBindTable(table, valueColumn); ContorlName.GetDataSourced += new TextChooser.GetDataSourceHandler(PartsType_NameBindData); if (delDataBack != null) { ContorlName.DataBacked -= new TextChooser.DataBackHandler(delDataBack); ContorlName.DataBacked += new TextChooser.DataBackHandler(delDataBack); } }
/// <summary> /// 导入应付 /// </summary> /// <param name="txtcCust"></param> /// <param name="lblCust"></param> void ImportYingFu2(TextChooser txtcCust, Label lblCust) { if (txtcCust.Tag == null) { MessageBoxEx.Show(string.Format("请选择{0}!", lblCust.Text.TrimEnd(':'))); txtcCust.Focus(); return; } //frmBalanceDocuments frmDocuments = new frmBalanceDocuments(DataSources.EnumOrderType.PAYMENT, txtcCust.Tag.ToString(), ((int)DataSources.EnumPaymentType.PAYMENT).ToString()); frmPayment frmDocuments = new frmPayment(txtcCust.Tag.ToString()); if (frmDocuments.ShowDialog() == DialogResult.OK) { BindDocuments2(frmDocuments.listRows); } }
/// <summary> 绑定配件类型名称到选择器 /// </summary> /// <param name="tc"></param> /// <param name="sqlString"></param> private static void PartsType_NameBindData(TextChooser tc, string sqlString) { // sqlString = string.Format(@"select dic_name from sys_dictionaries where dic_id not in // (select parent_id from sys_dictionaries) and dic_name like '%{0}%'", tc.Text); // DataTable dt = CommonFuncCall.GetDataSource(sqlString); // tc.SetDataSource(dt); // if (dt != null) // { // tc.Search(); // } string dic_ids = string.Empty; List<string> list_dic_id=new List<string>(); CreateTreeViewChildNode(list_dic_id, "sys_parts_category"); if(list_dic_id.Count>0) { foreach (string dic_id in list_dic_id) { dic_ids += "'" + dic_id + "',"; } } dic_ids = dic_ids.Trim(','); sqlString = string.Format(@"select dic_name from sys_dictionaries where dic_id in ({0}) and dic_name like '%{1}%'", dic_ids, tc.Text); DataTable dt = CommonFuncCall.GetDataSource(sqlString); tc.SetDataSource(dt); if (dt != null) { tc.Search(); } }
/// <summary> /// 设置速查 /// </summary> /// <param name="sqlString"></param> void tc_GetDataSourced(TextChooser tc, string sqlString) { try { DataTable dvt = CommonFuncCall.GetDataSource(sqlString); tc.SetDataSource(dvt); if (dvt != null) { tc.Search(); } } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); } }
void txtcCustName_GetDataSourced(TextChooser tc, string sqlString) { try { if (sqlString.Contains("tb_customer")) { string tables = "tb_customer a left join sys_dictionaries b on a.open_bank=b.dic_id "; string fileds = "cust_id,cust_name,cust_code,bank_account,dic_name"; sqlString = sqlString.Replace("*", fileds); sqlString = sqlString.Replace("tb_customer", tables); } else if (sqlString.Contains("tb_supplier")) { string fileds = "sup_id,sup_code,sup_full_name"; sqlString = sqlString.Replace("*", fileds); } DataTable dvt = CommonFuncCall.GetDataSource(sqlString); tc.SetDataSource(dvt); if (dvt != null) { tc.Search(); } } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); } }