public void taInfoInsert() { TaAccounts ac = new TaAccounts(); ac.site_login_id = "ebayId1"; ac.site = "ebay"; ac.token = "ebayToken"; ac.rdate = DateTime.Now; ac.is_use = true; List<TaAccounts> list = new List<TaAccounts>(); list.Add(ac); TaInfo ta = new TaInfo(); ta._id = ObjectId.GenerateNewId(); ta.gmkt_id = "tomochan11"; ta.accounts = list; new TaInfoDac().TaSiteCreate(ta); }
/// <summary> /// Ta Account Select /// 작성자 : 현아람 /// 작성일 : 2012-04-25 /// </summary> /// <param name="siteLoginId"></param> /// <returns></returns> public TaAccounts TaAccountSelect(string siteLoginId) { TaAccounts ret_acc = new TaAccounts(); TaInfo ta = new GEPMongoDacHelper("gep", "ta").FindOne<TaInfo>(Query.EQ("accounts.site_login_id", siteLoginId)); foreach (TaAccounts acc in ta.accounts) { if (acc.site_login_id == siteLoginId) { ret_acc = acc; break; } } return ret_acc; }
/// <summary> /// Ta Account Insert /// 작성자 : 이승현 /// 작성일 : 2012-04-02 /// </summary> /// <param name="taAccounts">Site별 Account정보를 입력</param> public void TaAccountUpsert(string gmktId, TaAccounts taAccounts) { TaInfo taInfo = new GEPMongoDacHelper("gep", "ta").FindOne<TaInfo>(Query.EQ("gmkt_id", gmktId)); TaAccounts selTaAccount = null; if (taInfo == null) return; //TA계정이 존재하지 않음 if (taInfo.accounts == null) { taInfo.accounts = new List<TaAccounts>(); } else { foreach (var rec in taInfo.accounts) { if (rec.site == taAccounts.site && rec.site_login_id == taAccounts.site_login_id) { selTaAccount = rec; } } if (selTaAccount != null) { if (string.IsNullOrEmpty(taAccounts.paypal_account) == true) { taAccounts.paypal_account = selTaAccount.paypal_account; } taInfo.accounts.Remove(selTaAccount); taAccounts.rdate = selTaAccount.rdate; taAccounts.udate = DateTime.Now; } else { taAccounts.rdate = DateTime.Now; } } taInfo.accounts.Add(taAccounts); QueryComplete query = Query.EQ("gmkt_id", gmktId); new GEPMongoDacHelper("gep", "ta").Save<TaInfo>(taInfo); }
/// <summary> /// Ta Account Upsert /// 기존에 있는 경우 PayPal정보는 유지된다. /// token, expire date만 update /// 작성자 : 이승현 /// 작성일 : 2012-04-10 /// </summary> /// <param name="gmktId"></param> /// <param name="site"></param> /// <param name="siteLoginId"></param> /// <param name="siteAccountToken"></param> /// <param name="siteAccountExpireDate"></param> public void TaAccountUpsert(string gmktId, string site, string siteLoginId, string siteAccountToken, DateTime siteAccountExpireDate) { TaAccounts taAccounts = new TaAccounts(); taAccounts.site = site; taAccounts.site_login_id = siteLoginId; taAccounts.token = siteAccountToken; taAccounts.token_expire_date = siteAccountExpireDate; new BizDac.TaInfoDac().TaAccountUpsert(gmktId, taAccounts); }