private static void Log(string Ticks, string UserId, string ActionId, string ActionDetails) { DataAccessManager dam = new DataAccessManager(); string[,] paramArray = { {"@Ticks", Ticks}, {"@UserId", UserId}, {"@ActionId", ActionId}, {"@ActionDetails", ActionDetails}}; dam.ExecuteNonQuery(CommandType.StoredProcedure, "InsertUserLog", paramArray); }
//New Method for Delete Order on OrderId public int DeleteOrder(int OrderID, int Operation) { int Result=0; //Operation=2; DataAccessManager dam= new DataAccessManager(); string[,] paraArray = { {"@OrderId",OrderID.ToString()}, {"@Operation",Operation.ToString()} }; Result = dam.ExecuteNonQuery(CommandType.StoredProcedure, "InsertUpdateDeleteOrder", paraArray); return Result; }
public bool InsertNewShop(string Operation, string ShopName, string ShopSologon, string Registration, string Address, string PhoneNumber, string Properiter, string SaleNote) { bool result = false; DataAccessManager dam = new DataAccessManager(); string[,] paramArray = { {"@Operation", Operation}, {"@ShopName", ShopName}, {"@ShopAddress", Address}, {"@ShopNumber", PhoneNumber}, {"@ShopSlogon", ShopSologon}, {"@RegistrationNumber", Registration}, {"@Properiter", Properiter}, {"@SaleNote", SaleNote} }; result = dam.ExecuteNonQuery(CommandType.StoredProcedure, "InsertUpdateDeleteShop", paramArray) > 0; return result; }
public bool InsertUpdateItemType(string Id, string Name, string IsActive) { bool result = false; int operation = 0; int.TryParse(Id, out operation); if (operation > 0) operation = 1; DataAccessManager dam = new DataAccessManager(); string[,] paramArray = { {"@Operation", operation.ToString()}, {"@ItemTypeId", Id}, {"@ItemTypeName", Name}, {"@IsActive", IsActive} }; result = dam.ExecuteNonQuery(CommandType.StoredProcedure, "InsertUpdateDeleteItemType", paramArray) > 0; return result; }
public static bool CreateUpdateUser(string UserName , string Password, string Name, string ContactNumber, string Address, string IsActive , string AllowInvoice, string AllowStock, string AllowCompany, string AllowCustomer , string AllowItem, string AllowShop, string AllowReports, string AllowUserManagement, string AllowOrder, string AllowCompanyPayment, string AllowCustomerPayment, string AllowReturnSale, string AllowReturnPurchase, int Opertion) { bool result = false; try { DataAccessManager dam = new DataAccessManager(); string[,] pararray = {{"@UserName",UserName}, {"@Password",Password}, {"@Name",Name}, {"@ContactNumber",ContactNumber}, {"@Address",Address}, {"@IsActive",IsActive}, {"@AllowInvoice",AllowInvoice}, {"@AllowStock",AllowStock}, {"@AllowCompany",AllowCompany}, {"@AllowCustomer",AllowCustomer}, {"@AllowItem",AllowItem}, {"@AllowShop",AllowShop}, {"@AllowReports",AllowReports}, {"@AllowUserManagement",AllowUserManagement}, {"@AllowOrder",AllowOrder}, {"@AllowCompanyPayment",AllowCompanyPayment}, {"@AllowCustomerPayment",AllowCustomerPayment}, {"@AllowReturnSale",AllowReturnSale}, {"@AllowReturnPurchase",AllowReturnPurchase}, {"@Id",Opertion.ToString()} }; result = dam.ExecuteNonQuery(CommandType.StoredProcedure, "InsertUpdateDeleteUser", pararray) > 0; } catch (Exception exe) { throw exe; } return result; }
public static bool ChangePassword(string UserName, string Password, string NewPassword, int Operation) { try { bool result = false; DataAccessManager dam = new DataAccessManager(); string[,] pararry = {{"@UserName",UserName}, {"@Password",Password}, {"@NewPassword",NewPassword}, {"@Operation",Operation.ToString()} }; result = dam.ExecuteNonQuery(CommandType.StoredProcedure, "ChangePassword", pararry) > 0; return result; } catch (Exception exe) { throw exe; } }
public bool InsertUpdateCustomer(string Id, string code, string name, string contact, string address, string balance, string IsActive, string Remarks, string City, string ContactPerson, string Phone, string Fax, string Web, string Email) { bool result = false; try { //@Remarks ,@City ,@ContactPerson ,@Phone ,@Fax ,@Web ,@Email int operation = 0; int.TryParse(Id, out operation); if (operation > 0) operation = 1; DataAccessManager dam = new DataAccessManager(); string[,] paramArray = { {"@Operation", operation.ToString()}, {"@CustomerId", Id}, {"@CustomerCode", code}, {"@CustomerName", name}, {"@ContactNumber", contact}, {"@Address", address}, {"@CustomerBalance", balance}, {"@Remarks", Remarks}, {"@City", City}, {"@ContactPerson", ContactPerson}, {"@Phone", Phone}, {"@Fax", Fax}, {"@Web", Web}, {"@Email", Email}, {"@IsActive", IsActive} }; result = dam.ExecuteNonQuery(CommandType.StoredProcedure, "InsertUpdateDeleteCustomer", paramArray) > 0; } catch (Exception ex) { throw ex; } return result; }
public static void LogException(Modules Module, string Method, Exception excp,string title) { try { if (excp != null) { string Message = excp.Message; string StackTrace = excp.StackTrace; string InnerMessage = null; if (excp.InnerException != null) { InnerMessage = excp.InnerException.Message; } bool result = false; DataAccessManager dam = new DataAccessManager(); string[,] paramArray = { {"@Module", Module.ToString()}, {"@Method", Method}, {"@Message", Message}, {"@StackTrace", StackTrace}, {"@InnerMessage", InnerMessage} }; dam.ExecuteNonQuery(CommandType.StoredProcedure, "InsertExceptionLog", paramArray); ExceptionMessageShow exception1 = new ExceptionMessageShow(title,Message); exception1.ShowExceptionMessage(); } } catch (Exception ex) { ExceptionMessageShow exception1 = new ExceptionMessageShow(title,ex.Message.ToString()); exception1.ShowExceptionMessage(); } }
public bool InsertUpdateItem(string Id, string ItemCode, string ItemName, string itemType, string packing, string CompanyId, string ItemInStock, string PurchasePrice, string SalePrice, string Discount, string IsActive,string BatchNo,DateTime ExpiryDate) { bool result = false; try { int operation = 0; int.TryParse(Id, out operation); if (operation > 0) operation = 1; DataAccessManager dam = new DataAccessManager(); //object of DataManager class string[,] paramArray = { {"@Operation", operation.ToString()}, {"@ItemId", Id}, {"@ItemCode", ItemCode}, {"@ItemName", ItemName}, {"@ItemType", itemType}, {"@Packing", packing}, {"@CompanyId",CompanyId}, {"@ItemInStock", ItemInStock}, {"@PurchasePrice", PurchasePrice}, {"@SalePrice", SalePrice}, {"@Discount", Discount}, {"@IsActive", IsActive}, {"@ExpiryDate",Common.FormateDateForDB(ExpiryDate)}, {"@BatchNo",BatchNo} }; result = dam.ExecuteNonQuery(CommandType.StoredProcedure, "InsertUpdateDeleteItem", paramArray) > 0; } catch (Exception ex) { throw ex; } return result; }
public static void UpdateLR() { DataAccessManager dam = new DataAccessManager(); dam.ExecuteNonQuery(CommandType.Text, string.Format("UPDATE Shop SET [A34C0CEC63EC0F1739FB5CB8F43A9CE1]='{0}'", Encrypt(DateTime.Now.ToString(), pass))); }
public static void InitializeDatabase() { DataAccessManager dam = new DataAccessManager(); dam.ExecuteNonQuery(CommandType.StoredProcedure, "Admin_InitializeDatabase"); }
public static bool UnRegister() { bool result = false; DataAccessManager dam = new DataAccessManager(); string[,] paramArray = { {"@P1", null }, {"@P2", null}, {"@P3", null}, {"@P4", null} }; result = dam.ExecuteNonQuery(CommandType.StoredProcedure, "Test", paramArray) > 0; return result; }
public static bool CreateRegistration(DateTime expiryDate) { string p1 = CreateUniqueKey(); string p2 = Encrypt(DateTime.Now.ToString("MM-dd-yyyy"), pass); string p3 = Encrypt(expiryDate.ToString("MM-dd-yyyy"), pass); string p4 = Encrypt(DateTime.Now.ToString(), pass); bool result = false; DataAccessManager dam = new DataAccessManager(); string[,] paramArray = { {"@P1", p1 }, {"@P2", p2}, {"@P3", p3}, {"@P4", p4} }; result = dam.ExecuteNonQuery(CommandType.StoredProcedure, "Test", paramArray) > 0; return result; }
public static int ExecuteUpdateDeleteQuery(string query) { int count = 0; try { DataAccessManager dam = new DataAccessManager(); count = dam.ExecuteNonQuery(CommandType.Text, query); } catch (Exception ex) { throw; } return count; }
public static void CreateBackup(string filePath) { DataAccessManager dam = new DataAccessManager(); string[,] paramArray = { { "@FilePath", filePath } }; dam.ExecuteNonQuery(CommandType.StoredProcedure, "Admin_CreateBackup", paramArray); }
private int SaveReceiptDetail( string ReceiptId, string ItemId, string SalePrice, string Quantity, string GrandTotal, string Discount, string Total, string ItemDiscount, bool IsReturn, string PrevReceiptId ) { int count = 0; try { DataAccessManager dam = new DataAccessManager(); string[,] paramArray = { {"@ReceiptId", ReceiptId }, {"@ItemId", ItemId }, {"@SalePrice", string.IsNullOrEmpty(SalePrice)?"0":SalePrice }, {"@Quantity", string.IsNullOrEmpty(Quantity)?"0":Quantity }, {"@GrandTotal", string.IsNullOrEmpty(GrandTotal)?"0":GrandTotal }, {"@Discount", string.IsNullOrEmpty(Discount)?"0":Discount }, {"@Total", string.IsNullOrEmpty(Total)?"0":Total }, {"@ItemDiscount", string.IsNullOrEmpty(ItemDiscount)?"0":ItemDiscount }, {"@IsReturn", IsReturn?"1":"0"}, {"@PrevReceiptId", PrevReceiptId} }; count = dam.ExecuteNonQuery(CommandType.StoredProcedure, "InsertUpdateDeleteReceiptDetail", paramArray); } catch (Exception ex) { throw ex; } return count; }
private int SaveOrderDetail(string OrderId, string ItemId, string PurchasePrice, string Quantity, string Total, string Discount, string GrandTotal) { int count = 0; try { DataAccessManager dam = new DataAccessManager(); string[,] paramArray = { {"@OrderId", OrderId }, {"@ItemId", ItemId }, {"@PurchasePrice", PurchasePrice }, {"@Quantity", Quantity }, {"@Total", Total }, {"@Discount", Discount}, {"@GrandTotal", GrandTotal} }; count = dam.ExecuteNonQuery(CommandType.StoredProcedure, "InsertUpdateDeleteOrderDetail", paramArray); } catch (Exception ex) { throw ex; } return count; }
private void SetReceiptProfitLoss(long ReceiptId) { try { DataAccessManager dam = new DataAccessManager(); dam.ExecuteNonQuery(CommandType.Text, "exec SetReceiptProfitLoss " + ReceiptId.ToString()); } catch (Exception exe) { throw exe; } }
private int SaveInvoiceDetail(string InvoiceId, string ItemId, string PurchasePrice, string Quantity, string Total, string Discount, string GrandTotal, bool IsReturn) { int count = 0; DataAccessManager dam = new DataAccessManager(); string[,] paramArray = { {"@InvoiceId", InvoiceId }, {"@ItemId", ItemId }, {"@PurchasePrice", string.IsNullOrEmpty(PurchasePrice)?"0":PurchasePrice }, {"@Quantity", string.IsNullOrEmpty(Quantity)?"0":Quantity }, {"@Total", string.IsNullOrEmpty(Total)?"0":Total }, {"@Discount", string.IsNullOrEmpty(Discount)?"0":Discount}, {"@GrandTotal", string.IsNullOrEmpty(GrandTotal)?"0":GrandTotal}, {"@IsReturn", IsReturn?"1":"0"} }; count = dam.ExecuteNonQuery(CommandType.StoredProcedure, "InsertUpdateDeleteInvoiceDetail", paramArray); //} return count; }