public static bool SendPasswordRecoveryMail(EmailInfo eInfo) { bool success = false; DataTable dt = new DataTable(); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); Npgsql.NpgsqlCommand command = new Npgsql.NpgsqlCommand(SQLClass.GET_FORGETUSERPASSWORD); command.Parameters.Add("email", eInfo.Email.ToLower()); dt = dbObject.GetDataTable(command); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { eInfo.Email = dr["email"].ToString(); eInfo.Password = dr["webshop_pwd"].ToString(); eInfo.CompanyName = dr["companytype"].ToString(); } string adminMail = Hey.Common.Utils.Functions.GetValueFromWebConfig("hey-admin-mail"); try { success = SendPasswordRecoveryMailToUser(eInfo, adminMail); } catch (Exception ex) { throw new Exception("The email is unknown to the server."); } } else { success = false; } return(success); }
public static List <MaterialGroupFilter> GetNumberOfFilterCombos(string code) { List <MaterialGroupFilter> ListOfFilters = new List <MaterialGroupFilter>(); MaterialGroupFilter FilterObject; DataTable dt = new DataTable(); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); Npgsql.NpgsqlCommand command = new Npgsql.NpgsqlCommand(SQLClass.GET_NUMBEROFFIILTERCOMBO); command.Parameters.Add("group_code", code.ToUpper()); dt = dbObject.GetDataTable(command); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { FilterObject = new MaterialGroupFilter(); FilterObject.FilterId = int.Parse(dr["filter_id"].ToString()); FilterObject.FilterLabel = dr["description"].ToString(); FilterObject.FieldName = dr["field_name"].ToString(); FilterObject.TableName = dr["table_name"].ToString(); FilterObject.ListPosition = int.Parse(dr["list_position"].ToString()); ListOfFilters.Add(FilterObject); } } return(ListOfFilters); }
public static string GetEDMCode(string oCode) { string code = string.Empty; int max = 0; try { string query = SQLClass.IS_ORDER_CODE_EXISTS; NpgsqlCommand command = new NpgsqlCommand(query); command.CommandType = CommandType.Text; command.Parameters.Add("order_code", oCode); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); DataTable dt = new DataTable(); dt = dbObject.GetDataTable(command); string EDM = dt.Rows[0][0].ToString().Trim(); if (oCode.Length == EDM.Length) { code = EDM + "1"; } else { string num = EDM.Substring(oCode.Length); max = int.Parse(num) + 1; code = EDM.Substring(0, oCode.Length - 1) + max.ToString(); } } catch (Exception ex) { Hey.Common.Utils.LogWriter.Log(ex.Message); } return(code); }
public static int InsertEDM(EDM edm) { int isInsert = 0; try { string query = SQLClass.INSERT_INTO_EDM; NpgsqlCommand command = new NpgsqlCommand(query); command.CommandType = CommandType.Text; command.Parameters.Add("edm_code", edm.EDMCode); command.Parameters.Add("description", edm.Description); command.Parameters.Add("revision", edm.Revision); command.Parameters.Add("cust_code", edm.CustCode); command.Parameters.Add("format", edm.Format); command.Parameters.Add("scale", edm.Scale); command.Parameters.Add("first_published", edm.FirstPubl); command.Parameters.Add("last_published", edm.LastPubl); command.Parameters.Add("remarks", edm.Remarks); command.Parameters.Add("author", edm.Author); command.Parameters.Add("last_edited", edm.LastEdited); command.Parameters.Add("last_edited_by", edm.LastEditedBy); command.Parameters.Add("deleted", edm.Deleted); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); isInsert = dbObject.ExecuteQuery(command); } catch (Exception ex) { Hey.Common.Utils.LogWriter.Log(ex.Message); } return(isInsert); }
public IShoppingCart GetACartItem(string item_id) { DataTable dt = new DataTable(); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); NpgsqlCommand command = new NpgsqlCommand(SQLClass.SHOPPING_ITEM); command.Parameters.Add("item_id", item_id); dt = dbObject.GetDataTable(command); IShoppingCart sCart = null; if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; sCart = new ShoppingCartManager(); sCart.ItemCode = dr["item_code"].ToString(); sCart.ItemType = dr["item_type"].ToString(); sCart.Description = dr["description"].ToString(); sCart.Remark = dr["remarks"].ToString(); sCart.Quantity = dr["quantity"].ToString(); sCart.ProductNotes = dr["prodNotes"].ToString(); sCart.Unit = dr["units"].ToString(); sCart.ToEdm = dr["to_edm"].ToString(); sCart.ToProduct = dr["to_products"].ToString(); sCart.PriceCost = dr["price_cost"].ToString(); sCart.PriceSell = dr["price_sell"].ToString(); } return(sCart); }
public void CreateNewCustomizedItem() { IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); NpgsqlCommand command = new NpgsqlCommand(SQLClass.INSERT_CUSTOM_ITEM); command.Parameters.Add("item_id", this.ItemID); command.Parameters.Add("quantity", this.Quantity); command.Parameters.Add("description", this.Description); command.Parameters.Add("price_cost", this.PriceCost); command.Parameters.Add("price_sell", this.PriceSell); command.Parameters.Add("units", this.Unit); command.Parameters.Add("remarks", this.Remark); command.Parameters.Add("prodnotes", this.ProductNotes); command.Parameters.Add("to_edm", this.ToEdm); command.Parameters.Add("to_products", this.ToProduct); dbObject.ExecuteNonQuery(command); NpgsqlCommand commandLastID = new NpgsqlCommand(SQLClass.GET_ORDER_ITEM_LAST_ID); DataTable dt = dbObject.GetDataTable(commandLastID); if (dt.Rows.Count > 0) { commandLastID.Parameters.Add("item_id", dt.Rows[0][0].ToString()); commandLastID.CommandText = SQLClass.UPDATE_CUSTOM_ITEM_TOTAL_PRICE; dbObject.ExecuteNonQuery(commandLastID); } }
public static string GetKLSPCode() { string code = string.Empty; int max = 0; try { string query = SQLClass.GET_MAX_KLSP; NpgsqlCommand command = new NpgsqlCommand(query); command.CommandType = CommandType.Text; IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); DataTable dt = new DataTable(); dt = dbObject.GetDataTable(command); string klsp = dt.Rows[0][0].ToString().Trim(); if (klsp.Length > 4) { string num = klsp.Substring(4); max = int.Parse(num); max = max + 1; } code = "KLSP" + max.ToString(); } catch (Exception ex) { Hey.Common.Utils.LogWriter.Log(ex.Message); } return(code); }
public static List <MaterialGroup> GetSearchFilterData(string input) { List <MaterialGroup> mGroups = new List <MaterialGroup>(); string query = SQLClass.SEARCHQUERY; NpgsqlCommand command = new NpgsqlCommand(); command.Parameters.Add("searchstring", input.ToLower()); command.CommandText = query; DataTable dt = new DataTable(); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); dt = dbObject.GetDataTable(command); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { MaterialGroup mGroup = new MaterialGroup(); mGroup.Code = row["matgroup"].ToString(); mGroup.Description = row["description"].ToString(); mGroup.ItemCount = int.Parse(row["count"].ToString()); mGroups.Add(mGroup); } } return(mGroups); }
public static int UpdateShoppingCartItem(WebOrderItems woItem) { int isUpdate = 0; try { string query = SQLClass.UPDATE_ITEM; NpgsqlCommand command = new NpgsqlCommand(query); command.CommandType = CommandType.Text; command.Parameters.Add("order_id", woItem.OrderId); command.Parameters.Add("item_type", woItem.ItemType); command.Parameters.Add("item_code", woItem.ItemCode); command.Parameters.Add("description", woItem.Description); command.Parameters.Add("quantity", woItem.Quantity); command.Parameters.Add("units", woItem.Units); command.Parameters.Add("price_cost", woItem.PriceCost); command.Parameters.Add("price_sell", woItem.PriceSell); command.Parameters.Add("price_total", woItem.PriceTotal); command.Parameters.Add("discount", woItem.Discount); command.Parameters.Add("remarks", woItem.Remarks); command.Parameters.Add("prodnotes", woItem.ProdNotes); command.Parameters.Add("to_edm", woItem.ToEdm); command.Parameters.Add("to_products", woItem.ToArticles); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); isUpdate = dbObject.ExecuteQuery(command); } catch (Exception ex) { Hey.Common.Utils.LogWriter.Log(ex.Message); } return(isUpdate); }
public static int UpdateAdditionalInfo(WebOrders wsOrder) { int isUpdate = 0; try { string query = SQLClass.UPDATE_ADDITIONAL_INFO; NpgsqlCommand command = new NpgsqlCommand(query); command.CommandType = CommandType.Text; command.Parameters.Add("order_id", wsOrder.OrderID); command.Parameters.Add("cust_code", wsOrder.CustCode); command.Parameters.Add("order_descr", wsOrder.OrderDescription); command.Parameters.Add("total_order_with_vat", wsOrder.TotalOrderWithVat); command.Parameters.Add("total_order", wsOrder.TotalOrder); command.Parameters.Add("prodnotes", wsOrder.ProdNotes); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); isUpdate = dbObject.ExecuteQuery(command); } catch (Exception ex) { Hey.Common.Utils.LogWriter.Log(ex.Message); } return(isUpdate); }
public static int UpdateOrderforDelivery(WebOrders wsOrder) { int isUpdate = 0; try { string query = SQLClass.UPDATE_ORDER_FOR_Delivery; NpgsqlCommand command = new NpgsqlCommand(query); command.CommandType = CommandType.Text; command.Parameters.Add("order_id", wsOrder.OrderID); command.Parameters.Add("shipping_method", wsOrder.ShippingMethod); command.Parameters.Add("delivery_date", wsOrder.DeliveryDate); command.Parameters.Add("cust_name", wsOrder.CustName); command.Parameters.Add("cust_contact", wsOrder.CustContact); command.Parameters.Add("delivery_address", wsOrder.DeliveryAddress); command.Parameters.Add("delivery_zipcode", wsOrder.DeliveryZipcode); command.Parameters.Add("delivery_city", wsOrder.DeliveryCity); command.Parameters.Add("delivery_country", wsOrder.DeliveryCountry); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); isUpdate = dbObject.ExecuteQuery(command); } catch (Exception ex) { Hey.Common.Utils.LogWriter.Log(ex.Message); } return(isUpdate); }
public static int InsertBaseMaterial(BaseMaterial bm) { int isInsert = 0; try { string query = SQLClass.INSERT_INTO_BASEMATERIAL; NpgsqlCommand command = new NpgsqlCommand(query); command.CommandType = CommandType.Text; command.Parameters.Add("matcode", bm.Matcode); command.Parameters.Add("description", bm.Description); command.Parameters.Add("orderdescription", bm.OrderDescription); command.Parameters.Add("suppcode", bm.SuppCode); command.Parameters.Add("prjcode", bm.PrjCode); command.Parameters.Add("edmcode", bm.EdmCode); command.Parameters.Add("unit", bm.Unit); command.Parameters.Add("packunit", bm.PackUnit); command.Parameters.Add("purchaseprice", bm.PurchasePrice); command.Parameters.Add("discount1", bm.Discount1); command.Parameters.Add("discount2", bm.Discount2); command.Parameters.Add("freight", bm.Freight); command.Parameters.Add("addon1", bm.Addon1); command.Parameters.Add("addon2", bm.Addon2); command.Parameters.Add("netprice", bm.NetPrice); command.Parameters.Add("sellprice", bm.SellPrice); command.Parameters.Add("sellperfect", bm.SellPerfect); command.Parameters.Add("orderdate", bm.OrderDate); command.Parameters.Add("deliverydate", bm.DeliveryDate); command.Parameters.Add("instock", bm.InStock); command.Parameters.Add("minstock", bm.MinStock); command.Parameters.Add("maxstock", bm.MaxStock); command.Parameters.Add("minorder", bm.MinOrder); command.Parameters.Add("stockloc", bm.StockLoc); command.Parameters.Add("sparepart", bm.SparePart); command.Parameters.Add("webshop", bm.WebShop); command.Parameters.Add("remark", bm.Remark); command.Parameters.Add("mergecode", bm.MergeCode); command.Parameters.Add("derivedfrom", bm.DerivedFrom); command.Parameters.Add("remarkeng", bm.RemarkEng); command.Parameters.Add("keywords", bm.KeyWords); command.Parameters.Add("filter1", bm.Filter1); command.Parameters.Add("filter2", bm.Filter2); command.Parameters.Add("filter3", bm.Filter3); command.Parameters.Add("filter4", bm.Filter4); command.Parameters.Add("filter5", bm.Filter5); command.Parameters.Add("new_suppcode", bm.NewSuppCode); command.Parameters.Add("cust_code", bm.CustCode); command.Parameters.Add("matcode_suppl", bm.MatcodeSuppl); command.Parameters.Add("deleted", bm.Deleted); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); isInsert = dbObject.ExecuteQuery(command); } catch (Exception ex) { Hey.Common.Utils.LogWriter.Log(ex.Message); } return(isInsert); }
public void CofirmOrder(string status) { IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); NpgsqlCommand command = new NpgsqlCommand(SQLClass.ORDER_CONFIRMATION); command.Parameters.Add("order_status", status); command.Parameters.Add("order_id", this.OrderID); dbObject.ExecuteNonQuery(command); }
public void ReduceStandardItemQuanity() { IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); NpgsqlCommand command = new NpgsqlCommand(SQLClass.REDUCE_STANDARD_ITEM_QUNATITY); command.Parameters.Add("quantity", this.Quantity); command.Parameters.Add("item_id", this.ItemID); dbObject.ExecuteNonQuery(command); }
public void UpdateToCustomItem() { IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); NpgsqlCommand command = new NpgsqlCommand(SQLClass.UPDATE_TO_CUSTOM_ITEM); command.Parameters.Add("quantity", this.Quantity); command.Parameters.Add("item_id", this.ItemID); dbObject.ExecuteNonQuery(command); }
public void DeleteItem() { DataTable dt = new DataTable(); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); NpgsqlCommand command = new NpgsqlCommand(SQLClass.SHOPPING_ITEMS_DELETE); command.Parameters.Add("item_id", this.ItemID); dbObject.ExecuteNonQuery(command); }
public static int InsertShoppingOrder(WebOrders webOrder) { int OrderId = 0; try { string query = SQLClass.INSERT_INTO_WEB_ORDER; NpgsqlCommand command = new NpgsqlCommand(query); command.CommandType = CommandType.Text; command.Parameters.Add("order_code", webOrder.OrderCode); command.Parameters.Add("order_type", webOrder.OrderType); command.Parameters.Add("order_descr", webOrder.OrderDescription); command.Parameters.Add("order_date", webOrder.OrderDate); command.Parameters.Add("order_status", webOrder.OrderStatus); command.Parameters.Add("cust_code", webOrder.CustCode); command.Parameters.Add("cust_name", webOrder.CustName); command.Parameters.Add("cust_contact", webOrder.CustContact); command.Parameters.Add("cust_phone", webOrder.CustPhone); command.Parameters.Add("cust_email", webOrder.CustEmail); command.Parameters.Add("cust_ref", webOrder.CustRef); command.Parameters.Add("delivery_date", webOrder.DeliveryDate); command.Parameters.Add("delivery_address", webOrder.DeliveryAddress); command.Parameters.Add("delivery_zipcode", webOrder.DeliveryZipcode); command.Parameters.Add("delivery_city", webOrder.DeliveryCity); command.Parameters.Add("delivery_country", webOrder.DeliveryCountry); command.Parameters.Add("shipping_method", webOrder.ShippingMethod); command.Parameters.Add("shipping_cost", webOrder.ShippingCost); command.Parameters.Add("total_items", webOrder.TotalItems); command.Parameters.Add("discount_items", webOrder.DiscountItems); command.Parameters.Add("discount_other", webOrder.DiscountOther); command.Parameters.Add("total_vat", webOrder.TotalVat); command.Parameters.Add("total_order", webOrder.TotalOrder); command.Parameters.Add("total_order_with_vat", webOrder.TotalOrderWithVat); command.Parameters.Add("remarks", webOrder.Remarks); command.Parameters.Add("prodnotes", webOrder.ProdNotes); command.Parameters.Add("session_id", webOrder.SessionId); command.Parameters.Add("last_updated", webOrder.LastUpdated); command.Parameters.Add("replicated", webOrder.Replicated); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); dbObject.ExecuteQuery(command); query = SQLClass.MAX_ORDER_ID; command = new NpgsqlCommand(query); DataTable dt = new DataTable(); dt = dbObject.GetDataTable(command); OrderId = int.Parse(dt.Rows[0][0].ToString()); } catch (Exception ex) { Hey.Common.Utils.LogWriter.Log(ex.Message); } return(OrderId); }
public void UpdateShopOrderData(string order_id, string cust_ref, string remarks) { IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); NpgsqlCommand command = new NpgsqlCommand(SQLClass.SHOPPING_ORDER_UPDATE); command.Parameters.Add("order_id", order_id); command.Parameters.Add("customer_ref", cust_ref); command.Parameters.Add("remarks", remarks); dbObject.ExecuteNonQuery(command); }
public DataTable ShopOrderCostDetail(string order_id) { DataTable dt = new DataTable(); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); NpgsqlCommand command = new NpgsqlCommand(SQLClass.SHOPPING_ORDER); command.Parameters.Add("order_id", order_id); dt = dbObject.GetDataTable(command); return(dt); }
public List <IShoppingCart> GetShoppingCart(string sessionid, ItemTypeEnum iType, UserType uType) { NpgsqlCommand command = new NpgsqlCommand(); string selectQuery = string.Empty; if (iType == ItemTypeEnum.STANDARD && uType == UserType.ANONYMOUS) { selectQuery = SQLClass.SHOPPING_ITEMS_QUERY; command = new NpgsqlCommand(selectQuery); command.Parameters.Add("sessionid", sessionid); } else if (iType == ItemTypeEnum.STANDARD && uType == UserType.REGISTERED) { selectQuery = SQLClass.SHOPPING_ITEMS_REG_QUERY; command = new NpgsqlCommand(selectQuery); command.Parameters.Add("cust_code", sessionid); } else if (iType == ItemTypeEnum.STANDARD && uType == UserType.ADMIN) { selectQuery = SQLClass.SHOPPING_ITEMS_ADM_QUERY; command = new NpgsqlCommand(selectQuery); command.Parameters.Add("cust_code", sessionid); } else { selectQuery = SQLClass.SHOPPING_ITEMS_QUERY_SPECIAL; command = new NpgsqlCommand(selectQuery); command.Parameters.Add("cust_code", sessionid); } List <IShoppingCart> shoppingCart = new List <IShoppingCart>(); DataTable dt = new DataTable(); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); dt = dbObject.GetDataTable(command); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { IShoppingCart sCart = new ShoppingCartManager(); sCart.ItemID = dr["item_id"].ToString(); sCart.OrderID = dr["order_id"].ToString(); sCart.Description = dr["description"].ToString(); sCart.Remark = dr["remarks"].ToString(); sCart.Quantity = dr["quantity"].ToString(); sCart.UnitPrice = dr["price_sell"].ToString(); sCart.Total = dr["Total"].ToString(); shoppingCart.Add(sCart); } } return(shoppingCart); }
public void UpdateItems() { DataTable dt = new DataTable(); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); NpgsqlCommand command = new NpgsqlCommand(SQLClass.SHOPPING_ITEMS_UPDATE); command.Parameters.Add("quantity", this.Quantity); command.Parameters.Add("item_id", this.ItemID); command.Parameters.Add("remark", this.Remark); dbObject.ExecuteNonQuery(command); }
public static DataTable GetAllItemForOrder(int OrderId) { string query = SQLClass.GET_ALL_ITEM_FOR_ORDER; NpgsqlCommand command = new NpgsqlCommand(); command.Parameters.Add("order_id", OrderId); command.CommandText = query; DataTable dt = new DataTable(); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); dt = dbObject.GetDataTable(command); return(dt); }
public static DataTable GetAllCustomers() { //DropDownList drp = new DropDownList(); string query = SQLClass.GET_TOTAL_CUSTOMERS; NpgsqlCommand command = new NpgsqlCommand(); command.CommandText = query; DataTable dt = new DataTable(); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); dt = dbObject.GetDataTable(command); return(dt); }
public static DataTable GetDiscountForCustomer(string custCode) { string query = SQLClass.GET_DISCOUNT_FOR_CUSTOMER; NpgsqlCommand command = new NpgsqlCommand(); command.Parameters.Add("cust_code", custCode.ToUpper()); command.CommandText = query; DataTable dt = new DataTable(); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); dt = dbObject.GetDataTable(command); return(dt); }
public static DataTable CheckOrderExist(string sessionId) { string query = SQLClass.IS_ORDER_EXIST; NpgsqlCommand command = new NpgsqlCommand(); command.Parameters.Add("session_id", sessionId); command.CommandText = query; DataTable dt = new DataTable(); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); dt = dbObject.GetDataTable(command); return(dt); }
public static DataTable CheckREGOrADMOrderExist(string CustCode) { string query = SQLClass.IS_REG_ADM_ORDER_EXIST; NpgsqlCommand command = new NpgsqlCommand(); command.Parameters.Add("cust_code", CustCode.ToUpper()); command.CommandText = query; DataTable dt = new DataTable(); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); dt = dbObject.GetDataTable(command); return(dt); }
public static DataTable GetCountryList() { //DropDownList drp = new DropDownList(); string query = SQLClass.COUNTRY_LIST; NpgsqlCommand command = new NpgsqlCommand(); command.CommandText = query; DataTable dt = new DataTable(); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); dt = dbObject.GetDataTable(command); return(dt); }
public static DropDownList CreateFilterCombo(MaterialGroupFilter filterCombo) { DataTable dt = new DataTable(); DropDownList drp = new DropDownList(); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); string query = "SELECT DISTINCT " + filterCombo.FieldName + " FROM " + filterCombo.TableName + " ORDER BY " + filterCombo.FieldName; dt = dbObject.GetDataTable(query); drp = CreateDropdownList(dt); drp.Items.Insert(0, new ListItem("")); return(drp); }
public void OnExecute() { if (string.IsNullOrEmpty(DatabaseConfigurationFile)) { DatabaseConfigurationFile = ConfigurationConstants.DatabasePath; } var dbConfig = ConfigurationHelper.Load <DatabaseConfiguration>(DatabaseConfigurationFile, ConfigurationConstants.DatabaseConfiguration); if (dbConfig is null) { Console.WriteLine("Couldn't load database configuration file during execution of user show command."); return; } using IRhisisDatabase database = _databaseFactory.CreateDatabaseInstance(dbConfig); DbUser user = database.Users.Include(x => x.Characters).FirstOrDefault(x => x.Username.Equals(Username, StringComparison.OrdinalIgnoreCase)); if (user == null) { Console.WriteLine($"Cannot find user with username: '******'."); } else { Console.WriteLine("#########################"); Console.WriteLine("# User information #"); Console.WriteLine("#########################"); Console.WriteLine($"Username: {user.Username}"); Console.WriteLine($"Email: {user.Email}"); Console.WriteLine($"Authority: {user.Authority.ToString()}"); Console.WriteLine($"Deleted: {user.IsDeleted}"); Console.WriteLine($"Last connection: {user.LastConnectionTime:yyyy/MM/dd HH:mm:ss}"); Console.WriteLine($"Play time: {TimeSpan.FromSeconds(user.PlayTime):hh\\:mm\\:ss}"); Console.WriteLine($"Number of characters: {user.Characters.Count}"); if (user.Characters.Any()) { for (int i = 0; i < user.Characters.Count; i++) { DbCharacter character = user.Characters.ElementAt(i); Console.WriteLine("-------------------------"); Console.WriteLine($"Character name: {character.Name} (id: {character.Id})"); Console.WriteLine($"Deleted: {character.IsDeleted}"); } } } }
public static DataTable CheckOrderItemExist(int OrderId, string ItemCode) { string query = SQLClass.IS_ORDER_ITEM_EXIST; NpgsqlCommand command = new NpgsqlCommand(); command.Parameters.Add("order_id", OrderId); command.Parameters.Add("item_code", ItemCode.ToUpper()); command.CommandText = query; DataTable dt = new DataTable(); IDatabaseFactory dbFactory = new DatabaseFactory(); IDatabase dbObject = dbFactory.CreateDatabaseInstance(ACTIVE_DATABASE); dt = dbObject.GetDataTable(command); return(dt); }