Ejemplo n.º 1
0
 public override EmployeeModel[] GetChilds(string parentpk, bool bj_company, bool bj_branch, bool bj_role, DB_OPT dbo)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append(this.GetSql());
     if (parentpk != "")
     {
         builder.Append(" where FatherPK='" + parentpk + "'");
     }
     builder.Append(" order by EmployeePK");
     DataSet set = dbo.BackDataSet(builder.ToString(), null);
     if (set.Tables[0].Rows.Count <= 0)
     {
         return null;
     }
     EmployeeModel[] modelArray = new EmployeeModel[set.Tables[0].Rows.Count];
     for (int i = 0; i < set.Tables[0].Rows.Count; i++)
     {
         modelArray[i] = new EmployeeModel();
         modelArray[i] = this.Getem(set.Tables[0].Rows[i], true, false, bj_company, bj_branch, bj_role, dbo);
     }
     return modelArray;
 }
Ejemplo n.º 2
0
 private EmployeeModel Getem(DataRow dr, bool bj_child, bool bj_father, bool bj_company, bool bj_branch, bool bj_role, DB_OPT dbo)
 {
     EmployeeModel model = new EmployeeModel();
     if (bj_father)
     {
         model.BranchPK = dr["FatherPK"].ToString();
         model.FatherInfo = model.GetModel(false, false, false, false, true, dbo);
     }
     model.BranchPK = dr["BranchPK"].ToString().Trim();
     if (bj_branch)
     {
         BranchModel model2 = new BranchDal
         {
             BranchPK = dr["BranchPK"].ToString()
         };
         model2 = model2.GetModel(false, false, false, false, dbo);
         model.Branch = model2;
     }
     model.RolePK = dr["RolePK"].ToString().Trim();
     if (bj_role)
     {
         RoleModel model3 = new RoleDal
         {
             RolePK = dr["RolePK"].ToString()
         };
         model3 = model3.GetModel(false, false, dbo);
         model.Role = model3;
     }
     model.BH = dr["BH"].ToString();
     model.Name = dr["Name"].ToString();
     model.CardNum = dr["CardNum"].ToString();
     model.Sex = dr["Sex"].ToString();
     if (dr["Age"].ToString() != "")
     {
         model.Age = int.Parse(dr["Age"].ToString());
     }
     if (dr["WorkAge"].ToString() != "")
     {
         model.WorkAge = int.Parse(dr["WorkAge"].ToString());
     }
     if (dr["BirthDay"].ToString() != "")
     {
         model.BirthDay = DateTime.Parse(dr["BirthDay"].ToString());
     }
     model.MZ = dr["MZ"].ToString();
     model.Nationals = dr["Nationals"].ToString();
     model.Province = dr["Province"].ToString();
     model.Area = dr["Area"].ToString();
     model.City = dr["City"].ToString();
     model.Address = dr["Address"].ToString();
     model.PostalCode = dr["PostalCode"].ToString();
     model.OfficePhone = dr["OfficePhone"].ToString();
     model.Phone = dr["Phone"].ToString();
     model.Mobile1 = dr["Mobile1"].ToString();
     model.Mobile2 = dr["Mobile2"].ToString();
     model.Mobile3 = dr["Mobile3"].ToString();
     model.QQNum = dr["QQNum"].ToString();
     model.ICQNum = dr["ICQNum"].ToString();
     model.MSNNum = dr["MSNNum"].ToString();
     model.Email = dr["Email"].ToString();
     model.OtherLink = dr["OtherLink"].ToString();
     model.pk_corp = dr["pk_corp"].ToString();
     if (bj_company)
     {
         CompanyModel model4 = new CompanyDal
         {
             pk_corp = dr["pk_corp"].ToString()
         };
         model4 = model4.GetModel(false, false, false, dbo);
         model.Company = model4;
     }
     model.FatherPK = dr["FatherPK"].ToString().Trim();
     model.IsHasBaby = dr["IsHasBaby"].ToString();
     if (dr["Grade"].ToString() != "")
     {
         model.Grade = int.Parse(dr["Grade"].ToString());
     }
     model.PKPath = dr["PKPath"].ToString();
     if ((dr["IsHasBaby"].ToString() == "1") && bj_child)
     {
         this.GetChilds(model.EmployeePK, false, false, false, dbo);
     }
     return model;
 }
