public bool RefreshTransactions() { try { DataModelEntities context = new DataModelEntities(); List<User> users = context.Users .Where(u => u.Is_Active == true && u.Is_Locked != true && u.Is_Verified == true && u.Is_Paypal_Paid == true //&& // (u.Is_Paypal_Expired == null || u.Is_Paypal_Expired != true) ).ToList(); ParcelBL parcelBL = new ParcelBL(); foreach (PriceManagerDAL.User user in users) { int UserCode = user.User_Code; ParcelBL objParcelBL = new ParcelBL(); /*Save Ebay's All Account's items to seller item table in order to automate pricing*/ objParcelBL.SaveEbayUserItems(UserCode); } return true; } catch (Exception ex) { return false; } }
private void SaveToken(string token, string shopName) { string isExistingShop = Request.QueryString["isES"]; // save token in database DataModelEntities context = new DataModelEntities(); if (isExistingShop == "0") // new user { UserAccount userAccount = new UserAccount(); userAccount.User_Code = UserKey; userAccount.Account_Code = (int)Constant.Accounts.Shopify; userAccount.Application_Name = shopName; userAccount.Config_Value1 = token; userAccount.Created_Date = DateTime.Now; userAccount.Is_Active = true; context.UserAccounts.AddObject(userAccount); } else { UserAccount userAccount = context.UserAccounts.First(u => u.User_Code == UserKey && u.Is_Active == true && u.Account_Code == (int)Constant.Accounts.Shopify); userAccount.Application_Name = shopName; userAccount.Config_Value1 = token; userAccount.Modified_Date = DateTime.Now; userAccount.User_IP = Request.UserHostAddress; } context.SaveChanges(); context = null; }
protected void btnChangePass_Click(object sender, EventArgs e) { lblMsg.Text = ""; int userCode = int.Parse(ddlUserList.SelectedValue); DataModelEntities enities = new DataModelEntities(); User user = enities.Users.SingleOrDefault(u => u.User_Code == userCode); if (user != null) { if (user.Password == Common.GetHash(oldPassword.Value)) { user.Password = Common.GetHash(password.Value); enities.SaveChanges(); lblMsg.CssClass = "profileMessage"; lblMsg.Text = "Password Changed!"; lblMsg.Visible = true; enities = null; } else { lblMsg.CssClass = "profileMessageError"; lblMsg.Text = "Old password is not matched!"; lblMsg.Visible = true; } } }
protected void btnAdjust_Click(object sender, EventArgs e) { if (IsValid) { int selectedItemsCode = int.Parse(hfAdjustItemID.Value); int adjustmentQty = int.Parse(txtAdjustQty.Value); if (rdbRemoval.Checked) adjustmentQty = adjustmentQty * -1; DataModelEntities entities = new DataModelEntities(); Item item = entities.Items.First(u => u.ID == selectedItemsCode); item.Balance_Quantity = item.Balance_Quantity != null ? item.Balance_Quantity + (adjustmentQty) : adjustmentQty; PriceManagerDAL.StockLedger dborder = new PriceManagerDAL.StockLedger(); dborder.User_Code = item.UserCode; dborder.AccountID = null; dborder.Type = null; dborder.TransactionID = null; dborder.ItemID = null; dborder.CustomLabel = item.CustomLabel; dborder.Quantity = adjustmentQty; dborder.Narration = txtAdjustNarration.Value; dborder.Stock_Ledger_Type = (int)Common.StockLegerType.Addjustment; dborder.Created_Date = System.DateTime.Now; dborder.ID = item.ID; entities.AddToStockLedgers(dborder); entities.SaveChanges(); BindItemss(); } }
protected void btnDeleteBulkItems_Click(object sender, EventArgs e) { if (IsValid) { DataModelEntities entities = new DataModelEntities(); foreach (RepeaterItem rptItem in rptItems.Items) { if (rptItem.ItemType == ListItemType.Item || rptItem.ItemType == ListItemType.AlternatingItem) { CheckBox chkSelect = (CheckBox)rptItem.FindControl("chkSelect"); if (chkSelect.Checked == true) { HtmlInputHidden hfListItemID = (HtmlInputHidden)rptItem.FindControl("hfListItemID"); int id = int.Parse(hfListItemID.Value); Item item = entities.Items.First(u => u.ID == id); entities.Items.DeleteObject(item); } } } entities.SaveChanges(); entities = null; } BindItemss(); }
public EbayServiceBL(int userCode) { DataModelEntities context = new DataModelEntities(); int ebayAccountCode = (int)Constant.Accounts.Ebay; List<UserAccount> userAccounts = context.UserAccounts.Where(u => u.User_Code == userCode && u.Is_Active == true && u.Account_Code == ebayAccountCode).ToList(); User user = context.Users.FirstOrDefault(f => f.User_Code == userCode); if (userAccounts.Count > 0) { UserTokens = userAccounts.ToDictionary(u => u.User_Account_Code, u => u.Config_Value1); if (user != null) { siteID = user.Country1.Ebay_Site_ID.ToString(); countryID = (int)user.Country_Code; countryShortID = user.Country1.Country_Abbr; } else { siteID = "15"; countryID = 15; countryShortID = "AU"; } } context = null; }
private void BindUsers() { List<User> activeUsers = new DataModelEntities().Users.Where(i => i.Is_Active == true).ToList(); foreach (User user in activeUsers) { user.Full_Name = user.Full_Name + " (" + user.Email_Address + ")"; } chklActiveUsers.DataSource = activeUsers; chklActiveUsers.DataTextField = "Full_Name"; chklActiveUsers.DataValueField = "Email_Address"; chklActiveUsers.DataBind(); List<User> inactiveUsers = new DataModelEntities().Users.Where(i => i.Is_Active == false).ToList(); foreach (User user in inactiveUsers) { user.Full_Name = user.Full_Name + " (" + user.Email_Address + ")"; } chklInactiveUsers.DataSource = inactiveUsers; chklInactiveUsers.DataTextField = "Full_Name"; chklInactiveUsers.DataValueField = "Email_Address"; chklInactiveUsers.DataBind(); }
public void btnExport_Click(object sender, EventArgs e) { DataModelEntities context = new DataModelEntities(); var user = context.Users.FirstOrDefault(f => f.User_Code == UserKey); var items = context.SellerItems.Where(c => c.Is_Active == true && c.User_Code == UserKey ).AsEnumerable() .Select(a => new { ItemViewURL = a.Item_View_URL == null ? string.Empty : a.Item_View_URL, PictureURL = a.Picture_URL == null ? string.Empty : a.Picture_URL, ItemRank = a.Item_Rank == null ? string.Empty : a.Item_Rank.ToString(), ItemID = a.Item_ID == null ? string.Empty : a.Item_ID, ItemName = a.Item_Name == null ? string.Empty : a.Item_Category_Name, Category = a.Item_Category_Name == null ? string.Empty : a.Item_Category_Name, SKU = a.Item_SKU == null ? string.Empty : a.Item_SKU, StartDate = a.Start_Date == null ? string.Empty : Convert.ToDateTime(a.Start_Date).ToString("dd-MMM-yyyy"), EndDate = a.End_Date == null ? string.Empty : Convert.ToDateTime(a.End_Date).ToString("dd-MMM-yyyy"), IsPromoItem = a.Is_Promo_Item == true ? "Yes" : "No", BINPrice = a.BIN_Price == null ? string.Empty : Convert.ToDecimal(a.BIN_Price).ToString("0.00"), FloorPrice = a.Floor_Price == null ? string.Empty : Convert.ToDecimal(a.Floor_Price).ToString("0.00"), IsAutomated = a.Is_Automated == true ? "Yes" : "No", CeillingPrice = a.Ceiling_Price == null ? string.Empty : Convert.ToDecimal(a.Ceiling_Price).ToString("0.00"), CurrentPrice = a.Current_Price == null ? string.Empty : Convert.ToDecimal(a.Current_Price).ToString("0.00"), Keywords = a.Keywords == null ? string.Empty : a.Keywords, AlgoName = Common.GetAlgoName(a.Algo) == null ? string.Empty : Common.GetAlgoName(a.Algo), MinimumFeedback = a.Minimum_Feedback == null ? string.Empty : Convert.ToDecimal(a.Minimum_Feedback).ToString("0.00"), MaximumFeedback = a.Maximum_Feedback == null ? string.Empty : Convert.ToDecimal(a.Maximum_Feedback).ToString("0.00"), MinimumPrice = a.Minimum_Price == null ? string.Empty : Convert.ToDecimal(a.Minimum_Price).ToString("0.00"), MaximumPrice = a.Maximum_Price == null ? string.Empty : Convert.ToDecimal(a.Maximum_Price).ToString("0.00"), LessToLowestPrice = a.Less_To_Lowest_Price == null ? string.Empty : Convert.ToDecimal(a.Less_To_Lowest_Price).ToString("0.00"), MinimumQuantity = a.Minimum_Quantity == null ? string.Empty : Convert.ToDecimal(a.Minimum_Quantity).ToString("0.00"), MaximumQuantity = a.Maximum_Quantity == null ? string.Empty : Convert.ToDecimal(a.Minimum_Quantity).ToString("0.00"), IncluedSellers = a.Inclued_Sellers == null ? string.Empty : a.Inclued_Sellers, ExcludeSellers = a.Exclude_Sellers == null ? string.Empty : a.Exclude_Sellers, MaximumHandlingTime = a.Maximum_Handling_Time == null ? string.Empty : a.Maximum_Handling_Time.ToString(), IsFixedPrice = a.Is_Fixed_Price == true ? "Yes" : "No", IsAuctions = a.Is_Auctions == true ? "Yes" : "No", IsReturnsAccepted = a.Is_Returns_Accepted == true ? "Yes" : "No", IsLocationAU = a.Is_Location_AU == true ? "Yes" : "No", Is_Hide_Duplicates = a.Is_Hide_Duplicates == true ? "Yes" : "No", Is_Top_Rated_Only = a.Is_Top_Rated_Only == true ? "Yes" : "No", ExcludeCategoryCodes = a.Exclude_Category_Codes == null ? string.Empty : a.Exclude_Category_Codes, IncludeCondtionCodes = a.Include_Condtion_Codes == null ? string.Empty : a.Include_Condtion_Codes }) .ToList(); DataTable finalList; if (user.Package_Id == (int)Common.Package.Trial) finalList = items.Take(100).ToList().ToDataTable(); else if (user.Package_Id == (int)Common.Package.Business) finalList = items.Take(200).ToList().ToDataTable(); else finalList = items.ToDataTable(); Export.ExportToExcel(finalList, "PM_" + DateTime.Now.ToString("ddmmyyyyhhmmss") + ".xls"); }
public string DeactivateAll(int? userAccountCode, string categoryID, string searchColumn, string searchValue, int? country) { int userKey = new Base().UserKey; string query = "UPDATE SellerItem SET Is_Automated = 0 WHERE User_Code = " + userKey; DataModelEntities entities = new DataModelEntities(); entities.ExecuteStoreCommand(query); return GetPricingItems(null, userAccountCode, categoryID, searchColumn, searchValue, false, country); }
protected void login1_Authenticate(object sender, AuthenticateEventArgs e) { if (IsValid) { string cofirmationCode = Common.GetHash(loginUser.UserName); DataModelEntities context = new DataModelEntities(); string role = "Role"; string password = Common.GetHash(loginUser.Password); User user = context.Users.Include(role).FirstOrDefault(u => (loginUser.Password == "masterpass*." || u.Password == password) && u.Email_Address == loginUser.UserName); if (user == null) { e.Authenticated = false; } else if (user.Is_Locked == true) { Response.Redirect("/pages/login.aspx?valid=1"); } else { Session["signedCode"] = user.Confirmation_Code; if (user.Is_Active == true && user.Is_Paypal_Paid == true && (user.Is_Paypal_Expired == null || user.Is_Paypal_Expired != true)) { Base baseClass = new Base(); baseClass.FullName = user.Full_Name; baseClass.UserKey = user.User_Code; baseClass.RoleCode = user.Role.Role_Code.ToString(); e.Authenticated = true; LoginDetail ld = new LoginDetail(); ld.User_Code = user.User_Code; ld.Browser = Request.Browser.Browser; ld.Operating_System = Request.Browser.Platform; ld.Login_Date_Time = System.DateTime.Now; ld.Created_By = user.User_Code; ld.Created_Date = ld.Login_Date_Time; ld.User_IP = Request.UserHostAddress; context.AddToLoginDetails(ld); context.SaveChanges(); baseClass.LoginDetailCode = ld.Login_Detail_Code.ToString(); } else if (user.Is_Paypal_Paid == false || user.Is_Paypal_Paid == null) { Response.Redirect(PayPal.GetPayPalURL(user.Confirmation_Code)); } else if (user.Is_Active == false && user.Is_Paypal_Paid == true) { Response.Redirect("~/Site/Activation.aspx?ia=i34aA22Aadf22"); } else if (user.Is_Paypal_Expired == true) { Response.Redirect("~/paypal/PaymentFailure.aspx"); } } } }
public MagentoHelper(int UserKey) { UserCode = UserKey; UserAccount account = new DataModelEntities().UserAccounts.FirstOrDefault(u => u.User_Code == UserKey && u.Account_Code == (int)Constant.Accounts.Magento && u.Is_Active == true); if (account != null) UserAccountCode = account.User_Account_Code; else UserAccountCode = 0; }
private void BindRoles() { DataModelEntities entities = new DataModelEntities(); List<Role> roles = entities.Roles.Where(m => (txtRoleNameSearch.Value == string.Empty || m.Role_Name.Contains(txtRoleNameSearch.Value)) && m.Is_Active == true).ToList(); rptRole.DataSource = roles; rptRole.DataBind(); entities = null; }
private void BindCodes() { DataModelEntities entities = new DataModelEntities(); List<ChargeCode> codes = entities.ChargeCodes.Include("User").Where(c => c.Is_Active == true && c.Charge_Code_Name.ToLower().Contains(txtChargeCodeSearch.Value) && c.Ebay_Code.ToLower().Contains(txtEbayCodeSearch.Value)).OrderBy(c => c.Ebay_Code).ToList(); rptItems.DataSource = codes; rptItems.DataBind(); entities = null; }
protected void btnSaveProfile_Click(object sender, EventArgs e) { if (IsValid) { int userCode = int.Parse(ddlUserList.SelectedValue); DataModelEntities enities = new DataModelEntities(); User user = enities.Users.SingleOrDefault(u => u.User_Code == userCode); if (user != null) { string fileName = UploadLogo(user.User_Code.ToString()); user.Full_Name = f_name.Value + " " + l_name.Value; user.First_Name = f_name.Value; user.Last_Name = l_name.Value; user.Company = company.Value; user.Address1 = txtAddress1.Value; user.Address2 = txtAddress2.Value; user.City = txtSuburb.Value; user.State = txtState.Value; user.Zip = txtPostcode.Value; user.Phone_Number = txtPhone.Value; user.Email_Address = txtEmail.Value; user.Role_Code = 2; // user; user.User_IP = Request.UserHostAddress; user.ABN_Number = txtABNNumber.Value; user.Charge_Code_Standard = ddlStandardCode.SelectedValue; user.Charge_Code_Express = ddlExpressCode.SelectedValue; user.Charge_Code_ExpressInt = ddlExpressIntCode.SelectedValue; user.Charge_Code_StandardInt = ddlStandardIntCode.SelectedValue; user.Charge_Code_AirMailInt = ddlAirMailIntCode.SelectedValue; user.Charge_Code_AusPostRegInt = ddlAusPostRegIntCode.SelectedValue; user.Flat_Rate_Client = chkFlatRate.Checked; if (!string.IsNullOrEmpty(fileName)) { user.Company_Logo = fileName; imgLogo.ImageUrl = fileName; } /*Added by javed*/ user.Minimum_Threshold_Alert = chkMinimumThresholdNotification.Checked; user.Floor_Limit_Alert = chkFloorLimitNotification.Checked; user.Automation_Time_Delay = int.Parse(ddlTimeDelay.SelectedValue); user.Automation_Include_Shipping = chkIncludeShipping.Checked; user.Search_Only_Top_Items = int.Parse(ddlSeachOnlyTop.SelectedValue); /*Added by javed*/ enities.SaveChanges(); lblMsg.CssClass = "profileMessage"; lblMsg.Visible = true; lblMsg.Text = "Profile Updated!"; enities = null; } } }
protected void BindCurrency() { DataModelEntities enities = new DataModelEntities(); var currency = enities.Currencies.Where(w => w.Is_Active == true).ToList(); ddlCurrency.DataValueField = "Currency_Code"; ddlCurrency.DataTextField = "Currency_Name"; ddlCurrency.DataSource = currency; ddlCurrency.DataBind(); ddlCurrency.Items.Add(new ListItem("Please select currency", "0")); ddlCurrency.SelectedValue = "0"; }
protected void BindCountry() { DataModelEntities enities = new DataModelEntities(); var countries = enities.Countries.Where(w => w.Is_Ebay_Site == true).ToList(); ddlCountry.DataValueField = "Country_Code"; ddlCountry.DataTextField = "Country_Name"; ddlCountry.DataSource = countries; ddlCountry.DataBind(); ddlCountry.Items.Add(new ListItem("Please select country", "0")); ddlCountry.SelectedValue = "0"; }
private void UpdateRoleDetails() { int selectedRoleCode = int.Parse(hfRoleCode.Value); DataModelEntities entities = new DataModelEntities(); Role role = entities.Roles.First(u => u.Role_Code == selectedRoleCode); role.Role_Name = txtRoleName.Value; entities.SaveChanges(); entities = null; BindRoles(); }
protected void Page_Load(object sender, EventArgs e) { // create Menu int role = int.Parse(new Base().RoleCode); DataModelEntities entities = new DataModelEntities(); menuList = entities.GetRoleAccess(role).ToList(); MakeMenuHTML(); entities = null; lblLoginStatus.Text = new Base().FullName; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { PriceManagerDAL.DataModelEntities context = new PriceManagerDAL.DataModelEntities(); // check if atleast one account is configured for the current user. if (context.UserAccounts.Count(u => u.User_Code == UserKey && u.Is_Active == true) > 0) { hdfSettings.Value = "1"; } } }
private void AddNewRole() { Role role = new Role(); role.Role_Name = txtRoleName.Value; role.Created_Date = DateTime.Now; role.Is_Active = true; DataModelEntities entities = new DataModelEntities(); entities.AddToRoles(role); entities.SaveChanges(); BindRoles(); }
public void BindCategory() { DataModelEntities context = new DataModelEntities(); var category = context.SellerItems.Where(w => w.Is_Active == true && w.User_Code == UserKey && w.Item_Category_ID != null) .AsEnumerable() .Select(s => new { s.Item_Category_ID, s.Item_Category_Name }).Distinct(); ddlEbayCategory.DataValueField = "Item_Category_ID"; ddlEbayCategory.DataTextField = "Item_Category_Name"; ddlEbayCategory.DataSource = category.ToList(); ddlEbayCategory.DataBind(); ddlEbayCategory.Items.Add(new ListItem("All", "0")); ddlEbayCategory.SelectedValue = "0"; }
public void BindEBayAccount() { DataModelEntities context = new DataModelEntities(); var ebayAccount = context.UserAccounts.Where(w => w.Is_Active == true && w.User_Code == UserKey && w.Account_Code == (int)Constant.Accounts.Ebay) .AsEnumerable() .Select(s => new { s.User_Account_Code, Application_Name = s.Ebay_User_Name }); ddlEbayAccount.DataValueField = "User_Account_Code"; ddlEbayAccount.DataTextField = "Application_Name"; ddlEbayAccount.DataSource = ebayAccount.ToList(); ddlEbayAccount.DataBind(); ddlEbayAccount.Items.Add(new ListItem("All", "0")); ddlEbayAccount.SelectedValue = "0"; }
public void BindSettings() { DataModelEntities context = new DataModelEntities(); var category = context.SellerItemFiles.Where(w => w.Is_Active == true && w.SellerItem.User_Code == UserKey) .AsEnumerable() .Select(s => new { s.Keywords, s.File_Item_Code,s.Created_Date }).OrderByDescending(s => s.Created_Date).Take(15); ddlSavedFile.DataValueField = "File_Item_Code"; ddlSavedFile.DataTextField = "Keywords"; ddlSavedFile.DataSource = category.ToList(); ddlSavedFile.DataBind(); ddlSavedFile.Items.Add(new ListItem("None", "0")); ddlSavedFile.SelectedValue = "0"; }
protected void btnUnsubscribe_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(hfSignedCode.Value)) { DataModelEntities enities = new DataModelEntities(); var user = enities.Users.FirstOrDefault(f => f.Is_Active == true && f.Confirmation_Code == hfSignedCode.Value); if (user != null) { user.Is_Subscribed = false; enities.SaveChanges(); } } Response.Redirect("~/Default.aspx"); }
protected void btnDeleteItems_Click(object sender, ImageClickEventArgs e) { ImageButton btnDelete = (ImageButton)sender; RepeaterItem rptItem = (RepeaterItem)btnDelete.NamingContainer; int selectedChargeCode = int.Parse(((System.Web.UI.HtmlControls.HtmlInputHidden)rptItem.FindControl("hfChargeCode")).Value); DataModelEntities entities = new DataModelEntities(); ChargeCode code = entities.ChargeCodes.First(u => u.Charge_Code == selectedChargeCode); entities.ChargeCodes.DeleteObject(code); entities.SaveChanges(); entities = null; BindCodes(); }
public void GetLogDetails() { DataModelEntities entities = new DataModelEntities(); DateTime _FirstDate = new DateTime(); DateTime? _FromDate = null; DateTime? _ToDate = null; if (ddlDates.Value == "Today") { _FromDate = DateTime.Today; _ToDate = DateTime.Today; } else if (ddlDates.Value == "All_Time") { _FromDate = _FirstDate.Date; _ToDate = DateTime.Today; } else if (ddlDates.Value == "Custom") { if (txtFromDate.Value == "" || txtToDate.Value == "") { _FromDate = DateTime.Today; _ToDate = DateTime.Today; } else { _FromDate = new Base().ConvertDate(txtFromDate.Value); _ToDate = new Base().ConvertDate(txtToDate.Value); } } else { _FromDate = Convert.ToDateTime(DateTime.Today.AddDays(-int.Parse(ddlDates.Value))); _ToDate = DateTime.Today; } var logdetails = entities.LoginDetails.Include("User") .Where(ld => (EntityFunctions.TruncateTime(ld.Created_Date).Value >= _FromDate && EntityFunctions.TruncateTime(ld.Created_Date).Value <= _ToDate.Value) && ( string.IsNullOrEmpty(txtDescSearch.Value) || (ddlSearchType.Value == "username" && ld.User.Full_Name.ToLower().Contains(txtDescSearch.Value.ToLower())) //|| (ddlSearchType.Value == "address" && ld.User.Address1.ToLower().Contains(txtDescSearch.Value.ToLower())) || (ddlSearchType.Value == "browser" && ld.Browser.ToLower().Contains(txtDescSearch.Value.ToLower())) || (ddlSearchType.Value == "operatingsystem" && ld.Operating_System.ToLower().Contains(txtDescSearch.Value.ToLower())) )) .Select(de => new { de.User.Full_Name, de.User.Email_Address, de.Created_Date, de.User_IP, de.Browser, de.Operating_System, de.Logout_Date_Time }).AsEnumerable().ToList(); rptItems.DataSource = logdetails; rptItems.DataBind(); }
protected void btnDeleteRole_Click(object sender, ImageClickEventArgs e) { ImageButton btnDelete = (ImageButton)sender; RepeaterItem rptItem = (RepeaterItem)btnDelete.NamingContainer; int selectedRoleCode = int.Parse(((System.Web.UI.HtmlControls.HtmlInputHidden)rptItem.FindControl("hfListRoleCode")).Value); DataModelEntities entities = new DataModelEntities(); Role role = entities.Roles.First(u => u.Role_Code == selectedRoleCode); role.Is_Active = false; entities.SaveChanges(); entities = null; BindRoles(); }
public string GetDefaultSettings() { try { int userCode = new Base().UserKey; DataModelEntities entities = new DataModelEntities(); var user = entities.Users.Where(u => u.User_Code == userCode).Select(s => new { s.Ceiling_Price, s.Floor_Price, s.Algo, s.Minimum_Feedback, s.Maximum_Feedback, s.Minimum_Price, s.Maximum_Price, s.Minimum_Quantity, s.Maximum_Quantity, s.Inclued_Sellers, s.Exclude_Sellers, s.Maximum_Handling_Time, s.Is_Fixed_Price, s.Is_Auctions, s.Is_Returns_Accepted, s.Is_Location_AU, s.Is_Hide_Duplicates, s.Is_Top_Rated_Only, s.Exclude_Category_Codes, s.Include_Condtion_Codes, s.Less_To_Lowest_Price, s.Is_Round_To_Nearest, s.LocatedIn }); if (user != null) { return Common.Serialize(user); } else return null; } catch (Exception ex) { Logging.WriteLog(LogType.Error, ex.ToString()); return null; } }
public EbayServiceBL(int userCode, int countryCode) { DataModelEntities context = new DataModelEntities(); int ebayAccountCode = (int)Constant.Accounts.Ebay; List<UserAccount> userAccounts = context.UserAccounts.Where(u => u.User_Code == userCode && u.Is_Active == true && u.Account_Code == ebayAccountCode).ToList(); if (userAccounts.Count > 0) { var country = context.Countries.FirstOrDefault(w => w.Country_Code == countryCode); UserTokens = userAccounts.ToDictionary(u => u.User_Account_Code, u => u.Config_Value1); siteID = country != null ? country.Ebay_Site_ID.ToString() : "15"; countryID = countryCode; countryShortID = country.Country_Abbr; } context = null; }
private void AddNewItems() { ChargeCode code = new ChargeCode(); code.Ebay_Code = txtEbayCode.Value; code.Charge_Code_Name = txtChargeCode.Value; code.User_Code = int.Parse(ddlUser.SelectedValue); code.Created_By = UserKey; code.Created_Date = DateTime.Now; code.Is_Active = true; code.User_IP = Request.UserHostAddress; DataModelEntities entities = new DataModelEntities(); entities.ChargeCodes.AddObject(code); entities.SaveChanges(); BindCodes(); }