Пример #1
0
        public List <Department> GetDepartmentByAccountId(string AccountId)
        {
            List <Department> list = new List <Department>();
            string            sql  = "select * from LiveSupport_Department where AccountId='" + AccountId + "' order by AddDate";

            using (SqlDataReader sdr = DBHelper.GetReader(sql))
            {
                while (sdr.Read())
                {
                    Department department = new Department();
                    department.DepartmentId   = sdr["DepartmentId"].ToString();
                    department.DepartmentName = sdr["DepartmentName"].ToString();
                    department.IsDefault      = Convert.ToBoolean(sdr["IsDefault"]);
                    string aid = sdr["AccountId"].ToString();
                    department.Account = accountProvider.GetAccountByAccountId(aid);
                    list.Add(department);
                }
                return(list);
            }
        }
Пример #2
0
        public List <Operator> GetOperatorListBySql(string sql)
        {
            List <Operator> operators = new List <Operator>();

            using (SqlDataReader r = DBHelper.GetReader(sql))
            {
                while (r.Read())
                {
                    Operator              op = new Operator(r);
                    SqlAccountProvider    ap = new SqlAccountProvider();
                    SqlDepartmentProvider dp = new SqlDepartmentProvider();
                    op.Department = dp.GetDepartmentById(r["DepartmentId"].ToString());
                    op.Account    = ap.GetAccountByAccountId(r["accountId"].ToString());
                    operators.Add(op);
                }
                return(operators);
            }
        }
Пример #3
0
        public Operator GetOperatorBySql(string sql)
        {
            Operator operators = new Operator();

            using (SqlDataReader r = DBHelper.GetReader(sql))
            {
                if (r.Read())
                {
                    Operator              op = new Operator(r);
                    SqlAccountProvider    ap = new SqlAccountProvider();
                    SqlDepartmentProvider dp = new SqlDepartmentProvider();
                    op.Department = dp.GetDepartmentById(r["DepartmentId"].ToString());
                    op.Account    = ap.GetAccountByAccountId(r["accountId"].ToString());
                    return(op);
                }
                else
                {
                    return(null);
                }
            }
        }
Пример #4
0
 public Operator GetOperatorBySql(string sql)
 {
     Operator operators = new Operator();
     using (SqlDataReader r = DBHelper.GetReader(sql))
     {
         if (r.Read())
         {
             Operator op = new Operator(r);
             SqlAccountProvider ap = new SqlAccountProvider();
             SqlDepartmentProvider dp = new SqlDepartmentProvider();
             op.Department = dp.GetDepartmentById(r["DepartmentId"].ToString());
             op.Account = ap.GetAccountByAccountId(r["accountId"].ToString());
             return op;
         }
         else
         {
             return null;
         }
     }
 }
Пример #5
0
 public List<Operator> GetOperatorListBySql(string sql)
 {
     List<Operator> operators = new List<Operator>();
     using (SqlDataReader r = DBHelper.GetReader(sql))
     {
         while (r.Read())
         {
             Operator op = new Operator(r);
             SqlAccountProvider ap = new SqlAccountProvider();
             SqlDepartmentProvider dp = new SqlDepartmentProvider();
             op.Department = dp.GetDepartmentById(r["DepartmentId"].ToString());
             op.Account = ap.GetAccountByAccountId(r["accountId"].ToString());
             operators.Add(op);
         }
         return operators;
     }
 }