/// <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> 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 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; } } }
private void ReceiptModalDefineForm_Load(object sender, EventArgs e) { InitFuncs initFuncs = new InitFuncs(); if (this.type == "edit") { string strSqlSelect = "select * from T_ReceiptModal where ReceTypeID='{0}'"; strSqlSelect = string.Format(strSqlSelect, this.receTypeId); initFuncs.ShowDatas(this.panelReceiptModal, strSqlSelect); this.s_ReceTypeID.ReadOnly = true; } }
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 tabParent_SelectedIndexChanged(object sender, EventArgs e) { if (this.tabParent.SelectedIndex == 0) { DBUtil dbUtil = new DBUtil(); ////在窗口中初始化T_SysConfig InitFuncs inf = new InitFuncs(); string sel_sql = "select * from T_SysConfig "; inf.ShowDatas(this.panelSysConfig, sel_sql); // 特殊字段处理 string siteId = dbUtil.Get_Single_val("T_SysConfig", "DefaStoreHouseId", "SiteCode", this.s_SiteCode.Text.Trim()); comboBoxstore.Text = dbUtil.Get_Single_val("T_StoreHouse", "SHName", "SHId", siteId); //if (s_SiteCode.Text.Trim() != "") //{ // s_SiteCode.ReadOnly = true; //} this.dataGridView1.DataSource = null; } else if (this.tabParent.SelectedIndex == 2) { //在窗口中初始化T_SelItems InitDataGridView("T_SelItems"); //升序排序 string sql = "select distinct ItemType from T_SelItems order by 1"; DataTable dt = (new SqlDBConnect()).Get_Dt(sql); return; } }
private void CustomerInfAdd_Load(object sender, EventArgs e) { //初始化ComboBox InitFuncs inf = new InitFuncs(); inf.InitComboBox(this.s_CustType, "[客户]类别"); inf.InitComboBox(this.s_Degree, "[客户]等级"); inf.InitComboBox(this.s_whichTrade, "[客户]所在行业"); inf.InitComboBox(this.s_Country, "[客户]国家"); inf.InitComboBox(this.s_Province, "[客户]省"); inf.InitComboBox(this.s_City, "[客户]城市"); inf.InitComboBox(this.t_AreaCode, "T_AreaInf", "Area"); inf.InitComboBox(this.t_ImportanceDegreeId, "T_CustomerImp", "importance"); if (custid.Trim() == "") { tabControl1.Enabled = false; } else { tabControl1.Enabled = true ; } s_InputTime.Text = DBUtil.getServerTime().ToString(); if (this.type == "edit") { this.s_CustID.ReadOnly = true; string strsql = "select * from T_CustomerInf where CustID='{0}'"; strsql = string.Format(strsql, this.custid); inf.ShowDatas(this.panelcustomer, strsql); //以下两行必须在ShowDatas后 DBUtil dbUtil = new DBUtil(); t_AreaCode.Text = (new DBUtil()).Get_Single_val("T_AreaInf", "Area", "areaId", S_AreaCode.Text.Trim()); t_ImportanceDegreeId.Text = (new DBUtil()).Get_Single_val("T_CustomerImp", "importance", "Iid", S_ImportanceDegreeId.Text.Trim()); //初始化抬头 SqlDBConnect SDB = new SqlDBConnect(); s_BillHead.Clear(); string strSql = "select BillHead as 发票抬头 from T_CustomerTitle where CustID='{0}'";//"select * from T_SelItems where ItemType='{0}'"; strSql = string.Format(strSql, s_CustID.Text.Trim()); DataSet ds = SDB.Get_Ds(strSql); int Lins = ds.Tables[0].Rows.Count; string[] match = new string[ds.Tables[0].Rows.Count]; for (int i = 0; i < match.Length; i++) { s_BillHead.Text += ds.Tables[0].Rows[i]["发票抬头"].ToString() + "\r\n";//回车换行 } } if (this.custid!="") {//初始化联系人; init_lxr(); //初始化发票 init_fp(); //初始化多地址 init_muladd(); } //限制值类型文本框的输入 (new InitFuncs()).Num_limited(this.panelcustomer); }
private void CustomerCallAdd_Load(object sender, EventArgs e) { string sql_=""; string curtime_ = ""; s_Technician1.KeyDown+=new KeyEventHandler(InfoFind.UserName_KeyDown); s_Technician2.KeyDown += new KeyEventHandler(InfoFind.UserName_KeyDown); //区域:报修内容 (new InitFuncs()).InitComboBox(this.s_Teltrbtype, "T_TelTrbType", "telmemo"); //合同:有码数据初始化 (new InitFuncs()).InitComboBox(this.t_WorkType, "T_WorkType", "wcName"); //工作类别 // 合同:无码数据初始化 InitFuncs inf = new InitFuncs(); inf.InitComboBox(this.s_UrgentDegree, "[召唤]紧急程度"); inf.InitComboBox(this.s_ActionResults, "[召唤]行动结果"); DBUtil dbu = new DBUtil(); if (type == "add") { this.n_endflag.Text = "0"; //未派 s_operauser.Text = this.CurrentUser; n_cmsysid.Text = this.cmsysid; //根据Cmsysid得到<机型>、<机号>、<客户编号> this.s_mtype.Text = dbu.Get_Single_val("T_CustomerMac", "mType", "sysid", this.cmsysid); this.s_ManufactCode.Text = dbu.Get_Single_val("T_CustomerMac", "Manufactcode", "sysid", this.cmsysid); this.s_CustCode.Text = dbu.Get_Single_val("T_CustomerMac", "custid", "sysid", this.cmsysid); //获取预定技术员 this.s_Technician1.Text = dbu.Get_Single_val("T_CustomerMac", "ptech", "sysid", this.cmsysid); // curtime_ = DBUtil.getServerTime().ToString(); //查找或获取关联值 s_CallDate.Text = Convert.ToDateTime(curtime_).ToShortDateString(); s_CallTime.Text = Convert.ToDateTime(curtime_).ToShortTimeString(); } else { sql_ = "select * from T_CustomerCall where sysid=" + this.CallId ; inf.ShowDatas(this.panelCustCall, sql_); this.cmsysid = this.n_cmsysid.Text.Trim(); // t_WorkType.Text = (new DBUtil()).Get_Single_val("T_worktype", "wcname", "wcid", s_WorkType.Text.Trim()); this.s_CallDate.Text = Convert.ToDateTime(s_CallDate.Text).ToShortDateString(); this.s_CallTime.Text = Convert.ToDateTime(s_CallTime.Text).ToShortTimeString(); if (n_endflag.Text == "已派") { btn_time.Visible = true; } else { btn_time.Visible = false; } } this.t_CustCode.Text = dbu.Get_Single_val("T_CustomerMac", "Mdepart", "sysid", this.cmsysid); //根据Cmsysid得到<合同信息>//得到合同类别 sql_ = "select ContractType from T_Bargains where MachineId=" + this.cmsysid; this.lb_bargainType.Text = "合同类别:" + dbu.Get_Single_val(sql_); //显示联系人列表 show_contacts(this.cmsysid); }
private void dataGridViewMenuChid_CellClick(object sender, DataGridViewCellEventArgs e) { if (this.dataGridViewMenuChid.SelectedRows.Count <= 0) return; this.curRowIndex = e.RowIndex; string strSysId = this.dataGridViewMenuChid.SelectedRows[0].Cells["编号"].Value.ToString().Trim(); if (strSysId == "") return; int intSyId = Convert.ToInt32(strSysId); this.txtSysid.Text = strSysId; string strSql = "select * from T_MenuCfgChild where SysId={0}"; strSql = string.Format(strSql, intSyId); InitFuncs initFuncs = new InitFuncs(); initFuncs.ShowDatas(this.panelMenuChild, strSql);//// this.comboBoxMainMenu.Text = (new DBUtil()).Get_Single_val("T_MenuCfgMain", "MainMenu", "Sysid", this.n_MainMenuId.Text.Trim()); this.comboBoxReceName.Text = (new DBUtil()).Get_Single_val("T_ReceiptModal", "ReceName", "ReceTypeID", this.s_SubMenu.Text.Trim()); this.isAdd = false;//修改 }
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); } }
/// <summary> /// 单击GridView的一行 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dataGridViewRoles_CellClick(object sender, DataGridViewCellEventArgs e) { this.curSelectRowIndex = e.RowIndex; this.s_RoleId.ReadOnly = true; string roleId = this.dataGridViewRoles.SelectedRows[0].Cells["角色编号"].Value.ToString().Trim(); if (roleId == "") return; string strSql = "select * from T_Roles where RoleId='{0}'"; strSql = string.Format(strSql, roleId); InitFuncs initFuncs = new InitFuncs(); initFuncs.ShowDatas(this.panelRoles, strSql); //处理DataGridView //先置空 SetTreeViewNull(this.treeViewMenus.Nodes); List<string> listFunction = RoleRightsDAO.GetFunctionById(roleId); SetUserPermission(this.treeViewMenus, listFunction); }
private void EditUserForm_Load(object sender, EventArgs e) { //初始化ComboBox InitFuncs initFuncs = new InitFuncs(); initFuncs.InitComboBox(this.comboBoxBranch, "T_Branch", "BName"); initFuncs.InitComboBox(this.comboBoxType, "T_UserType", "UTypeName"); // 合同:无码数据初始化 initFuncs.InitComboBox(this.s_groups, "[用户]所属组"); DBUtil dbUtil = new DBUtil(); if (this.type == "edit") { string strSql = "select * from T_Users where UserId='{0}'"; strSql = string.Format(strSql, this.userId); initFuncs.ShowDatas(this.panelUser, strSql); //处理ComboBox this.comboBoxBranch.Text = dbUtil.Get_Single_val("T_Branch", "BName", "BId", this.s_BranchId.Text.Trim()); this.comboBoxType.Text = dbUtil.Get_Single_val("T_UserType", "UtypeName", "TypeId", this.s_DefaultUserType.Text.Trim()); //处理CheckBox //string strYNAdmin = UsersDAO.GetYNAdmin(this.userId); //if (strYNAdmin == "True") // this.s_ynAdmin.Checked = true; //else // this.s_ynAdmin.Checked = false; //处理确认密码 this.txtPasswordCheck.Text = (new DBUtil()).Get_Single_val("T_Users", "PassWord", "UserId", this.userId); this.s_UserId.ReadOnly = true; } }