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); } }
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); } } }
public int AddAccount(Account account) { try { Account ac = new SqlAccountProvider().CheckCompanyByaccountNumber(account.AccountNumber); if (ac == null) { string sql = string.Format( "INSERT INTO [LiveSupport].[dbo].[LiveSupport_Account]" + " ([AccountId]" + " ,[AccountNumber]" + " ,[CompanyName]" + " ,[Industry]" + ",[Email]" + " ,[ContactName]" + " ,[Phone]" + " ,[URL]" + ",[Domain]" + " ,[OperatorCount]" + " ,[Province]" + " ,[City]" + " ,[RegisterDate]" + " ,[Remark]" + " ,[PaymentId])" + " VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}',{9},'{10}','{11}','{12}','{13}','{14}')", account.AccountId, account.AccountNumber, account.CompanyName, account.Industry, account.Email, account.ContactName, account.Phone, account.Url, account.Domain, account.OperatorCount, account.Province, account.City, account.RegisterDate, account.Remark, account.PaymentId); return(DBHelper.ExecuteCommand(sql)); } else { return(0); } } catch (Exception ex) { return(0); } }
public int AddAccount(Account account) { try { Account ac = new SqlAccountProvider().CheckCompanyByaccountNumber(account.AccountNumber); if (ac == null) { string sql = string.Format( "INSERT INTO [LiveSupport].[dbo].[LiveSupport_Account]" + " ([AccountId]" + " ,[AccountNumber]" + " ,[CompanyName]" + " ,[Industry]" + ",[Email]" + " ,[ContactName]" + " ,[Phone]" + " ,[URL]" + ",[Domain]" + " ,[OperatorCount]" + " ,[Province]" + " ,[City]" + " ,[RegisterDate]" + " ,[Remark]" + " ,[PaymentId])" + " VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}',{9},'{10}','{11}','{12}','{13}','{14}')", account.AccountId, account.AccountNumber, account.CompanyName, account.Industry, account.Email, account.ContactName, account.Phone, account.Url, account.Domain, account.OperatorCount, account.Province, account.City, account.RegisterDate, account.Remark, account.PaymentId); return DBHelper.ExecuteCommand(sql); } else { return 0; } } catch (Exception ex) { return 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; } } }
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; } }