Ejemplo n.º 3
0
 public override EmployeeModel[] GetModels(string strwhere, bool bj_child, bool bj_father, bool bj_company, bool bj_branch, bool bj_role, DB_OPT dbo)
 {
     EmployeeModel[] modelArray = null;
     StringBuilder builder = new StringBuilder();
     builder.Append(this.GetSql());
     if (strwhere.Trim() != "")
     {
         builder.Append(" where " + strwhere);
     }
     builder.Append(" order by EmployeePK");
     DataSet set = dbo.BackDataSet(builder.ToString(), null);
     if (set.Tables[0].Rows.Count > 0)
     {
         modelArray = new EmployeeModel[set.Tables[0].Rows.Count];
         for (int i = 0; i < set.Tables[0].Rows.Count; i++)
         {
             modelArray[i] = new EmployeeModel();
             modelArray[i] = this.Getem(set.Tables[0].Rows[i], bj_child, bj_father, bj_company, bj_branch, bj_role, dbo);
         }
     }
     return modelArray;
 }
Ejemplo n.º 4
0
 public override EmployeeModel[] GetParents(bool bj_company, bool bj_branch, bool bj_role, DB_OPT dbo)
 {
     string[] strArray;
     string str;
     int num;
     StringBuilder builder = new StringBuilder();
     builder.Append(this.GetSql());
     if (base.PKPath != "")
     {
         strArray = base.PKPath.Split(new char[] { '|' });
         str = "";
         for (num = 0; num < strArray.Length; num++)
         {
             str = str + "'" + strArray[num] + "',";
         }
         if (str.Length > 0)
         {
             str = str.Substring(0, str.Length - 1);
         }
         builder.Append(" where EmployeePK in (" + str + ")");
     }
     else
     {
         if (!(base.EmployeePK != ""))
         {
             throw new Exception("条件不足.");
         }
         string strSql = "select PKPath from Employee where EmployeePK='" + base.EmployeePK + "'";
         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 EmployeePK in (" + str.Substring(0, str.Length - 1) + ")");
     }
     builder.Append(" order by EmployeePK");
     DataSet set2 = dbo.BackDataSet(builder.ToString(), null);
     if (set2.Tables[0].Rows.Count <= 0)
     {
         return null;
     }
     EmployeeModel[] modelArray = new EmployeeModel[set2.Tables[0].Rows.Count];
     for (num = 0; num < set2.Tables[0].Rows.Count; num++)
     {
         modelArray[num] = new EmployeeModel();
         modelArray[num] = this.Getem(set2.Tables[0].Rows[num], false, true, bj_company, bj_branch, bj_role, dbo);
     }
     return modelArray;
 }
Ejemplo n.º 5
0
 public override EmployeeModel[] GetEgality(bool bj_child, bool bj_father, bool bj_company, bool bj_branch, bool bj_role, DB_OPT dbo)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append(this.GetSql());
     if (base.Grade >= 0)
     {
         builder.Append(" where Grade='" + base.Grade + "'");
     }
     else
     {
         if (base.EmployeePK == "")
         {
             throw new Exception("条件不足.");
         }
         builder.Append(" where Grade=(select Grade from Employee where EmployeePK='" + base.EmployeePK + "')");
     }
     builder.Append(" order by EmployeePK");
     DataSet set = dbo.BackDataSet(builder.ToString(), null);
     if (set.Tables[0].Rows.Count <= 0)
     {
         return null;
     }
     EmployeeModel[] modelArray = new EmployeeModel[set.Tables[0].Rows.Count];
     for (int i = 0; i < set.Tables[0].Rows.Count; i++)
     {
         modelArray[i] = new EmployeeModel();
         modelArray[i] = this.Getem(set.Tables[0].Rows[i], bj_child, bj_father, bj_company, bj_branch, bj_role, dbo);
     }
     return modelArray;
 }