예제 #1
0
 def GetAccountByCustomerTypeCode4(self):
     self.conn = pymssql.connect(host=self.host,user="******",password="******",database="wisecrm_nbs")
     self.cur = self.conn.cursor()
     self.cur.execute("SELECT AccountId FROM account WHERE systemObjectTypeCode=1 AND c__gjlb = 0 AND c__cjjg > 2 AND (c__wlxts is null or c__wlxts like '') AND  isDeleted = 0")
     list = self.cur.fetchall()
     items = []
     for (AccountId) in list:
         item = Account_Item()
         item.AccountId = AccountId
         items.append(item)
     self.cur.close()
     self.conn.close()
     return items
예제 #2
0
 def GetAccountByCustomerTypeCode(self, typeCode):
     self.conn = pymssql.connect(host=self.host,user="******",password="******",database="wisecrm_nbs")
     self.cur = self.conn.cursor()
     self.cur.execute("SELECT AccountId,AccountName,CustomerTypeCode,OwningBusinessUnit FROM Account WHERE SystemObjectTypeCode ='1' AND CustomerTypeCode = %s AND OwningBusinessUnit != '030-0cb12d9f-c907-4414-8d4a-fca3d01b63da' AND  isDeleted = 0", (typeCode))
     list = self.cur.fetchall()
     items = []
     for (AccountId, AccountName, CustomerTypeCode, OwningBusinessUnit) in list:
         item = Account_Item()
         item.AccountId = AccountId
         item.AccountName = AccountName
         item.CustomerTypeCode = CustomerTypeCode
         item.OwningBusinessUnit = OwningBusinessUnit
         items.append(item)
     self.cur.close()
     self.conn.close()
     return items
예제 #3
0
 def GetAccountByCustomerTypeCode3(self):
     self.conn = pymssql.connect(host=self.host,user="******",password="******",database="wisecrm_nbs")
     self.cur = self.conn.cursor()
     self.cur.execute("SELECT AccountId,AccountName,CustomerTypeCode,(SELECT TOP 1 CreatedOn FROM Activity WHERE State ='2' AND systemObjectTypeCode ='1' AND AccountId = Account.AccountId ORDER BY CreatedOn DESC) AS ActivityTime ,OwningBusinessUnit,(SELECT FullName FROM [User] WHERE UserId = Account.OwningUser) AS FullName FROM Account WHERE SystemObjectTypeCode ='1' AND isDeleted <> 1 AND CustomerTypeCode in (7,13,11) AND OwningBusinessUnit != '030-0cb12d9f-c907-4414-8d4a-fca3d01b63da' AND  isDeleted = 0")
     list = self.cur.fetchall()
     items = []
     for (AccountId,AccountName,CustomerTypeCode,ActivityTime,OwningBusinessUnit,FullName) in list:
         item = Account_Item()
         item.AccountId = AccountId
         item.AccountName = AccountName
         item.CustomerTypeCode = CustomerTypeCode
         item.ActivityTime = ActivityTime
         item.OwningBusinessUnit = OwningBusinessUnit
         item.FullName = FullName
         items.append(item)
     self.cur.close()
     self.conn.close()
     return items