//绑定数据 void BindData() { //dt = DBHelper.GetTable("", "v_repair_overdue_report", "*,datediff(d,最后日期,getdate()) 无服务天数", GetWhere(), "", ""); StringBuilder sbWhere = new StringBuilder(); sbWhere.AppendFormat(" and b.create_time>{0}", Common.LocalDateTimeToUtcLong(dtpStartDate.Value.Date)); //sbWhere.AppendFormat(" and datediff(d,DATEADD(s,c.create_time/1000,''1970-01-01 08:00:00''),getdate())>={0}", nudDay.Value); StringBuilder sbWhere2 = new StringBuilder(); sbWhere2.AppendFormat(" and make_time>{0}", Common.LocalDateTimeToUtcLong(dtpStartDate.Value.Date)); //sbWhere2.AppendFormat(" and datediff(d,DATEADD(s,make_time/1000,''1970-01-01 08:00:00''),getdate())>={0}", nudDay.Value); //公司 string comID = CommonCtrl.IsNullToString(cboCompany.SelectedValue); if (comID.Length > 0) { sbWhere.AppendFormat(" and com_id='{0}'", comID); sbWhere2.AppendFormat(" and com_id='{0}'", comID); } //车牌号 string vehicle_no = txtclicense_plate.Text.Trim(); if (vehicle_no.Length > 0) { sbWhere.AppendFormat(" and vehicle_no like '%{0}%'", vehicle_no); sbWhere2.AppendFormat(" and vehicle_no like '%{0}%'", vehicle_no); } //车型 string vehicle_model = txtvehicle_models.Text.Trim(); if (vehicle_model.Length > 0) { sbWhere.AppendFormat(" and vm_name like '%{0}%'", vehicle_model); sbWhere2.AppendFormat(" and vm_name like '%{0}%'", vehicle_model); } SYSModel.SQLObj sql = new SYSModel.SQLObj(); sql.cmdType = CommandType.StoredProcedure; sql.sqlString = "p_repair_overdue_report"; sql.Param = new Dictionary <string, SYSModel.ParamObj>(); sql.Param.Add("where", new SYSModel.ParamObj("where", sbWhere.ToString(), SYSModel.SysDbType.NVarChar, 200)); sql.Param.Add("where2", new SYSModel.ParamObj("where2", sbWhere2.ToString(), SYSModel.SysDbType.NVarChar, 200)); sql.Param.Add("day", new SYSModel.ParamObj("day", nudDay.Value.ToString(), SYSModel.SysDbType.VarChar, 10)); DataSet ds = DBHelper.GetDataSet("获取超期无服务车辆统计", sql); if (ds != null && ds.Tables.Count == 1) { dt = ds.Tables[0]; if (dt != null && dt.Rows.Count > 0) { dt.DefaultView.Sort = "无服务天数"; } } dgvReport.DataSource = dt; }
private void UCRoleAddOrEdit_Load(object sender, EventArgs e) { base.SetOpButtonVisible(uc.Name); DataGridViewEx.SetDataGridViewStyle(dgvFunction); dgvFunction.ReadOnly = false; base.SetBtnStatus(wStatus); if (wStatus == WindowStatus.Edit || wStatus == WindowStatus.Copy) { DataTable dt = DBHelper.GetTable("查询角色", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, "sys_role", "*", "role_id='" + id + "'", "", ""); if (dt.Rows.Count <= 0) { MessageBoxEx.Show("查询角色失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } role_code = dt.Rows[0]["role_code"].ToString(); if (role_code == "system") { txtRole_code.Enabled = false; txtRole_name.Enabled = false; } txtRole_code.Caption = dt.Rows[0]["role_code"].ToString(); txtRole_name.Caption = dt.Rows[0]["Role_name"].ToString(); txtremark.Caption = dt.Rows[0]["remark"].ToString(); string strSql = "select u.user_id,u.user_code,u.user_name,u.user_phone,u.com_name,u.org_id,u.remark, u.org_name from v_User u ,tr_user_role ur,sys_role r " + " where u.user_id=ur.user_id and r.role_id=ur.role_id and r.enable_flag='1' and r.role_id='" + id + "' "; SYSModel.SQLObj sqlobj = new SYSModel.SQLObj(); sqlobj.cmdType = CommandType.Text; sqlobj.Param = new Dictionary <string, SYSModel.ParamObj>(); sqlobj.sqlString = strSql; DataSet ds = DBHelper.GetDataSet("查询用户角色关系", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, sqlobj); //dgvUser.DataSource = ds.Tables[0].DefaultView; if (ds != null && ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { userIdList.Add(dr["user_id"].ToString()); DataGridViewRow gvr = dgvUser.Rows[dgvUser.Rows.Add()]; gvr.Cells["user_id"].Value = dr["user_id"]; gvr.Cells["user_code"].Value = dr["user_code"]; gvr.Cells["user_name"].Value = dr["user_name"]; gvr.Cells["com_name"].Value = dr["com_name"]; gvr.Cells["org_name"].Value = dr["org_name"]; gvr.Cells["user_phone"].Value = dr["user_phone"]; gvr.Cells["remark"].Value = dr["remark"]; } iUserRoleCount = ds.Tables[0].Rows.Count; } } bindTree(); }
private void GetData() { try { string strsql = "select c.com_code,c.com_name,o.org_code,o.org_name,o.org_id,c.legal_person,c.com_contact,c.com_tel,o.contact_name,o.contact_telephone " + " from tb_organization o left join tb_company c on o.com_id=c.com_id where c.enable_flag='1' and o.enable_flag='1' "; if (!string.IsNullOrEmpty(this.txtCom_code.Caption.Trim())) { strsql += " and c.com_code like '%" + this.txtCom_code.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtcom_name.Caption.Trim())) { strsql += " and c.com_name like '%" + this.txtcom_name.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtorg_code.Caption.Trim())) { strsql += " and o.org_code like '%" + this.txtorg_code.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtorg_name.Caption.Trim())) { strsql += " and o.org_name like '%" + this.txtorg_name.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtlegal_person.Caption.Trim())) { strsql += " and c.legal_person like '%" + this.txtlegal_person.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtcontact_name.Caption.Trim())) { strsql += " and c.com_contact like '%" + this.txtcontact_name.Caption.Trim() + "%' and o.contact_name like '%" + this.txtcontact_name.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtPhone.Caption.Trim())) { strsql += " and c.com_tel like '%" + this.txtPhone.Caption.Trim() + "%' and o.contact_telephone like '%" + this.txtPhone.Caption.Trim() + "%' "; } strsql += " order by c.com_name"; SYSModel.SQLObj sqlobj = new SYSModel.SQLObj(); sqlobj.cmdType = CommandType.Text; sqlobj.Param = new Dictionary <string, SYSModel.ParamObj>(); sqlobj.sqlString = strsql; DataSet ds = DBHelper.GetDataSet("查询组织-组织选择器", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, sqlobj); dgvOrg.DataSource = ds.Tables[0].DefaultView; } catch (Exception ex) { GlobalStaticObj_Server.GlobalLogService.WriteLog("选择器-组织", ex); MessageBoxEx.ShowWarning("程序异常"); } }
//绑定数据 void BindData() { //dt = DBHelper.GetTable("", "v_repair_overdue_report", "*,datediff(d,最后日期,getdate()) 无服务天数", GetWhere(), "", ""); StringBuilder sbWhere = new StringBuilder(); sbWhere.AppendFormat(" and b.create_time>{0}", Common.LocalDateTimeToUtcLong(dtpStartDate.Value.Date)); //sbWhere.AppendFormat(" and datediff(d,DATEADD(s,c.create_time/1000,''1970-01-01 08:00:00''),getdate())>={0}", nudDay.Value); StringBuilder sbWhere2 = new StringBuilder(); sbWhere2.AppendFormat(" and make_time>{0}", Common.LocalDateTimeToUtcLong(dtpStartDate.Value.Date)); //sbWhere2.AppendFormat(" and datediff(d,DATEADD(s,make_time/1000,''1970-01-01 08:00:00''),getdate())>={0}", nudDay.Value); //公司 string comID = CommonCtrl.IsNullToString(cboCompany.SelectedValue); if (comID.Length > 0) { sbWhere.AppendFormat(" and com_id='{0}'", comID); sbWhere2.AppendFormat(" and com_id='{0}'", comID); } //车牌号 string vehicle_no = txtclicense_plate.Text.Trim(); if (vehicle_no.Length > 0) { sbWhere.AppendFormat(" and vehicle_no like '%{0}%'", vehicle_no); sbWhere2.AppendFormat(" and vehicle_no like '%{0}%'", vehicle_no); } //车型 string vehicle_model = txtvehicle_models.Text.Trim(); if (vehicle_model.Length > 0) { sbWhere.AppendFormat(" and vm_name like '%{0}%'", vehicle_model); sbWhere2.AppendFormat(" and vm_name like '%{0}%'", vehicle_model); } SYSModel.SQLObj sql = new SYSModel.SQLObj(); sql.cmdType = CommandType.StoredProcedure; sql.sqlString = "p_repair_overdue_report"; sql.Param = new Dictionary<string, SYSModel.ParamObj>(); sql.Param.Add("where", new SYSModel.ParamObj("where", sbWhere.ToString(), SYSModel.SysDbType.NVarChar, 200)); sql.Param.Add("where2", new SYSModel.ParamObj("where2", sbWhere2.ToString(), SYSModel.SysDbType.NVarChar, 200)); sql.Param.Add("day", new SYSModel.ParamObj("day", nudDay.Value.ToString(), SYSModel.SysDbType.VarChar, 10)); DataSet ds = DBHelper.GetDataSet("获取超期无服务车辆统计", sql); if (ds != null && ds.Tables.Count == 1) { dt = ds.Tables[0]; if (dt != null && dt.Rows.Count > 0) { dt.DefaultView.Sort = "无服务天数"; } } dgvReport.DataSource = dt; }
private void GetData() { string strsql = "select c.com_code,c.com_name,o.org_code,o.org_name,o.org_id,c.legal_person,c.com_contact,c.com_tel,o.contact_name,o.contact_telephone " + " from tb_organization o left join tb_company c on o.com_id=c.com_id where c.enable_flag='1' and o.enable_flag='1' "; if (!string.IsNullOrEmpty(this.txtCom_code.Caption.Trim())) { strsql += " and c.com_code like '%" + this.txtCom_code.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtcom_name.Caption.Trim())) { strsql += " and c.com_name like '%" + this.txtcom_name.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtorg_code.Caption.Trim())) { strsql += " and o.org_code like '%" + this.txtorg_code.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtorg_name.Caption.Trim())) { strsql += " and o.org_name like '%" + this.txtorg_name.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtlegal_person.Caption.Trim())) { strsql += " and c.legal_person like '%" + this.txtlegal_person.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtcontact_name.Caption.Trim())) { strsql += " and c.com_contact like '%" + this.txtcontact_name.Caption.Trim() + "%' and o.contact_name like '%" + this.txtcontact_name.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtPhone.Caption.Trim())) { strsql += " and c.com_tel like '%" + this.txtPhone.Caption.Trim() + "%' and o.contact_telephone like '%" + this.txtPhone.Caption.Trim() + "%' "; } strsql += " order by c.com_name"; SYSModel.SQLObj sqlobj = new SYSModel.SQLObj(); sqlobj.cmdType = CommandType.Text; sqlobj.Param = new Dictionary <string, SYSModel.ParamObj>(); sqlobj.sqlString = strsql; DataSet ds = DBHelper.GetDataSet("查询组织-组织选择器", sqlobj); dgvOrg.DataSource = ds.Tables[0].DefaultView; }
/// <summary> dtFun表结构 /// </summary> private void dtFunction() { StringBuilder strBD; if (windowStatus == WindowStatus.Add) { strBD = new StringBuilder(); strBD.Append(" select fun_id,num,fun_name,fun_ename,fun_uri ,fun_img,parent_id,fun_cbs ,fun_level ,fun_idx ,fun_flag ,fun_run "); strBD.Append(",CONVERT(bit,button_add) button_add ,CONVERT(bit,button_edit) button_edit "); strBD.Append(" ,CONVERT(bit,button_delete)button_delete,CONVERT(bit,button_save ) button_save ,CONVERT(bit,button_cancel) button_cancel "); strBD.Append(" ,CONVERT(bit,button_view) button_view,CONVERT(bit,button_status) button_status,CONVERT(bit,button_download) button_download,CONVERT(bit,button_shotoff) button_shotoff,CONVERT(bit,button_set) button_set,CONVERT(bit,button_refresh) button_refresh,CONVERT(bit,button_viewlist) button_viewlist,CONVERT(bit,button_resetpwd) button_resetpwd,CONVERT(bit,button_backup) button_backup "); strBD.Append(" ,CONVERT(bit,button_restore) button_restore,CONVERT(bit,button_import) button_import,CONVERT(bit,button_export) button_export "); strBD.Append(" ,CONVERT(bit,button_print) button_print ,CONVERT(bit,button_preview) button_preview "); strBD.Append(" ,CONVERT(bit,button_sync) button_sync,CONVERT(bit,button_oprecord) button_oprecord, "); strBD.Append(" CONVERT(bit, '0') as isall from sys_function where fun_run='1' and fun_flag='1' and enable_flag='1' "); } else { strBD = new StringBuilder(); strBD.Append("select "); strBD.Append("f.fun_id,CONVERT(int,f.num) num,f.fun_name,f.fun_ename,f.fun_uri ,f.fun_img,f.parent_id,f.fun_cbs ,CONVERT(int,f.fun_level) fun_level,f.fun_idx ,CONVERT(int,f.fun_flag) fun_flag,CONVERT(int,f.fun_run) fun_run "); strBD.Append(",CONVERT(bit,rf.button_add) button_add ,CONVERT(bit,rf.button_edit) button_edit "); strBD.Append(" ,CONVERT(bit,rf.button_delete)button_delete,CONVERT(bit,rf.button_save ) button_save ,CONVERT(bit,rf.button_cancel) button_cancel "); strBD.Append(" ,CONVERT(bit,rf.button_view) button_view,CONVERT(bit,rf.button_status) button_status,CONVERT(bit,rf.button_download) button_download,CONVERT(bit,rf.button_shotoff) button_shotoff,CONVERT(bit,rf.button_set) button_set,CONVERT(bit,rf.button_refresh) button_refresh,CONVERT(bit,rf.button_viewlist) button_viewlist,CONVERT(bit,rf.button_resetpwd) button_resetpwd,CONVERT(bit,rf.button_backup) button_backup "); strBD.Append(" ,CONVERT(bit,rf.button_restore) button_restore,CONVERT(bit,rf.button_import) button_import,CONVERT(bit,rf.button_export) button_export "); strBD.Append(" ,CONVERT(bit,rf.button_print) button_print ,CONVERT(bit,rf.button_preview) button_preview "); strBD.Append(" ,CONVERT(bit,rf.button_sync) button_sync,CONVERT(bit,rf.button_oprecord) button_oprecord ");; strBD.Append("from sys_function f ,tr_role_function rf,sys_role r "); strBD.Append("where "); strBD.Append("rf.role_id =r.role_id and rf.fun_id=f.fun_id "); strBD.Append("and r.role_id='" + id + "' "); strBD.Append("and f.fun_flag='1' and f.enable_flag='1' "); strBD.Append("order by f.fun_idx; "); } SYSModel.SQLObj sobj = new SYSModel.SQLObj(); sobj.cmdType = CommandType.Text; sobj.Param = new Dictionary <string, SYSModel.ParamObj>(); sobj.sqlString = strBD.ToString(); dtFun = DBHelper.GetDataSet("查询角色权限", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, sobj).Tables[0]; }
/// <summary> /// 公司组织树 /// </summary> private void BindTree() { string strSql = "select '0' as ftype, c.com_id as id,c.parent_id,'' as ocom_id,c.com_code as code,c.com_name as name from tb_company c where c.enable_flag ='1' union all " + "select '1' as ftype, o.org_id as id,o.parent_id,o.com_id as ocom_id,o.org_code as code,o.org_name as name from tb_company c,tb_organization o where " + " c.enable_flag ='1' and o.enable_flag='1' and c.com_id=o.com_id "; SYSModel.SQLObj sqlobj = new SYSModel.SQLObj(); sqlobj.cmdType = CommandType.Text; sqlobj.Param = new Dictionary <string, SYSModel.ParamObj>(); sqlobj.sqlString = strSql; DataSet ds = DBHelper.GetDataSet("查询公司组织树", sqlobj); tvCompany.Nodes.Clear(); //节点加上去 if (ds.Tables[0].Rows.Count > 0) { InitTree(this.tvCompany.Nodes, "-1", ds.Tables[0].DefaultView); if (tvCompany.Nodes.Count > 0) { tvCompany.Nodes[0].Expand(); } } }
private void GetData() { try { string strsql = "select c.com_code,c.com_name,o.org_code,o.org_name,o.org_id,c.legal_person,c.com_contact,c.com_tel,o.contact_name,o.contact_telephone " + " from tb_organization o left join tb_company c on o.com_id=c.com_id where c.enable_flag='1' and o.enable_flag='1' "; if (!string.IsNullOrEmpty(this.txtCom_code.Caption.Trim())) { strsql += " and c.com_code like '%" + this.txtCom_code.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtcom_name.Caption.Trim())) { strsql += " and c.com_name like '%" + this.txtcom_name.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtorg_code.Caption.Trim())) { strsql += " and o.org_code like '%" + this.txtorg_code.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtorg_name.Caption.Trim())) { strsql += " and o.org_name like '%" + this.txtorg_name.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtlegal_person.Caption.Trim())) { strsql += " and c.legal_person like '%" + this.txtlegal_person.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtcontact_name.Caption.Trim())) { strsql += " and c.com_contact like '%" + this.txtcontact_name.Caption.Trim() + "%' and o.contact_name like '%" + this.txtcontact_name.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtPhone.Caption.Trim())) { strsql += " and c.com_tel like '%" + this.txtPhone.Caption.Trim() + "%' and o.contact_telephone like '%" + this.txtPhone.Caption.Trim() + "%' "; } strsql += " order by c.com_name"; SYSModel.SQLObj sqlobj = new SYSModel.SQLObj(); sqlobj.cmdType = CommandType.Text; sqlobj.Param = new Dictionary<string, SYSModel.ParamObj>(); sqlobj.sqlString = strsql; DataSet ds = DBHelper.GetDataSet("查询组织-组织选择器", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, sqlobj); dgvOrg.DataSource = ds.Tables[0].DefaultView; } catch (Exception ex) { Utility.Log.Log.writeLineToLog(ex.Message, "选择器-组织信息数据查询失败"); MessageBoxEx.ShowWarning("查询失败"); } }
/// <summary> /// 公司组织树 /// </summary> private void BindTree() { string strSql = "select '0' as ftype, c.com_id as id,c.parent_id,'' as ocom_id,c.com_code as code,c.com_name as name from tb_company c where c.enable_flag ='1' union all " + "select '1' as ftype, o.org_id as id,o.parent_id,o.com_id as ocom_id,o.org_code as code,o.org_name as name from tb_company c,tb_organization o where " + " c.enable_flag ='1' and o.enable_flag='1' and c.com_id=o.com_id "; SYSModel.SQLObj sqlobj = new SYSModel.SQLObj(); sqlobj.cmdType = CommandType.Text; sqlobj.Param = new Dictionary<string, SYSModel.ParamObj>(); sqlobj.sqlString = strSql; DataSet ds = DBHelper.GetDataSet("查询公司组织树", sqlobj); tvCompany.Nodes.Clear(); //节点加上去 if (ds.Tables[0].Rows.Count > 0) { InitTree(this.tvCompany.Nodes, "-1", ds.Tables[0].DefaultView); if (tvCompany.Nodes.Count > 0) { tvCompany.Nodes[0].Expand(); } } }
private void UCRoleAddOrEdit_Load(object sender, EventArgs e) { base.SetOpButtonVisible(uc.Name); DataGridViewEx.SetDataGridViewStyle(dgvFunction); dgvFunction.ReadOnly = false; base.SetBtnStatus(windowStatus); if (windowStatus == WindowStatus.View) { Common.SetControlEnable(this, false); } dtFunction(); if (windowStatus == WindowStatus.Edit || windowStatus == WindowStatus.Copy) { DataTable dt = DBHelper.GetTable("查询角色", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, "sys_role", "*", "role_id='" + id + "'", "", ""); if (dt.Rows.Count <= 0) { MessageBoxEx.Show("查询角色失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } role_code = dt.Rows[0]["role_code"].ToString(); if (role_code == "system") { txtRole_code.Enabled = false; txtRole_name.Enabled = false; } txtRole_code.Caption = dt.Rows[0]["role_code"].ToString(); txtRole_name.Caption = dt.Rows[0]["Role_name"].ToString(); txtremark.Caption = dt.Rows[0]["remark"].ToString(); string strSql = "select u.user_id,u.user_code,u.user_name,u.user_phone,u.com_name,u.org_id,u.remark, u.org_name from v_User u ,tr_user_role ur,sys_role r " + " where u.user_id=ur.user_id and r.role_id=ur.role_id and r.enable_flag='1' and r.role_id='" + id + "' "; SYSModel.SQLObj sqlobj = new SYSModel.SQLObj(); sqlobj.cmdType = CommandType.Text; sqlobj.Param = new Dictionary<string, SYSModel.ParamObj>(); sqlobj.sqlString = strSql; DataSet ds = DBHelper.GetDataSet("查询用户角色关系", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, sqlobj); //dgvUser.DataSource = ds.Tables[0].DefaultView; if (ds != null && ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { userIdList.Add(dr["user_id"].ToString()); DataGridViewRow gvr = dgvUser.Rows[dgvUser.Rows.Add()]; gvr.Cells["user_id"].Value = dr["user_id"]; gvr.Cells["user_code"].Value = dr["user_code"]; gvr.Cells["user_name"].Value = dr["user_name"]; gvr.Cells["com_name"].Value = dr["com_name"]; gvr.Cells["org_name"].Value = dr["org_name"]; gvr.Cells["user_phone"].Value = dr["user_phone"]; gvr.Cells["remark"].Value = dr["remark"]; } iUserRoleCount = ds.Tables[0].Rows.Count; } } else { txtRole_code.Caption = CommonUtility.GetNewNo(SYSModel.DataSources.EnumProjectType.Role); } bindTree(); }
/// <summary> dtFun表结构 /// </summary> private void dtFunction() { StringBuilder strBD; if (windowStatus == WindowStatus.Add) { strBD = new StringBuilder(); strBD.Append(" select fun_id,num,fun_name,fun_ename,fun_uri ,fun_img,parent_id,fun_cbs ,fun_level ,fun_idx ,fun_flag ,fun_run "); strBD.Append(",CONVERT(bit,button_add) button_add ,CONVERT(bit,button_edit) button_edit "); strBD.Append(" ,CONVERT(bit,button_delete)button_delete,CONVERT(bit,button_save ) button_save ,CONVERT(bit,button_cancel) button_cancel "); strBD.Append(" ,CONVERT(bit,button_view) button_view,CONVERT(bit,button_status) button_status,CONVERT(bit,button_download) button_download,CONVERT(bit,button_shotoff) button_shotoff,CONVERT(bit,button_set) button_set,CONVERT(bit,button_refresh) button_refresh,CONVERT(bit,button_viewlist) button_viewlist,CONVERT(bit,button_resetpwd) button_resetpwd,CONVERT(bit,button_backup) button_backup "); strBD.Append(" ,CONVERT(bit,button_restore) button_restore,CONVERT(bit,button_import) button_import,CONVERT(bit,button_export) button_export "); strBD.Append(" ,CONVERT(bit,button_print) button_print ,CONVERT(bit,button_preview) button_preview "); strBD.Append(" ,CONVERT(bit,button_sync) button_sync,CONVERT(bit,button_oprecord) button_oprecord, "); strBD.Append(" CONVERT(bit, '0') as isall from sys_function where fun_run='1' and fun_flag='1' and enable_flag='1' "); } else { strBD = new StringBuilder(); strBD.Append("select "); strBD.Append("f.fun_id,CONVERT(int,f.num) num,f.fun_name,f.fun_ename,f.fun_uri ,f.fun_img,f.parent_id,f.fun_cbs ,CONVERT(int,f.fun_level) fun_level,f.fun_idx ,CONVERT(int,f.fun_flag) fun_flag,CONVERT(int,f.fun_run) fun_run "); strBD.Append(",CONVERT(bit,rf.button_add) button_add ,CONVERT(bit,rf.button_edit) button_edit "); strBD.Append(" ,CONVERT(bit,rf.button_delete)button_delete,CONVERT(bit,rf.button_save ) button_save ,CONVERT(bit,rf.button_cancel) button_cancel "); strBD.Append(" ,CONVERT(bit,rf.button_view) button_view,CONVERT(bit,rf.button_status) button_status,CONVERT(bit,rf.button_download) button_download,CONVERT(bit,rf.button_shotoff) button_shotoff,CONVERT(bit,rf.button_set) button_set,CONVERT(bit,rf.button_refresh) button_refresh,CONVERT(bit,rf.button_viewlist) button_viewlist,CONVERT(bit,rf.button_resetpwd) button_resetpwd,CONVERT(bit,rf.button_backup) button_backup "); strBD.Append(" ,CONVERT(bit,rf.button_restore) button_restore,CONVERT(bit,rf.button_import) button_import,CONVERT(bit,rf.button_export) button_export "); strBD.Append(" ,CONVERT(bit,rf.button_print) button_print ,CONVERT(bit,rf.button_preview) button_preview "); strBD.Append(" ,CONVERT(bit,rf.button_sync) button_sync,CONVERT(bit,rf.button_oprecord) button_oprecord "); ; strBD.Append("from sys_function f ,tr_role_function rf,sys_role r "); strBD.Append("where "); strBD.Append("rf.role_id =r.role_id and rf.fun_id=f.fun_id "); strBD.Append("and r.role_id='" + id + "' "); strBD.Append("and f.fun_flag='1' and f.enable_flag='1' "); strBD.Append("order by f.fun_idx; "); } SYSModel.SQLObj sobj = new SYSModel.SQLObj(); sobj.cmdType = CommandType.Text; sobj.Param = new Dictionary<string, SYSModel.ParamObj>(); sobj.sqlString = strBD.ToString(); dtFun = DBHelper.GetDataSet("查询角色权限", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, sobj).Tables[0]; }
private void GetData() { string strsql = "select c.com_code,c.com_name,o.org_code,o.org_name,o.org_id,c.legal_person,c.com_contact,c.com_tel,o.contact_name,o.contact_telephone " + " from tb_organization o left join tb_company c on o.com_id=c.com_id where c.enable_flag='1' and o.enable_flag='1' "; if (!string.IsNullOrEmpty(this.txtCom_code.Caption.Trim())) { strsql += " and c.com_code like '%" + this.txtCom_code.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtcom_name.Caption.Trim())) { strsql += " and c.com_name like '%" + this.txtcom_name.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtorg_code.Caption.Trim())) { strsql += " and o.org_code like '%" + this.txtorg_code.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtorg_name.Caption.Trim())) { strsql += " and o.org_name like '%" + this.txtorg_name.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtlegal_person.Caption.Trim())) { strsql += " and c.legal_person like '%" + this.txtlegal_person.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtcontact_name.Caption.Trim())) { strsql += " and c.com_contact like '%" + this.txtcontact_name.Caption.Trim() + "%' and o.contact_name like '%" + this.txtcontact_name.Caption.Trim() + "%' "; } if (!string.IsNullOrEmpty(this.txtPhone.Caption.Trim())) { strsql += " and c.com_tel like '%" + this.txtPhone.Caption.Trim() + "%' and o.contact_telephone like '%" + this.txtPhone.Caption.Trim() + "%' "; } strsql += " order by c.com_name"; SYSModel.SQLObj sqlobj = new SYSModel.SQLObj(); sqlobj.cmdType = CommandType.Text; sqlobj.Param = new Dictionary<string, SYSModel.ParamObj>(); sqlobj.sqlString = strsql; DataSet ds = DBHelper.GetDataSet("查询组织-组织选择器", sqlobj); dgvOrg.DataSource = ds.Tables[0].DefaultView; }
private void tvFunction_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { DataSet ds = new DataSet(); DataSet dsByRid = new DataSet(); ds.Clear(); StringBuilder strBD = new StringBuilder(); strBD.Append("with fun as( select * from sys_function where fun_id = '" + e.Node.Name + "' union all select sf.* from fun f inner join sys_function sf on f.fun_id = sf.parent_id ) "); strBD.Append(" select fun_id,num,fun_name,fun_ename,fun_uri ,fun_img,parent_id,fun_cbs ,fun_level ,fun_idx ,fun_flag ,fun_run "); strBD.Append(",CONVERT(bit,button_add) button_add ,CONVERT(bit,button_edit)button_edit "); strBD.Append(" ,CONVERT(bit,button_delete)button_delete,CONVERT(bit,button_save ) button_save ,CONVERT(bit,button_cancel) button_cancel "); strBD.Append(" ,CONVERT(bit,button_view) button_view,CONVERT(bit,button_status) button_status,CONVERT(bit,button_download) button_download,CONVERT(bit,button_shotoff) button_shotoff,CONVERT(bit,button_set) button_set,CONVERT(bit,button_refresh) button_refresh,CONVERT(bit,button_viewlist) button_viewlist,CONVERT(bit,button_resetpwd) button_resetpwd,CONVERT(bit,button_backup) button_backup "); strBD.Append(" ,CONVERT(bit,button_restore) button_restore,CONVERT(bit,button_import) button_import,CONVERT(bit,button_export) button_export "); strBD.Append(" ,CONVERT(bit,button_print) button_print ,CONVERT(bit,button_preview) button_preview "); strBD.Append(" ,CONVERT(bit,button_sync) button_sync,CONVERT(bit,button_oprecord) button_oprecord "); strBD.Append(" ,enable_flag ,remark ,create_by,create_time,update_by ,update_time,CONVERT(bit, '0') as isall from fun where fun_run='1' and fun_flag='1' and enable_flag='1' "); SYSModel.SQLObj sqlobj = new SYSModel.SQLObj(); sqlobj.cmdType = CommandType.Text; sqlobj.Param = new Dictionary <string, SYSModel.ParamObj>(); sqlobj.sqlString = strBD.ToString(); ds = DBHelper.GetDataSet("查询角色权限", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, sqlobj); if (wStatus == WindowStatus.Edit) { dsByRid.Clear(); string strSql = " with fun as( select * from sys_function where fun_id = '" + e.Node.Name + "' union all " + "select sf.* from fun f inner join sys_function sf on f.fun_id = sf.parent_id ) " + "select fun.fun_id,fun.num,fun.fun_name,fun.fun_ename,fun.fun_uri ,fun.fun_img,fun.parent_id,fun.fun_cbs ,fun.fun_level ,fun.fun_idx ,fun.fun_flag ,fun.fun_run ," + "CONVERT (bit, rf.button_add) button_add," + "CONVERT (bit, rf.button_edit) button_edit," + "CONVERT (bit, rf.button_delete) button_delete," + "CONVERT (bit, rf.button_save) button_save," + "CONVERT (bit, rf.button_cancel) button_cancel," + "CONVERT (bit, rf.button_view) button_view," + "CONVERT (bit, rf.button_status) button_status," + "CONVERT (bit, rf.button_download) button_download," + "CONVERT (bit, rf.button_shotoff) button_shotoff," + "CONVERT (bit, rf.button_set) button_set," + "CONVERT (bit, rf.button_refresh) button_refresh," + "CONVERT (bit, rf.button_viewlist) button_viewlist," + "CONVERT (bit, rf.button_resetpwd) button_resetpwd," + "CONVERT (bit, rf.button_backup) button_backup," + "CONVERT (bit, rf.button_restore) button_restore," + "CONVERT (bit, rf.button_import) button_import," + "CONVERT (bit, rf.button_export) button_export," + "CONVERT (bit, rf.button_print) button_print," + "CONVERT (bit, rf.button_preview) button_preview," + "CONVERT (bit, rf.button_sync) button_sync," + "CONVERT (bit, rf.button_oprecord) button_oprecord," + "fun.enable_flag ,fun.remark ,fun.create_by,fun.create_time,fun.update_by ,fun.update_time,CONVERT(bit, '0') as isall " + "from fun ,tr_role_function rf,sys_role sr where rf.role_id =sr.role_id and rf.fun_id=fun.fun_id and sr.role_id='" + id + "' " + "and fun.fun_run='1' and fun.fun_flag='1' and fun.enable_flag='1' "; SYSModel.SQLObj sobj = new SYSModel.SQLObj(); sobj.cmdType = CommandType.Text; sobj.Param = new Dictionary <string, SYSModel.ParamObj>(); sobj.sqlString = strSql; dsByRid = DBHelper.GetDataSet("查询角色权限", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, sobj); if (dsByRid != null && dsByRid.Tables[0].Rows.Count > 0 && ds != null && ds.Tables[0].Rows.Count > 0) { DataTable dttem = ds.Tables[0].Clone(); ArrayList iList = new ArrayList(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { foreach (DataRow dtFunRow in dsByRid.Tables[0].Rows) { if (ds.Tables[0].Rows[i]["fun_id"].ToString() == dtFunRow["fun_id"].ToString()) { //row.Delete(); iList.Add(i); dttem.Rows.Add(ConvertDtRow(dttem, dtFunRow)); } } } if (iList.Count > 0) { for (int j = iList.Count - 1; j >= 0; j--) { ds.Tables[0].Rows.RemoveAt(Convert.ToInt32(iList[j])); } } if (dttem.Rows.Count > 0) { foreach (DataRow dr in dttem.Rows) { ds.Tables[0].Rows.Add(ConvertDtRow(ds.Tables[0], dr)); } } } } if (ds != null && ds.Tables[0].Rows.Count > 0) { // DataTable dtFunction= DataTable tem = ds.Tables[0].Clone(); if (dtFun.Rows.Count > 0) { // ds.Tables[0].AcceptChanges(); ArrayList iList = new ArrayList(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { foreach (DataRow dtFunRow in dtFun.Rows) { if (ds.Tables[0].Rows[i]["fun_id"].ToString() == dtFunRow["fun_id"].ToString()) { //row.Delete(); iList.Add(i); tem.Rows.Add(ConvertDtRow(tem, dtFunRow)); } } } if (iList.Count > 0) { for (int j = iList.Count - 1; j >= 0; j--) { ds.Tables[0].Rows.RemoveAt(Convert.ToInt32(iList[j])); } } if (tem.Rows.Count > 0) { foreach (DataRow dr in tem.Rows) { ds.Tables[0].Rows.Add(ConvertDtRow(ds.Tables[0], dr)); } } } } dgvFunction.DataSource = ds.Tables[0].DefaultView; }
private void tvFunction_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { DataSet ds = new DataSet(); DataSet dsByRid = new DataSet(); ds.Clear(); StringBuilder strBD = new StringBuilder(); strBD.Append("with fun as( select * from sys_function where fun_id = '" + e.Node.Name + "' union all select sf.* from fun f inner join sys_function sf on f.fun_id = sf.parent_id ) "); strBD.Append(" select fun_id,num,fun_name,fun_ename,fun_uri ,fun_img,parent_id,fun_cbs ,fun_level ,fun_idx ,fun_flag ,fun_run "); strBD.Append(",CONVERT(bit,button_add) button_add ,CONVERT(bit,button_edit)button_edit "); strBD.Append(" ,CONVERT(bit,button_delete)button_delete,CONVERT(bit,button_save ) button_save ,CONVERT(bit,button_cancel) button_cancel "); strBD.Append(" ,CONVERT(bit,button_view) button_view,CONVERT(bit,button_status) button_status,CONVERT(bit,button_download) button_download,CONVERT(bit,button_shotoff) button_shotoff,CONVERT(bit,button_set) button_set,CONVERT(bit,button_refresh) button_refresh,CONVERT(bit,button_viewlist) button_viewlist,CONVERT(bit,button_resetpwd) button_resetpwd,CONVERT(bit,button_backup) button_backup "); strBD.Append(" ,CONVERT(bit,button_restore) button_restore,CONVERT(bit,button_import) button_import,CONVERT(bit,button_export) button_export "); strBD.Append(" ,CONVERT(bit,button_print) button_print ,CONVERT(bit,button_preview) button_preview "); strBD.Append(" ,CONVERT(bit,button_sync) button_sync,CONVERT(bit,button_oprecord) button_oprecord "); strBD.Append(" ,enable_flag ,remark ,create_by,create_time,update_by ,update_time,CONVERT(bit, '0') as isall from fun where fun_run='1' and fun_flag='1' and enable_flag='1' "); SYSModel.SQLObj sqlobj = new SYSModel.SQLObj(); sqlobj.cmdType = CommandType.Text; sqlobj.Param = new Dictionary<string, SYSModel.ParamObj>(); sqlobj.sqlString = strBD.ToString(); ds = DBHelper.GetDataSet("查询角色权限", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, sqlobj); if (wStatus == WindowStatus.Edit) { dsByRid.Clear(); string strSql = " with fun as( select * from sys_function where fun_id = '" + e.Node.Name + "' union all " + "select sf.* from fun f inner join sys_function sf on f.fun_id = sf.parent_id ) " + "select fun.fun_id,fun.num,fun.fun_name,fun.fun_ename,fun.fun_uri ,fun.fun_img,fun.parent_id,fun.fun_cbs ,fun.fun_level ,fun.fun_idx ,fun.fun_flag ,fun.fun_run ," + "CONVERT (bit, rf.button_add) button_add," + "CONVERT (bit, rf.button_edit) button_edit," + "CONVERT (bit, rf.button_delete) button_delete," + "CONVERT (bit, rf.button_save) button_save," + "CONVERT (bit, rf.button_cancel) button_cancel," + "CONVERT (bit, rf.button_view) button_view," + "CONVERT (bit, rf.button_status) button_status," + "CONVERT (bit, rf.button_download) button_download," + "CONVERT (bit, rf.button_shotoff) button_shotoff," + "CONVERT (bit, rf.button_set) button_set," + "CONVERT (bit, rf.button_refresh) button_refresh," + "CONVERT (bit, rf.button_viewlist) button_viewlist," + "CONVERT (bit, rf.button_resetpwd) button_resetpwd," + "CONVERT (bit, rf.button_backup) button_backup," + "CONVERT (bit, rf.button_restore) button_restore," + "CONVERT (bit, rf.button_import) button_import," + "CONVERT (bit, rf.button_export) button_export," + "CONVERT (bit, rf.button_print) button_print," + "CONVERT (bit, rf.button_preview) button_preview," + "CONVERT (bit, rf.button_sync) button_sync," + "CONVERT (bit, rf.button_oprecord) button_oprecord," + "fun.enable_flag ,fun.remark ,fun.create_by,fun.create_time,fun.update_by ,fun.update_time,CONVERT(bit, '0') as isall " + "from fun ,tr_role_function rf,sys_role sr where rf.role_id =sr.role_id and rf.fun_id=fun.fun_id and sr.role_id='" + id + "' " + "and fun.fun_run='1' and fun.fun_flag='1' and fun.enable_flag='1' "; SYSModel.SQLObj sobj = new SYSModel.SQLObj(); sobj.cmdType = CommandType.Text; sobj.Param = new Dictionary<string, SYSModel.ParamObj>(); sobj.sqlString = strSql; dsByRid = DBHelper.GetDataSet("查询角色权限", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, sobj); if (dsByRid != null && dsByRid.Tables[0].Rows.Count > 0 && ds != null && ds.Tables[0].Rows.Count > 0) { DataTable dttem = ds.Tables[0].Clone(); ArrayList iList = new ArrayList(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { foreach (DataRow dtFunRow in dsByRid.Tables[0].Rows) { if (ds.Tables[0].Rows[i]["fun_id"].ToString() == dtFunRow["fun_id"].ToString()) { //row.Delete(); iList.Add(i); dttem.Rows.Add(ConvertDtRow(dttem, dtFunRow)); } } } if (iList.Count > 0) { for (int j = iList.Count - 1; j >= 0; j--) { ds.Tables[0].Rows.RemoveAt(Convert.ToInt32(iList[j])); } } if (dttem.Rows.Count > 0) { foreach (DataRow dr in dttem.Rows) { ds.Tables[0].Rows.Add(ConvertDtRow(ds.Tables[0], dr)); } } } } if (ds != null && ds.Tables[0].Rows.Count > 0) { // DataTable dtFunction= DataTable tem = ds.Tables[0].Clone(); if (dtFun.Rows.Count > 0) { // ds.Tables[0].AcceptChanges(); ArrayList iList = new ArrayList(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { foreach (DataRow dtFunRow in dtFun.Rows) { if (ds.Tables[0].Rows[i]["fun_id"].ToString() == dtFunRow["fun_id"].ToString()) { //row.Delete(); iList.Add(i); tem.Rows.Add(ConvertDtRow(tem, dtFunRow)); } } } if (iList.Count > 0) { for (int j = iList.Count - 1; j >= 0; j--) { ds.Tables[0].Rows.RemoveAt(Convert.ToInt32(iList[j])); } } if (tem.Rows.Count > 0) { foreach (DataRow dr in tem.Rows) { ds.Tables[0].Rows.Add(ConvertDtRow(ds.Tables[0], dr)); } } } } dgvFunction.DataSource = ds.Tables[0].DefaultView; }