public override BranchModel[] GetChilds(string parentpk, bool bj_employee, DB_OPT dbo) { StringBuilder builder = new StringBuilder(); builder.Append(this.GetSql()); if (parentpk != "") { builder.Append(" where FatherPK='" + parentpk + "'"); } builder.Append(" order by pk_corp"); DataSet set = dbo.BackDataSet(builder.ToString(), null); if (set.Tables[0].Rows.Count <= 0) { return null; } BranchModel[] modelArray = new BranchModel[set.Tables[0].Rows.Count]; for (int i = 0; i < set.Tables[0].Rows.Count; i++) { modelArray[i] = new BranchModel(); modelArray[i] = this.Getmm(set.Tables[0].Rows[i], true, false, false, bj_employee, dbo); } return modelArray; }
public void ChildDataBind(string strPK) { try { this.dbo = new DB_OPT(); this.dbo.Open(); this.branch = new BranchDal(); DataSet viewList = this.branch.GetViewList("pk_corp='" + strPK + "'", this.dbo); if ((viewList != null) && (viewList.Tables[0].Rows.Count > 0)) { this.gvResult_child_employee.DataSource = viewList; this.gvResult_child_employee.DataBind(); } else { DataTable table = viewList.Tables[0]; DataRow row = table.NewRow(); table.Rows.Add(row); this.gvResult_child_employee.DataSource = table.DefaultView; this.gvResult_child_employee.DataBind(); } } catch (Exception exception) { this.el = new ExceptionLog.ExceptionLog(); this.el.ErrClassName = base.GetType().ToString(); this.el.ErrMessage = exception.Message.ToString(); this.el.ErrMethod = "ChildDataBind()"; this.el.WriteExceptionLog(true); Const.OpenErrorPage("获取数据失败,请联系系统管理员!", this.Page); } finally { if (this.dbo != null) { this.dbo.Close(); } } }
protected void DataDelete(string strPK, string bh, string name, string company) { try { this.dbo = new DB_OPT(); this.dbo.Open(); this.rm = new BranchDal(); this.rm.BranchPK = strPK; this.rm.Delete(this.dbo); OperationLogBll.insertOp("删除", "部门列表", "删除 " + company + " 单位下编号为:" + bh + " 名称为:" + name + " 的部门", "Y", this.Page); if (this.Master.PageIndex > 1) { this.pageind = this.Master.PageIndex; } this.ShowData(this.Master.StrSelect); } catch (Exception exception) { this.el = new ExceptionLog.ExceptionLog(); this.el.ErrClassName = base.GetType().ToString(); this.el.ErrMessage = exception.Message.ToString(); this.el.ErrMethod = "DataDelete()"; this.el.WriteExceptionLog(true); Const.OpenErrorPage("操作失败,请联系系统管理员!", this.Page); } finally { if (this.dbo != null) { this.dbo.Close(); } } }
public bool checkBranch(string strWhere) { this.bm = new BranchDal(); this.dbo = new DB_OPT(); return (this.bm.GetList(strWhere, this.dbo).Tables[0].Rows.Count > 0); }
public override BranchModel[] GetEgality(bool bj_child, bool bj_father, bool bj_company, bool bj_employee, DB_OPT dbo) { StringBuilder builder = new StringBuilder(); builder.Append(this.GetSql()); if (base.Grade >= 0) { builder.Append(" where Grade='" + base.Grade + "'"); } else { if (base.pk_corp == "") { throw new Exception("条件不足."); } builder.Append(" where Grade=(select Grade from Company where pk_corp='" + base.pk_corp + "')"); } builder.Append(" order by pk_corp"); DataSet set = dbo.BackDataSet(builder.ToString(), null); if (set.Tables[0].Rows.Count <= 0) { return null; } BranchModel[] modelArray = new BranchModel[set.Tables[0].Rows.Count]; for (int i = 0; i < set.Tables[0].Rows.Count; i++) { modelArray[i] = new BranchModel(); modelArray[i] = this.Getmm(set.Tables[0].Rows[i], bj_child, bj_father, bj_company, bj_employee, dbo); } return modelArray; }
public override BranchModel[] GetParents(bool bj_employee, DB_OPT dbo) { string[] strArray; string str; int num; StringBuilder builder = new StringBuilder(); builder.Append(this.GetSql()); if ((base.PKPath != null) && (base.PKPath != "")) { strArray = base.PKPath.Split(new char[] { '|' }); str = ""; for (num = 0; num < strArray.Length; num++) { str = str + "'" + strArray[num] + "',"; } str = str.Substring(0, str.Length - 1); builder.Append(" where BranchPK in (" + str + ")"); } else { if (!(base.BranchPK != "")) { throw new Exception("条件不足."); } string strSql = "select PKPath from Branch where BranchPK='" + base.BranchPK + "'"; DataSet set = dbo.BackDataSet(strSql, null); if (!(set.Tables[0].Rows[0][0].ToString() != "")) { throw new Exception("没有上级."); } strArray = set.Tables[0].Rows[0][0].ToString().Split(new char[] { '|' }); str = ""; for (num = 0; num < strArray.Length; num++) { str = str + "'" + strArray[num] + "',"; } builder.Append(" where BranchPK in (" + str.Substring(0, str.Length - 1) + ")"); } builder.Append(" order by BH "); DataSet set2 = dbo.BackDataSet(builder.ToString(), null); if (set2.Tables[0].Rows.Count <= 0) { return null; } BranchModel[] modelArray = new BranchModel[set2.Tables[0].Rows.Count]; for (num = 0; num < set2.Tables[0].Rows.Count; num++) { modelArray[num] = new BranchModel(); modelArray[num] = this.Getmm(set2.Tables[0].Rows[num], false, true, false, bj_employee, dbo); } return modelArray; }
public override BranchModel GetModel_BH(bool bj_child, bool bj_father, bool bj_company, bool bj_employee, DB_OPT dbo) { BranchModel model = null; StringBuilder builder = new StringBuilder(); builder.Append(this.GetSql()); builder.Append(" where BH='" + base.BH + "'"); builder.Append(" order by BH "); DataSet set = dbo.BackDataSet(builder.ToString(), null); if (set.Tables[0].Rows.Count > 0) { model = new BranchModel(); model = this.Getmm(set.Tables[0].Rows[0], bj_child, bj_father, bj_company, bj_employee, dbo); } return model; }
public override BranchModel[] GetModels(string strWhere, bool bj_child, bool bj_father, bool bj_company, bool bj_employee, DB_OPT dbo) { BranchModel[] modelArray = null; StringBuilder builder = new StringBuilder(); builder.Append(this.GetSql()); if (strWhere.Trim() != "") { builder.Append(" where " + strWhere); } builder.Append(" order by BH "); DataSet set = dbo.BackDataSet(builder.ToString(), null); if (set.Tables[0].Rows.Count > 0) { modelArray = new BranchModel[set.Tables[0].Rows.Count]; for (int i = 0; i < set.Tables[0].Rows.Count; i++) { modelArray[i] = new BranchModel(); modelArray[i] = this.Getmm(set.Tables[0].Rows[i], bj_child, bj_father, bj_company, bj_employee, dbo); } } return modelArray; }
public override BranchModel GetModel(DB_OPT dbo) { BranchModel model = null; StringBuilder builder = new StringBuilder(); builder.Append(this.GetSql()); builder.Append(" where BranchPK='" + base.BranchPK + "'"); builder.Append(" order by BH "); DataSet set = dbo.BackDataSet(builder.ToString(), null); if (set.Tables[0].Rows.Count > 0) { model = new BranchModel(); model = this.Getmm(set.Tables[0].Rows[0], false, false, false, false, dbo); } return model; }