public ActionResult OrderBill() { int a = (int)Session["UserID"]; var listcash = BillAction.ListCartDetail(a); var detail = listcash.FirstOrDefault(); string text = ""; foreach (var item in listcash) { text += item.Book.Name + "<br/>" + item.Price + "\n" + item.Count; } CashAction.Order(a); string content = System.IO.File.ReadAllText(Server.MapPath("~/client/template/neworder.html")); Session["alert"] = "ok"; content = content.Replace("{{Name}}", "sadsada"); content = content.Replace("{{product}}", text); content = content.Replace("{{Content}}", "*****@*****.**"); content = content.Replace("{{totalcost}}", Convert.ToString(detail.Bill.TotalCost)); var toEmail = ConfigurationManager.AppSettings["ToEmailAddress"].ToString(); new MailHelper().SendMail("*****@*****.**", "Đơn Đặt Hàng", content); new MailHelper().SendMail(toEmail, "Đơn Đặt Hàng", content); return(RedirectToAction("ViewCart", "Cart")); }
/* CREATE BILL AND SAVE DB */ public ActionResult BuyBook() { List <Item> item = new List <Item>(); Dictionary <int, Item> tmp = (Dictionary <int, Item>)Session["cart"]; foreach (var i in tmp.Values) { item.Add(i); } int ID_Customer = int.Parse(Session["id"].ToString()); string Date_Create = DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year; OrderAction.Create_Order(ID_Customer, Date_Create); int id_order = OrderAction.Find_Order(); for (int i = 0; i < item.Count; i++) { BillAction.Create_Bill( id_order, item[i].book.id_sach, item[i].book.ten_sach, item[i].book.tac_gia, item[i].so_luong, item[i].book.gia_ban, item[i].so_luong * item[i].book.gia_ban ); } tmp.Clear(); item.Clear(); Session["Cart"] = null; tmp = null; item = null; return(Redirect("~/Cart/MyOrder")); }
public ActionResult ListViewCart() { if ((int?)Session["UserID"] != null) { List <BillDetail> a = new List <BillDetail>(); a = BillAction.ListCartDetail((int)Session["UserID"]); ViewBag.CountItem = BillAction.CountBill((int)Session["UserID"]); ViewBag.Total = BillAction.ReBill((int)Session["UserID"]); if (a != null) { return(PartialView(a)); } else { return(PartialView()); } } else if (BillAction.CountBill((int)Session["UserID"]) == 0) { return(RedirectToAction("HomePage", "Home")); } else { return(RedirectToAction("Login", "Account")); } }
public JsonResult CreateBill(string Customer_Phone) { Dictionary <int, Item> order = (Dictionary <int, Item>)Session["order"]; double sum = 0; foreach (var item in order) { sum += item.Value.product.price * item.Value.quantity; } if (sum != 0) { OrderAction.Create_Order(DateTime.Now.Date, (string)Session["id"], sum); int ID_Order = OrderAction.Find(); foreach (var item in order) { BillAction.Create_Bill(ID_Order, item.Value.product.id, item.Value.quantity, item.Value.product.price); } if (!Customer_Phone.Equals("0") || Customer_Phone != "") { MemberShipAction.Increate_Score(Customer_Phone, order.Count * 2); } Session["order"] = null; order.Clear(); ID_Order = 0; sum = 0; return(Json("Good", JsonRequestBehavior.AllowGet)); } else { Session["order"] = null; order.Clear(); sum = 0; return(Json("Bad", JsonRequestBehavior.AllowGet)); } }
/// <summary> /// 推送消息到移动端App。 /// </summary> /// <param name="billAction">本次消息对应的单据操作种类。不同的app支持的操作种类不一样。</param> /// <param name="paramObj"></param> public static void PushCore(BillAction billAction, LibMailParam paramObj) { LibMailParam param = paramObj as LibMailParam; try { List <PushTarget> listTarget = GetPushTarget(billAction, param.PersonId, param.To, param.CC); if (listTarget == null || listTarget.Count == 0) { return; } NoticeMsg msg = new NoticeMsg() { Message = param.Content, Title = param.Subject }; PushParams pushParams = new PushParams() { Message = msg, Targets = listTarget }; //调用服务接口推送 LibAppPushService.Push(pushParams); } catch { //throw; } }
public ActionResult ViewCart() { ViewBag.BookTop = BookAction.AddSachTop5ToDb(); if (TempData["Alert"] != null) { ViewBag.Alert = TempData["Alert"].ToString(); } if (Session["UserName"] != null && (int)Session["Role"] == 2) { int AccountId = (int)Session["UserID"]; if (Session["UserID"] == null) { return(RedirectToAction("Login", "Account")); } var listCart = BillAction.ListCartDetail(AccountId); if (listCart != null) { ViewBag.ListCart = listCart; ViewBag.Detail = listCart.FirstOrDefault(); } return(View()); } return(RedirectToAction("Login", "Account")); }
public CityBill(CityOffice givenOwner, BillAction requestedAction, BillObject requestedTarget) { owners = new Stack <CityOffice>(); owners.Push(givenOwner); state = BillState.Proposed; action = requestedAction; target = requestedTarget; }
public ActionResult AddSingle(int ID) { if (Session["UserName"] != null) { int AccountId = (int)Session["UserID"]; BillAction.AddSingle(AccountId, ID); return(RedirectToAction("ShopGrid", "Book")); } return(RedirectToAction("Login", "Account")); }
public ActionResult AddCart(int BookId, int Count) { if (Session["UserName"] != null) { int AccountId = (int)Session["UserID"]; ViewBag.Message = BillAction.AddCart(AccountId, BookId, Count); return(RedirectToAction("Detail", "Book", new { ID = BookId })); } return(RedirectToAction("Login", "Account")); }
public ActionResult Checkout(int BillID) { if (Session["UserName"] != null) { int AccountId = (int)Session["UserID"]; ViewBag.Bill = BillAction.FindBill(AccountId); return(View()); } return(RedirectToAction("Login", "Account")); }
public ActionResult CountListCart() { if ((int?)Session["UserID"] != null) { ViewBag.CountItem = BillAction.CountBill((int)Session["UserID"]); return(PartialView()); } else { return(RedirectToAction("Login", "Account")); } }
public ActionResult OrderBill() { try { int a = (int)Session["UserID"]; var listcash = BillAction.ListCartDetail(a); var detail = listcash.FirstOrDefault(); CashAction.Order(a); return(RedirectToAction("ViewCart", "Cart")); } catch { return(RedirectToAction("ViewCart", "Cart")); } }
private static BillAction ActionFromSunlight(SunlightBillResult.Action action) { if (action == null) { return(null); } var billAction = new BillAction() { Date = DataTransformationUtil.DateFromSunlightTime(action.acted_at), Text = action.text ?? string.Empty }; return(billAction); }
/// <summary> /// 查找支持指定BillAction的AppType类型 /// </summary> /// <param name="action"></param> /// <returns></returns> public List <AppType> QueryCan(BillAction action) { List <AppType> list = new List <AppType>(); lock (_lockObj) { foreach (AppType key in _DicTypeActions.Keys) { if (_DicTypeActions[key] != null && _DicTypeActions[key].Contains(action)) { list.Add(key); } } } return(list); }
public ActionResult ViewCart() { if (Session["UserName"] != null) { int AccountId = (int)Session["UserID"]; var listCart = BillAction.ListCartDetail(AccountId); if (listCart != null) { ViewBag.ListCart = listCart; ViewBag.Detail = listCart.FirstOrDefault(); } return(View()); } return(RedirectToAction("Index", "Book")); }
/// <summary> /// 推送具体消息 /// </summary> /// <param name="paramObj">object[],第一个对象是BillAction,第二个是LibMailParam的List数组</param> public static void Push(object paramObj) { try { object[] paramObjs = (object[])paramObj; if (paramObjs == null || paramObjs.Length < 2) { return; } BillAction billAction = (BillAction)paramObjs[0]; List <LibMailParam> list = (List <LibMailParam>)paramObjs[1]; foreach (var item in list) { PushCore(billAction, item); } } catch (Exception) { // to do log } }
/// <summary> /// 同步数据。 /// 可以由其他站点通过令牌信息跨站点调用 /// </summary> /// <param name="billAction">业务操作类型</param> /// <param name="mainRowPks">主数据的主键值</param> /// <param name="subDeleteChanges">子表或子子表中删除行的信息</param> /// <param name="extendBcfParam">扩展参数信息</param> /// <param name="dataSet">数据集信息</param> public virtual void SynchroData(BillAction billAction, Dictionary <string, object> mainRowPks, Dictionary <string, LibChangeRecord> subDeleteChanges, Dictionary <string, object> extendBcfParam, DataSet dataSet) { if (mainRowPks == null || mainRowPks.Count == 0) { return; } object[] pks = mainRowPks.Values.ToArray(); Dictionary <string, LibChangeRecord> changeRecords = null; Dictionary <string, string> extendParams = null; if (extendBcfParam != null && extendBcfParam.Keys.Count > 0) { extendParams = new Dictionary <string, string>(); foreach (string key in extendBcfParam.Keys) { extendParams[key] = JsonConvert.SerializeObject(extendBcfParam[key]); } } if (billAction == BillAction.Delete) { this.Delete(pks, extendParams); } else { BcfSyncConfig syncConfig = this.Template.FuncPermission.SyncConfig;//同步配置 //先判断当前数据库中是否存在相关数据,并结合BillAction类型重新设定操作类型 LibBcfData newBcf = (LibBcfData)LibBcfSystem.Default.GetBcfInstance(this.ProgId); newBcf.Handle = this.Handle; DataSet thisSiteData = newBcf.BrowseTo(pks); //处理修改状态的委托方法 Action setModifyAction = delegate { dataSet.AcceptChanges(); // 检查每一行与当前数据中的行的对应关系,如果当前不存在则设置为新增状态,否则设置为修改状态 DataTable thisDt = null; DataRow thisRow = null; List <object> keyValueList = new List <object>(); //表主键值 Dictionary <string, object> dicValues = new Dictionary <string, object>(); //数据行的各列的具体值临时存储 int tableCount = -1; foreach (DataTable dt in dataSet.Tables) { tableCount++;//约定主表必须为第一个表 if (thisSiteData.Tables.Contains(dt.TableName) == false) { continue;//本站中不包含的数据表不进行处理 } else { thisDt = thisSiteData.Tables[dt.TableName]; } if (thisDt.PrimaryKey == null || thisDt.PrimaryKey.Length == 0) { continue;//没有主键无法比较数据也直接返回 } int keyColumnCount = 0; List <DataColumn> keyColList = new List <DataColumn>(); foreach (DataColumn col in thisDt.PrimaryKey) { if (dt.Columns.Contains(col.ColumnName)) { keyColumnCount++; keyColList.Add(dt.Columns[col.ColumnName]); } } if (keyColumnCount != thisDt.PrimaryKey.Length) { continue;//主键不一致 } foreach (DataRow row in dt.Rows) { keyValueList.Clear(); if (tableCount == 0)//对于主表,主键值使用传输过来的主键原始值 { keyValueList = mainRowPks.Values.ToList(); } else { foreach (DataColumn col in thisDt.PrimaryKey) { if (dt.Columns.Contains(col.ColumnName)) { if (mainRowPks.Keys.Contains(col.ColumnName))//对于其他表,主键值中包含的主表主键列使用传输过来的原始值 { keyValueList.Add(mainRowPks[col.ColumnName]); } else { keyValueList.Add(row[col.ColumnName]); } } } } if (keyValueList.Count == 0) { continue; } thisRow = thisDt.Rows.Find(keyValueList.ToArray()); if (thisRow == null) { row.SetAdded();//本地不存在的行新增 //检查不需要同步的数据列 if (syncConfig != null && syncConfig.NonSyncFields.Keys.Contains(thisDt.TableName) && syncConfig.NonSyncFields[thisDt.TableName].Count > 0) { foreach (string fieldName in syncConfig.NonSyncFields[thisDt.TableName]) { if (string.IsNullOrEmpty(fieldName) || thisDt.Columns.Contains(fieldName) == false || dt.Columns.Contains(fieldName) == false) { continue; } if (thisDt.Columns[fieldName].AllowDBNull) { row[fieldName] = DBNull.Value;//对于不需要同步的列,新增时直接设置为空。 } } } } else { row.SetModified(); row.BeginEdit(); //通过重置数据,实现原始版本和当前版本不相同 try { foreach (DataColumn col in dt.Columns) { dicValues[col.ColumnName] = row[col]; if (keyColList.Contains(col) == false) { //非主键列直接设置为空,以便实现更改 row[col] = DBNull.Value; } else { if (mainRowPks.Keys.Contains(col.ColumnName)) { row[col] = mainRowPks[col.ColumnName];//子表中与主表中的主键列相同的,原始值设置为传输过来的值 } //子表中的其他主键列,一般为RowID、FormRowID等,都基本是只读的,不会变更。 } } row.AcceptChanges();//先接受修改,然后再改回原来的值,这样实现历史版本和当前版本不一致。 foreach (DataColumn col in dt.Columns) { row[col] = dicValues[col.ColumnName]; } //检查不需要同步的数据列 if (syncConfig != null && syncConfig.NonSyncFields.Keys.Contains(thisDt.TableName) && syncConfig.NonSyncFields[thisDt.TableName].Count > 0) { foreach (string fieldName in syncConfig.NonSyncFields[thisDt.TableName]) { if (string.IsNullOrEmpty(fieldName) || thisDt.Columns.Contains(fieldName) == false || dt.Columns.Contains(fieldName) == false || keyColList.Contains(dt.Columns[fieldName]) // 主键列必须同步 ) { continue; } if (thisDt.Columns[fieldName].ExtendedProperties.ContainsKey(FieldProperty.AllowEmpty) == false) { dt.Columns[fieldName].AllowDBNull = true; row[fieldName] = DBNull.Value;//对于不需要同步的列,直接设置为空。 } } } } finally { row.EndEdit(); } } } dt.PrimaryKey = keyColList.ToArray(); //因直接序列化过来的没有主键,需要重新设置。但要放到模拟实现了数据更改后再设置主键,不然会引起主键为空等错误。 } }; if (billAction == BillAction.AddNew) { //当前系统存在要添加的数据 if (thisSiteData != null && thisSiteData.Tables.Count > 0 && thisSiteData.Tables[0].Rows.Count > 0) { billAction = BillAction.Modif; setModifyAction(); } } else if (billAction != BillAction.Browse) { //除了新增、删除之外的其他操作,只要不是浏览且当前数据库中不存在,操作一律为修改状态 if (thisSiteData == null || thisSiteData.Tables.Count == 0 || thisSiteData.Tables[0].Rows.Count == 0) { billAction = BillAction.AddNew; } else { billAction = BillAction.Modif; setModifyAction(); } } changeRecords = DataSetManager.GetChangeRecord(dataSet); if (billAction == BillAction.AddNew) { this.Save(billAction, pks, changeRecords, extendParams); } else if (billAction == BillAction.Modif) { //处理子表或子子表的删除行信息 LibChangeRecord tableChanges = null; if (subDeleteChanges != null && subDeleteChanges.Count > 0) { foreach (string tableName in subDeleteChanges.Keys) { if (tableName == this.DataSet.Tables[0].TableName) { continue; } if (subDeleteChanges[tableName] == null || subDeleteChanges[tableName].Remove == null || subDeleteChanges[tableName].Remove.Count == 0) { continue; } if (changeRecords.ContainsKey(tableName) == false) { changeRecords[tableName] = subDeleteChanges[tableName]; } else { tableChanges = changeRecords[tableName]; tableChanges.Remove = subDeleteChanges[tableName].Remove; } } } this.Edit(pks);//先编辑实现缓存中有该对象 this.Save(billAction, pks, changeRecords, extendParams); } } }
/* Get Bill By Page */ public JsonResult GetBill(int page) { return(Json(BillAction.GetDetail((int)Session["id"], page_size, page), JsonRequestBehavior.AllowGet)); }
public ActionResult ExportToExcel(int id) { var products = BillAction.ListBillDetail(id); var bill = BillAction.ReBill(id); ExcelPackage pck = new ExcelPackage(); ExcelWorksheet ws = pck.Workbook.Worksheets.Add("Report"); ws.Cells["A1:D1"].Value = "Thông Tin Đơn hàng"; ws.Cells["A1:D1"].Merge = true; ws.Cells["A1:D1"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; //ws.Cells["A1:D1"].Style.Border.BorderAround(ExcelBorderStyle.Thin); ws.Cells["A3"].Value = "Người đặt hàng"; ws.Cells["A3"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; // ws.Cells["A3"].Style.Border.BorderAround(ExcelBorderStyle.Thin); ws.Cells["B3"].Value = bill.Account.UserName; ws.Cells["B3:D3"].Merge = true; ws.Cells["B3:D3"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; // ws.Cells["B3:D3"].Style.Border.BorderAround(ExcelBorderStyle.Thin); ws.Cells["A4"].Value = "Ngày đặt hàng"; ws.Cells["A4"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; // ws.Cells["A4"].Style.Border.BorderAround(ExcelBorderStyle.Thin); ws.Cells["B4"].Value = string.Format("{0:dd MMMM yyyy} at {0:H: mm tt}", bill.FoundedDate); ws.Cells["B4:D4"].Merge = true; ws.Cells["B4:D4"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; // ws.Cells["B4:D4"].Style.Border.BorderAround(ExcelBorderStyle.Thin); ws.Cells["A6"].Value = "STT"; ws.Cells["A6"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; ws.Cells["A6"].Style.Border.BorderAround(ExcelBorderStyle.Thin); ws.Cells["B6"].Value = "Tên sách"; ws.Cells["B6"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; ws.Cells["B6"].Style.Border.BorderAround(ExcelBorderStyle.Thin); ws.Cells["C6"].Value = "Số lượng"; ws.Cells["C6"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; ws.Cells["C6"].Style.Border.BorderAround(ExcelBorderStyle.Thin); ws.Cells["D6"].Value = "Giá sau giảm"; ws.Cells["D6"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; ws.Cells["D6"].Style.Border.BorderAround(ExcelBorderStyle.Thin); int rowStart = 7; int stt = 1; foreach (var item in products) { if (item.Count < 10) { // ws.Cells[string.Format("A{0}:D{1}",rowStart,rowStart)].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; // ws.Cells[string.Format("A{0}:D{1}", rowStart, rowStart)].Style.Fill.BackgroundColor.SetColor(ColorTranslator.FromHtml(string.Format("pink"))); } ws.Cells[string.Format("A{0}", rowStart)].Value = stt.ToString(); ws.Cells[string.Format("A{0}", rowStart)].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; ws.Cells[string.Format("A{0}", rowStart)].Style.Border.BorderAround(ExcelBorderStyle.Thin); ws.Cells[string.Format("B{0}", rowStart)].Value = item.Book.Name; ws.Cells[string.Format("B{0}", rowStart)].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; ws.Cells[string.Format("B{0}", rowStart)].Style.Border.BorderAround(ExcelBorderStyle.Thin); ws.Cells[string.Format("C{0}", rowStart)].Value = item.Count; ws.Cells[string.Format("C{0}", rowStart)].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; ws.Cells[string.Format("C{0}", rowStart)].Style.Border.BorderAround(ExcelBorderStyle.Thin); ws.Cells[string.Format("D{0}", rowStart)].Value = item.Price; ws.Cells[string.Format("D{0}", rowStart)].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; ws.Cells[string.Format("D{0}", rowStart)].Style.Border.BorderAround(ExcelBorderStyle.Thin); rowStart++; stt++; } ws.Cells[string.Format("A{0}:C{1}", rowStart, rowStart)].Value = "TỔNG TIỀN THANH TOÁN:"; ws.Cells[string.Format("A{0}:C{1}", rowStart, rowStart)].Merge = true; ws.Cells[string.Format("A{0}:C{1}", rowStart, rowStart)].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; ws.Cells[string.Format("A{0}:C{1}", rowStart, rowStart)].Style.Border.BorderAround(ExcelBorderStyle.Thin); ws.Cells[string.Format("A{0}:C{1}", rowStart, rowStart)].Style.Font.Bold = true; ws.Cells[string.Format("D{0}", rowStart)].Value = bill.TotalCost; ws.Cells[string.Format("D{0}", rowStart)].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; ws.Cells[string.Format("D{0}", rowStart)].Style.Border.BorderAround(ExcelBorderStyle.Thin); ws.Cells[string.Format("D{0}", rowStart)].Style.Font.Bold = true; int rowEnd = rowStart + 2; ws.Cells[string.Format("A{0}:D{1}", rowEnd, rowEnd)].Value = "XIN CẢM ƠN QUÝ KHÁCH!"; ws.Cells[string.Format("A{0}:D{1}", rowEnd, rowEnd)].Merge = true; ws.Cells[string.Format("A{0}:D{1}", rowEnd, rowEnd)].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; ws.Cells[string.Format("A{0}:D{1}", rowEnd, rowEnd)].Style.Border.Top.Style = ExcelBorderStyle.DashDot; ws.Cells["A:AZ"].AutoFitColumns(); Response.Clear(); Response.ContentType = "Application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("content-disposition", "attactment: filename=" + "ExcelReport.xlsx"); Response.BinaryWrite(pck.GetAsByteArray()); Response.End(); return(View()); }
public ActionResult UpdateCart(int ID, int Count) { BillAction.UpdateCart(ID, Count); return(RedirectToAction("ViewCart")); }
public ActionResult DeleteCart(int Id) { BillAction.DeleteCartDetail(Id); return(RedirectToAction("ViewCart")); }
public ActionResult Order(int BillId) { BillAction.AddCartToBill(BillId); return(RedirectToAction("ViewCart")); }
/// <summary> /// 根据单据操作类型和发送人列表获取推送目标 /// </summary> /// <param name="billAction">表单操作类型</param> /// <param name="send">主要发送到的PERSONID</param> /// <param name="to">发送到的PERSONID列表</param> /// <param name="cc">抄送的人员PERSONID列表</param> /// <returns></returns> public static List <PushTarget> GetPushTarget(BillAction billAction, string send, IList <string> to, IList <string> cc) { //检查是否具有 AXPUSERAPP数据表 LibSqlModel sqlModel = LibSqlModelCache.Default.GetSqlModel("axp.User"); bool hasAXPUSERAPP = false; if (sqlModel != null && sqlModel.Tables.Count > 1 && sqlModel.Tables[1].TableName.Equals("AXPUSERAPP")) { hasAXPUSERAPP = true; } if (hasAXPUSERAPP == false) { return(null);//如果没有需要的相关字段则直接返回 } // 查找支持指定BillAction的AppType类型 List <AppType> listType = AppTypeBillActionConfig.Instance.QueryCan(billAction); string listTypeStr = string.Empty; if (listType == null || listType.Count == 0) { return(null); } List <int> listTypeInt = new List <int>(); listType.ForEach(type => { listTypeInt.Add((int)type); }); listTypeStr = string.Join(",", listTypeInt); List <PushTarget> targetList = new List <PushTarget>(); StringBuilder builder = new StringBuilder(); if (!string.IsNullOrEmpty(send)) { builder.AppendFormat("C.PERSONID={0} OR ", LibStringBuilder.GetQuotString(send)); } if (to != null) { foreach (string item in to) { builder.AppendFormat("C.PERSONID={0} OR ", LibStringBuilder.GetQuotString(item)); } } if (cc != null) { foreach (string item in cc) { builder.AppendFormat("C.PERSONID={0} OR ", LibStringBuilder.GetQuotString(item)); } } if (builder.Length > 0) { builder.Remove(builder.Length - 3, 3); string sql = string.Format("select distinct A.CLIENTTYPE,A.CLIENTID from AXPUSERAPP A " + " left join AXPUSER B on A.USERID = B.USERID " + " left join COMPERSON C on B.PERSONID = C.PERSONID " + " where ( {0} ) and A.CLIENTTYPE in ({1})", builder.ToString(), listTypeStr); LibDataAccess dataAccess = new LibDataAccess(); using (IDataReader reader = dataAccess.ExecuteDataReader(sql)) { while (reader.Read()) { int appType = LibSysUtils.ToInt32(reader[0]); string clientId = LibSysUtils.ToString(reader[1]); if (string.IsNullOrEmpty(clientId) == false) { targetList.Add(new PushTarget() { AppType = appType, ClientId = clientId }); } } } } return(targetList); }