// Adding new user profile in database public bool addUser(UserInformationProperties userData, string currentUserId) { bool result = false; string insertQueryString = "INSERT INTO USER_TABLE(NAME,CONTACT,ADDRESS,EMAIL_ID,USER_ID,PASSWORD,ROLE,IS_VENDOR,VENDOR_ID,VENDOR_NAME,STATUS,CREATED_BY,CREATED_DATE,MODIFIED_BY,MODIFIED_DATE) VALUES(@NAME,@CONTACT,@ADDRESS,@EMAIL_ID,@USER_ID,@PASSWORD,@ROLE,@IS_VENDOR,@VENDOR_ID,@VENDOR_NAME,@STATUS,@CREATED_BY,@CREATED_DATE,@MODIFIED_BY,@MODIFIED_DATE)"; List <KeyValuePair <string, string> > tableQueryData = new List <KeyValuePair <string, string> >(); try { tableQueryData.Add(new KeyValuePair <string, string>("@NAME", userData.Name)); tableQueryData.Add(new KeyValuePair <string, string>("@CONTACT", userData.Contact)); tableQueryData.Add(new KeyValuePair <string, string>("@ADDRESS", userData.Address)); tableQueryData.Add(new KeyValuePair <string, string>("@EMAIL_ID", userData.EMail_Id)); tableQueryData.Add(new KeyValuePair <string, string>("@USER_ID", userData.User_Id)); tableQueryData.Add(new KeyValuePair <string, string>("@PASSWORD", userData.Password)); tableQueryData.Add(new KeyValuePair <string, string>("@ROLE", userData.Role)); tableQueryData.Add(new KeyValuePair <string, string>("@IS_VENDOR", userData.Is_Vendor)); tableQueryData.Add(new KeyValuePair <string, string>("@VENDOR_ID", userData.Vendor_ID)); tableQueryData.Add(new KeyValuePair <string, string>("@VENDOR_NAME", userData.Vendor_Name)); tableQueryData.Add(new KeyValuePair <string, string>("@STATUS", userData.Status)); tableQueryData.Add(new KeyValuePair <string, string>("@CREATED_BY", currentUserId)); tableQueryData.Add(new KeyValuePair <string, string>("@CREATED_DATE", com.app.utlitiy.BusinessUtlities.getCurrentDateTime)); tableQueryData.Add(new KeyValuePair <string, string>("@MODIFIED_BY", currentUserId)); tableQueryData.Add(new KeyValuePair <string, string>("@MODIFIED_DATE", com.app.utlitiy.BusinessUtlities.getCurrentDateTime)); result = DatabaseConnectionHandler.executeInsertDbQuery(insertQueryString, tableQueryData); }catch (Exception ex) { Console.WriteLine(ex.StackTrace); } return(result); }
public bool submitOrder(List <OrderProperties> purchaseOrderInfo) { int numberOfRowsInserted = 0; bool result = false; string insertQueryString = "INSERT INTO SALES_ORDER(ORDER_ID,VENDOR_ID,USER_ID,MANUFACTURER_NAME,PRODUCT_ID,PRODUCT_TYPE,PRODUCT_NAME,COUNT,PRICE_PER_UNIT,TOTAL_PRICE,PAID_AMOUNT,BALANCE_AMOUNT,DISCOUNT_RATE,ORDER_STATUS,DESCRIPTION,CREATED_BY,CREATED_DATE,MODIFY_BY,MODIFY_DATE) VALUES(@ORDER_ID,@VENDOR_ID,@USER_ID,@MANUFACTURER_NAME,@PRODUCT_ID,@PRODUCT_TYPE,@PRODUCT_NAME,@COUNT,@PRICE_PER_UNIT,@TOTAL_PRICE,@PAID_AMOUNT,@BALANCE_AMOUNT,@DISCOUNT_RATE,@ORDER_STATUS,@DESCRIPTION,@CREATED_BY,@CREATED_DATE,@MODIFY_BY,@MODIFY_DATE);"; List <ProductProperties> reduceProductCountList = new List <ProductProperties>(); foreach (OrderProperties orderdetail in purchaseOrderInfo) { ProductProperties productList = new ProductProperties(); List <KeyValuePair <string, string> > queryParameter = new List <KeyValuePair <string, string> >(); queryParameter.Add(new KeyValuePair <string, string>("@ORDER_ID", orderdetail.Order_Id)); queryParameter.Add(new KeyValuePair <string, string>("@VENDOR_ID", orderdetail.Vendor_Id)); queryParameter.Add(new KeyValuePair <string, string>("@USER_ID", orderdetail.User_ID)); queryParameter.Add(new KeyValuePair <string, string>("@MANUFACTURER_NAME", orderdetail.Manufacturer_Name)); queryParameter.Add(new KeyValuePair <string, string>("@PRODUCT_ID", orderdetail.Product_Id)); queryParameter.Add(new KeyValuePair <string, string>("@PRODUCT_TYPE", orderdetail.Product_Type)); queryParameter.Add(new KeyValuePair <string, string>("@PRODUCT_NAME", orderdetail.Product_Name)); queryParameter.Add(new KeyValuePair <string, string>("@COUNT", Convert.ToString(orderdetail.Count))); queryParameter.Add(new KeyValuePair <string, string>("@PRICE_PER_UNIT", Convert.ToString(orderdetail.Price_Per_Unit))); queryParameter.Add(new KeyValuePair <string, string>("@TOTAL_PRICE", Convert.ToString(orderdetail.Total_Price))); queryParameter.Add(new KeyValuePair <string, string>("@PAID_AMOUNT", Convert.ToString(orderdetail.Paid_Amount))); queryParameter.Add(new KeyValuePair <string, string>("@BALANCE_AMOUNT", Convert.ToString(orderdetail.Balance_Amount))); queryParameter.Add(new KeyValuePair <string, string>("@DISCOUNT_RATE", orderdetail.Discount_Rate)); queryParameter.Add(new KeyValuePair <string, string>("@ORDER_STATUS", orderdetail.Order_Status)); queryParameter.Add(new KeyValuePair <string, string>("@DESCRIPTION", orderdetail.Description)); queryParameter.Add(new KeyValuePair <string, string>("@CREATED_BY", orderdetail.User_ID)); queryParameter.Add(new KeyValuePair <string, string>("@CREATED_DATE", BusinessUtlities.getCurrentDateTime)); queryParameter.Add(new KeyValuePair <string, string>("@MODIFY_BY", orderdetail.User_ID)); queryParameter.Add(new KeyValuePair <string, string>("@MODIFY_DATE", BusinessUtlities.getCurrentDateTime)); productList.Product_Id = orderdetail.Product_Id; productList.Product_Current_Count = orderdetail.Count; reduceProductCountList.Add(productList); result = DatabaseConnectionHandler.executeInsertDbQuery(insertQueryString, queryParameter); if (result == true) { ++numberOfRowsInserted; } } if (numberOfRowsInserted.Equals(purchaseOrderInfo.Count())) { InventoryDBProcessHandler reduceProductCount = new InventoryDBProcessHandler(); reduceProductCount.reduceProductCount(reduceProductCountList); Console.WriteLine("Order placed sucessfully"); result = true; } else { Console.WriteLine("Order submission failed"); result = false; } return(result); }
//Add new discount information in discount table public bool addNewDiscountRate(DiscountProperties discountInfo, string UserInfo) { bool result = false; if (discountInfo != null) { string insertQueryString = "INSERT INTO DISCOUNT(DISCOUNT_ID,DISCOUNT_RATE,CREATED_BY,CREATED_DATE,MODIFY_BY,MODIFY_DATE) VALUES (@DISCOUNT_ID,@DISCOUNT_RATE,@CREATED_BY,@CREATED_DATE,@MODIFY_BY,@MODIFY_DATE)"; List <KeyValuePair <string, string> > tableParameter = new List <KeyValuePair <string, string> >(); tableParameter.Add(new KeyValuePair <string, string>("@DISCOUNT_ID", discountInfo.Discount_Id)); tableParameter.Add(new KeyValuePair <string, string>("@DISCOUNT_RATE", discountInfo.Discount_Rate)); tableParameter.Add(new KeyValuePair <string, string>("@CREATED_BY", UserInfo)); tableParameter.Add(new KeyValuePair <string, string>("@CREATED_DATE", com.app.utlitiy.BusinessUtlities.getCurrentDateTime)); tableParameter.Add(new KeyValuePair <string, string>("@MODIFY_BY", UserInfo)); tableParameter.Add(new KeyValuePair <string, string>("@MODIFY_DATE", com.app.utlitiy.BusinessUtlities.getCurrentDateTime)); result = DatabaseConnectionHandler.executeInsertDbQuery(insertQueryString, tableParameter); } return(result); }
//Add new manufacturer in inventory public bool addNewManufacturer(ManufacturerProperties manufacturerInfo, string userInfo) { bool result = false; try { string insertNewManufacturerQuery = "INSERT INTO MANUFACTURER(MANUFACTURER_ID,MANUFACTURER_NAME,MANUFACTURER_DETAIL,CREATED_BY,CREATED_DATE,MODIFIED_BY,MODIFIED_DATE,MANUFACTURER_STATUS) VALUES(@MANUFACTURER_ID,@MANUFACTURER_NAME,@MANUFACTURER_DETAIL,@CREATED_BY,@CREATED_DATE,@MODIFIED_BY,@MODIFIED_DATE,@MANUFACTURER_STATUS)"; List <KeyValuePair <string, string> > tableQueryData = new List <KeyValuePair <string, string> >(); tableQueryData.Add(new KeyValuePair <string, string>("@MANUFACTURER_ID", manufacturerInfo.Manufacturer_Id)); tableQueryData.Add(new KeyValuePair <string, string>("@MANUFACTURER_NAME", manufacturerInfo.Manufacturer_Name)); tableQueryData.Add(new KeyValuePair <string, string>("@MANUFACTURER_DETAIL", manufacturerInfo.Manufacturer_Detail)); tableQueryData.Add(new KeyValuePair <string, string>("@CREATED_BY", userInfo)); tableQueryData.Add(new KeyValuePair <string, string>("@CREATED_DATE", com.app.utlitiy.BusinessUtlities.getCurrentDateTime)); tableQueryData.Add(new KeyValuePair <string, string>("@MODIFIED_BY", userInfo)); tableQueryData.Add(new KeyValuePair <string, string>("@MODIFIED_DATE", com.app.utlitiy.BusinessUtlities.getCurrentDateTime)); tableQueryData.Add(new KeyValuePair <string, string>("@MANUFACTURER_STATUS", manufacturerInfo.Manufacturer_Status)); result = DatabaseConnectionHandler.executeInsertDbQuery(insertNewManufacturerQuery, tableQueryData); }catch (Exception ex) { Console.WriteLine(ex.StackTrace); } return(result); }
public bool submitOrderReturn(OrderReturnProperties saveOrderReturnInfo) { string insertQueryString = "INSERT INTO RETURN_ORDER(RETURN_ORDER_ID,ORDER_ID,VENDOR_ID,USER_ID,PRODUCT_ID,PRODUCT_TYPE,COUNT,PRICE_PER_UNIT,RETURN_DESCRIPTION,RETURN_STATUS,CREATED_BY,CREATED_DATE,MODIFIED_BY,MODIFIED_DATE) VALUES(@RETURN_ORDER_ID,@ORDER_ID,@VENDOR_ID,@USER_ID,@PRODUCT_ID,@PRODUCT_TYPE,@COUNT,@PRICE_PER_UNIT,@RETURN_DESCRIPTION,@RETURN_STATUS,@CREATED_BY,@CREATED_DATE,@MODIFIED_BY,@MODIFIED_DATE)"; List <KeyValuePair <string, string> > queryParameter = new List <KeyValuePair <string, string> >(); queryParameter.Add(new KeyValuePair <string, string>("@RETURN_ORDER_ID", saveOrderReturnInfo.Return_Order_Id)); queryParameter.Add(new KeyValuePair <string, string>("@ORDER_ID", saveOrderReturnInfo.Order_Id)); queryParameter.Add(new KeyValuePair <string, string>("@USER_ID", saveOrderReturnInfo.User_Id)); queryParameter.Add(new KeyValuePair <string, string>("@VENDOR_ID", saveOrderReturnInfo.Vendor_Id)); queryParameter.Add(new KeyValuePair <string, string>("@PRODUCT_ID", saveOrderReturnInfo.Product_Id)); queryParameter.Add(new KeyValuePair <string, string>("@PRODUCT_TYPE", saveOrderReturnInfo.Product_Type)); queryParameter.Add(new KeyValuePair <string, string>("@COUNT", saveOrderReturnInfo.Count.ToString())); queryParameter.Add(new KeyValuePair <string, string>("@PRICE_PER_UNIT", saveOrderReturnInfo.Price_Per_Unit.ToString())); queryParameter.Add(new KeyValuePair <string, string>("@RETURN_DESCRIPTION", saveOrderReturnInfo.Return_Description)); queryParameter.Add(new KeyValuePair <string, string>("@RETURN_STATUS", saveOrderReturnInfo.Return_Status)); queryParameter.Add(new KeyValuePair <string, string>("@CREATED_BY", saveOrderReturnInfo.Created_By)); queryParameter.Add(new KeyValuePair <string, string>("@CREATED_DATE", com.app.utlitiy.BusinessUtlities.getCurrentDateTime)); queryParameter.Add(new KeyValuePair <string, string>("@MODIFIED_BY", saveOrderReturnInfo.Created_By)); queryParameter.Add(new KeyValuePair <string, string>("@MODIFIED_DATE", com.app.utlitiy.BusinessUtlities.getCurrentDateTime)); return(DatabaseConnectionHandler.executeInsertDbQuery(insertQueryString, queryParameter)); }
// Adding new product in Inventory public bool addNewProduct(ProductProperties productInfo, string userInfo) { string insertNewProductQuery = "INSERT INTO PRODUCT (PRODUCT_ID,PRODUCT_NAME,PRODUCT_TYPE,MANUFACTURER_ID,PRODUCT_CURRENT_COUNT,MINIMUM_COUNT,PRICE_PER_UNIT,CREATED_BY,CREATED_DATE,MODIFIED_BY,MODIFIED_DATE) VALUES(@PRODUCT_ID,@PRODUCT_NAME,@PRODUCT_TYPE,@MANUFACTURER_ID,@PRODUCT_CURRENT_COUNT,@MINIMUM_COUNT,@PRICE_PER_UNIT,@CREATED_BY,@CREATED_DATE,@MODIFIED_BY,@MODIFIED_DATE)"; bool resultStatus = false; List <KeyValuePair <string, string> > tableParamsValues = new List <KeyValuePair <string, string> >(); tableParamsValues.Add(new KeyValuePair <string, string>("@PRODUCT_ID", productInfo.Product_Id)); tableParamsValues.Add(new KeyValuePair <string, string>("@PRODUCT_NAME", productInfo.Product_Name)); tableParamsValues.Add(new KeyValuePair <string, string>("@PRODUCT_TYPE", productInfo.Product_Type)); tableParamsValues.Add(new KeyValuePair <string, string>("@MANUFACTURER_ID", productInfo.Manufacturer_Id)); tableParamsValues.Add(new KeyValuePair <string, string>("@PRODUCT_CURRENT_COUNT", Convert.ToString(productInfo.Product_Current_Count))); tableParamsValues.Add(new KeyValuePair <string, string>("@MINIMUM_COUNT", Convert.ToString(productInfo.Minimum_Count))); tableParamsValues.Add(new KeyValuePair <string, string>("@PRICE_PER_UNIT", Convert.ToString(productInfo.Price_Per_Unit))); tableParamsValues.Add(new KeyValuePair <string, string>("@CREATED_BY", userInfo)); tableParamsValues.Add(new KeyValuePair <string, string>("@CREATED_DATE", com.app.utlitiy.BusinessUtlities.getCurrentDateTime)); tableParamsValues.Add(new KeyValuePair <string, string>("@MODIFIED_BY", userInfo)); tableParamsValues.Add(new KeyValuePair <string, string>("@MODIFIED_DATE", com.app.utlitiy.BusinessUtlities.getCurrentDateTime)); resultStatus = DatabaseConnectionHandler.executeInsertDbQuery(insertNewProductQuery, tableParamsValues); return(resultStatus); }
//Add new vendor in Vendor table public bool addCustomerInfo(CustomerProperties newVendorInfo, string userInfo) { bool result = false; string insertQueryString = "INSERT INTO VENDOR(VENDOR_NAME,VENDOR_ID,VENDOR_ADDRESS,VENDOR_CONTACT,VENDOR_EMAIL_ID,VENDOR_STATUS,VENDOR_DISCOUNT_ID,VENDOR_BALANCE_AMOUNT,CREATED_BY,CREATED_DATE,MODIFIED_BY,MODIFIED_DATE) VALUES (@VENDOR_NAME,@VENDOR_ID,@VENDOR_ADDRESS,@VENDOR_CONTACT,@VENDOR_EMAIL_ID,@VENDOR_STATUS,@VENDOR_DISCOUNT_ID,@VENDOR_BALANCE_AMOUNT,@CREATED_BY,@CREATED_DATE,@MODIFIED_BY,@MODIFIED_DATE)"; List <KeyValuePair <string, string> > tableParameter = new List <KeyValuePair <string, string> >(); tableParameter.Add(new KeyValuePair <string, string>("@VENDOR_NAME", newVendorInfo.Vendor_Name)); tableParameter.Add(new KeyValuePair <string, string>("@VENDOR_ID", newVendorInfo.Vendor_Id)); tableParameter.Add(new KeyValuePair <string, string>("@VENDOR_ADDRESS", newVendorInfo.Vendor_Address)); tableParameter.Add(new KeyValuePair <string, string>("@VENDOR_CONTACT", newVendorInfo.Vendor_Contact)); tableParameter.Add(new KeyValuePair <string, string>("@VENDOR_EMAIL_ID", newVendorInfo.Vendor_EMail_Id)); tableParameter.Add(new KeyValuePair <string, string>("@VENDOR_STATUS", newVendorInfo.Vendor_Status)); tableParameter.Add(new KeyValuePair <string, string>("@VENDOR_DISCOUNT_ID", newVendorInfo.Vendor_Discount_ID)); tableParameter.Add(new KeyValuePair <string, string>("@VENDOR_BALANCE_AMOUNT", newVendorInfo.Vendor_Balance_Amount.ToString())); tableParameter.Add(new KeyValuePair <string, string>("@CREATED_BY", userInfo)); tableParameter.Add(new KeyValuePair <string, string>("@CREATED_DATE", com.app.utlitiy.BusinessUtlities.getCurrentDateTime)); tableParameter.Add(new KeyValuePair <string, string>("@MODIFIED_BY", userInfo)); tableParameter.Add(new KeyValuePair <string, string>("@MODIFIED_DATE", com.app.utlitiy.BusinessUtlities.getCurrentDateTime)); result = DatabaseConnectionHandler.executeInsertDbQuery(insertQueryString, tableParameter); return(result); }