Beispiel #1
0
        public HttpResponseMessage CreateUser(Users user_requests)
        {
            UserManager          userManager        = new UserManager();
            cls_common_responses clsCommonResponses = new cls_common_responses();

            if (user_requests == null)
            {
                clsCommonResponses.ResponseCode    = 400;
                clsCommonResponses.ResponseMessage = "";
                return(this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses));
            }
            HttpResponseMessage response;

            try
            {
                cls_common_responses user = userManager.CreateUser("Proc_Users_Save", user_requests);
                int responseCode          = user.ResponseCode;
                response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, user);
            }
            catch (Exception ex)
            {
                clsCommonResponses.ResponseCode    = 400;
                clsCommonResponses.ResponseMessage = "Something went wrong, please try again later.";
                response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses);
            }
            return(response);
        }
        public HttpResponseMessage CreateSalesContract(
            SalesContract salescontract_requests)
        {
            SalesContractManager salesContractManager = new SalesContractManager();
            cls_common_responses clsCommonResponses   = new cls_common_responses();

            if (salescontract_requests == null)
            {
                clsCommonResponses.ResponseCode    = 400;
                clsCommonResponses.ResponseMessage = "";
                return(this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses));
            }
            HttpResponseMessage response;

            try
            {
                salescontract_requests.CreatedBy   = new int?(1);
                salescontract_requests.CreatedDate = new DateTime?(DateTime.Now);
                cls_common_responses salesContract = salesContractManager.CreateSalesContract("Proc_SalesContract_Save", salescontract_requests);
                int responseCode = salesContract.ResponseCode;
                response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, salesContract);
            }
            catch (Exception ex)
            {
                clsCommonResponses.ResponseCode    = 400;
                clsCommonResponses.ResponseMessage = "Something went wrong, please try again later.";
                response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses);
            }
            return(response);
        }
        public cls_common_responses DeleteWarehouse(int WarehouseID)
        {
            cls_common_responses clsCommonResponses = new cls_common_responses();

            try
            {
                using (CustomERPEntities customErpEntities = new CustomERPEntities())
                {
                    Warehouse entity = customErpEntities.Warehouse.Where <Warehouse>((Expression <Func <Warehouse, bool> >)(u => u.IDNUMBER == WarehouseID)).FirstOrDefault <Warehouse>();
                    if (entity == null)
                    {
                        clsCommonResponses.ResponseGenID   = 0;
                        clsCommonResponses.ResponseCode    = 400;
                        clsCommonResponses.ResponseMessage = "Something went wrong, please try again later.";
                    }
                    else
                    {
                        customErpEntities.Warehouse.Remove(entity);
                        customErpEntities.SaveChanges();
                        clsCommonResponses.ResponseGenID   = 0;
                        clsCommonResponses.ResponseCode    = 200;
                        clsCommonResponses.ResponseMessage = "Record Delete SuccessFully!!";
                    }
                }
            }
            catch (Exception ex)
            {
                clsCommonResponses.ResponseGenID   = 0;
                clsCommonResponses.ResponseCode    = 400;
                clsCommonResponses.ResponseMessage = "Something went wrong, please try again later.";
            }
            return(clsCommonResponses);
        }
        public HttpResponseMessage Createwarehouse(Warehouse warehouse_requests)
        {
            WarehouseManager     warehouseManager    = new WarehouseManager();
            cls_common_responses clsCommonResponses1 = new cls_common_responses();

            if (warehouse_requests == null)
            {
                clsCommonResponses1.ResponseCode    = 400;
                clsCommonResponses1.ResponseMessage = "";
                return(this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses1));
            }
            HttpResponseMessage response;

            try
            {
                warehouse_requests.CreatedBy   = new int?(1);
                warehouse_requests.CreatedDate = new DateTime?(DateTime.Now);
                warehouse_requests.UpdatedBy   = new int?(1);
                warehouse_requests.UpdatedDate = new DateTime?(DateTime.Now);
                cls_common_responses clsCommonResponses2 = warehouseManager.Createwarehouse("Proc_Warehouse_Save", warehouse_requests);
                int responseCode = clsCommonResponses2.ResponseCode;
                response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses2);
            }
            catch (Exception ex)
            {
                clsCommonResponses1.ResponseCode    = 400;
                clsCommonResponses1.ResponseMessage = "Something went wrong, please try again later.";
                response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses1);
            }
            return(response);
        }
        public HttpResponseMessage CreateCategory(Category category_requests)
        {
            CategoryManager      categoryManager    = new CategoryManager();
            cls_common_responses clsCommonResponses = new cls_common_responses();

            if (category_requests == null)
            {
                clsCommonResponses.ResponseCode    = 400;
                clsCommonResponses.ResponseMessage = "";
                return(this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses));
            }
            HttpResponseMessage response;

            try
            {
                category_requests.CreatedBy   = new int?(1);
                category_requests.CreatedDate = new DateTime?(DateTime.Now);
                category_requests.UpdatedBy   = new int?(1);
                category_requests.UpdateDate  = new DateTime?(DateTime.Now);
                cls_common_responses category = categoryManager.CreateCategory("Proc_Category_Save", category_requests);
                int responseCode = category.ResponseCode;
                response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, category);
            }
            catch (Exception ex)
            {
                clsCommonResponses.ResponseCode    = 400;
                clsCommonResponses.ResponseMessage = "Something went wrong, please try again later.";
                response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses);
            }
            return(response);
        }
        public HttpResponseMessage CreateSupplier(Supplier supplier_requests)
        {
            SupplierManager      supplierManager    = new SupplierManager();
            cls_common_responses clsCommonResponses = new cls_common_responses();

            if (supplier_requests == null)
            {
                clsCommonResponses.ResponseCode    = 400;
                clsCommonResponses.ResponseMessage = "";
                return(this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses));
            }
            HttpResponseMessage response;

            try
            {
                supplier_requests.CreatedBy   = new int?(1);
                supplier_requests.CreatedDate = new DateTime?(DateTime.Now);
                supplier_requests.UpdatedBy   = new int?(1);
                supplier_requests.UpdatedDate = new DateTime?(DateTime.Now);
                cls_common_responses suplier = supplierManager.CreateSuplier("Proc_Supplier_Save", supplier_requests);
                int responseCode             = suplier.ResponseCode;
                response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, suplier);
            }
            catch (Exception ex)
            {
                clsCommonResponses.ResponseCode    = 400;
                clsCommonResponses.ResponseMessage = "Something went wrong, please try again later.";
                response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses);
            }
            return(response);
        }
Beispiel #7
0
        public HttpResponseMessage CreateEmployee(Employee employee_requests)
        {
            EmployeeManager      employeeManager    = new EmployeeManager();
            cls_common_responses clsCommonResponses = new cls_common_responses();

            if (employee_requests == null)
            {
                clsCommonResponses.ResponseCode    = 400;
                clsCommonResponses.ResponseMessage = "";
                return(this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses));
            }
            HttpResponseMessage response;

            try
            {
                employee_requests.CreatedBy   = new int?(1);
                employee_requests.CreatedDate = new DateTime?(DateTime.Now);
                employee_requests.UpdatedBy   = new int?(1);
                employee_requests.UpdatedDate = new DateTime?(DateTime.Now);
                cls_common_responses employee = employeeManager.CreateEmployee("Proc_Employee_Save", employee_requests);
                int responseCode = employee.ResponseCode;
                response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, employee);
            }
            catch (Exception ex)
            {
                clsCommonResponses.ResponseCode    = 400;
                clsCommonResponses.ResponseMessage = "Something went wrong, please try again later.";
                response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses);
            }
            return(response);
        }
Beispiel #8
0
        public HttpResponseMessage CreatePurchase(Purchase purchase_requests)
        {
            PurchaseManager      purchaseManager    = new PurchaseManager();
            cls_common_responses clsCommonResponses = new cls_common_responses();

            if (purchase_requests == null)
            {
                clsCommonResponses.ResponseCode    = 400;
                clsCommonResponses.ResponseMessage = "";
                return(this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses));
            }
            HttpResponseMessage response;

            try
            {
                purchase_requests.CreatedBy   = new int?(1);
                purchase_requests.CreatedDate = new DateTime?(DateTime.Now);
                cls_common_responses purchase = purchaseManager.CreatePurchase("Proc_Purchase_Save", purchase_requests);
                int responseCode = purchase.ResponseCode;
                response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, purchase);
            }
            catch (Exception ex)
            {
                clsCommonResponses.ResponseCode    = 400;
                clsCommonResponses.ResponseMessage = "Something went wrong, please try again later.";
                response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses);
            }
            return(response);
        }
Beispiel #9
0
        public HttpResponseMessage CreateProduct(Item product_requests)
        {
            ProductManager       productManager     = new ProductManager();
            cls_common_responses clsCommonResponses = new cls_common_responses();

            if (product_requests == null)
            {
                clsCommonResponses.ResponseCode    = 400;
                clsCommonResponses.ResponseMessage = "";
                return(this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses));
            }
            HttpResponseMessage response;

            try
            {
                product_requests.CreatedBy   = new int?(1);
                product_requests.CreatedDate = new DateTime?(DateTime.Now);
                product_requests.UpdateBy    = new int?(1);
                product_requests.UpdatedDate = new DateTime?(DateTime.Now);
                cls_common_responses product = productManager.CreateProduct("Proc_Item_Save", product_requests);
                int responseCode             = product.ResponseCode;
                response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, product);
            }
            catch (Exception ex)
            {
                clsCommonResponses.ResponseCode    = 400;
                clsCommonResponses.ResponseMessage = "Something went wrong, please try again later.";
                response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses);
            }
            return(response);
        }
Beispiel #10
0
        public cls_common_responses CreateSales(
            string sp_name,
            Sales sales_requests)
        {
            cls_common_responses clsCommonResponses1 = new cls_common_responses();
            cls_common_responses clsCommonResponses2;

            try
            {
                using (CustomERPEntities customErpEntities = new CustomERPEntities())
                {
                    foreach (cls_common_responses clsCommonResponses3 in customErpEntities.Database.SqlQuery <cls_common_responses>(sp_name + " @prmIDNUMBER, @prmCompanyID, @prmPONo, @prmSupplierID, @prmShippingName, @prmShippingAddress, @prmShippingCost, @prmPaymentType,@prmTotalQty, @prmSubTotal, @prmCurrency, @prmDeposite, @prmBBShippment, @prmIncoterms, @prmTotal, @prmCreatedBy", (object)new SqlParameter("@prmIDNUMBER", (object)sales_requests.IDNUMBER), (object)new SqlParameter("@prmCompanyID", (object)sales_requests.CompanyID), (object)new SqlParameter("@prmPONo", (object)sales_requests.SONO), (object)new SqlParameter("@prmSupplierID", (object)sales_requests.CustomerID), (object)new SqlParameter("@prmShippingName", (object)sales_requests.ShippingName), (object)new SqlParameter("@prmShippingAddress", (object)sales_requests.ShippingAddress), (object)new SqlParameter("@prmShippingCost", (object)sales_requests.ShippingCost), (object)new SqlParameter("@prmPaymentType", (object)sales_requests.PaymentType), (object)new SqlParameter("@prmTotalQty", (object)sales_requests.TotalQty), (object)new SqlParameter("@prmSubTotal", (object)sales_requests.SubTotal), (object)new SqlParameter("@prmCurrency", (object)sales_requests.Currency), (object)new SqlParameter("@prmDeposite", (object)sales_requests.Deposite), (object)new SqlParameter("@prmBBShippment", (object)sales_requests.BBShippment), (object)new SqlParameter("@prmIncoterms", (object)sales_requests.Incoterms), (object)new SqlParameter("@prmTotal", (object)sales_requests.Total), (object)new SqlParameter("@prmCreatedBy", (object)sales_requests.CreatedBy)))
                    {
                        if (clsCommonResponses3.ResponseCode == 200)
                        {
                            if (!SalesManager.saveStocks(sales_requests, clsCommonResponses3.ResponseGenID))
                            {
                                clsCommonResponses1.ResponseGenID   = 0;
                                clsCommonResponses1.ResponseCode    = 400;
                                clsCommonResponses1.ResponseMessage = "Something went wrong in Stock Insertion!!";
                            }
                            else
                            {
                                clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                                clsCommonResponses1.ResponseCode    = clsCommonResponses3.ResponseCode;
                                clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                            }
                        }
                        else if (clsCommonResponses3.ResponseCode != 400)
                        {
                            clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                            clsCommonResponses1.ResponseCode    = 400;
                            clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                        }
                        else
                        {
                            clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                            clsCommonResponses1.ResponseCode    = clsCommonResponses3.ResponseCode;
                            clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                        }
                    }
                    clsCommonResponses2 = clsCommonResponses1;
                }
            }
            catch (Exception ex)
            {
                clsCommonResponses1.ResponseGenID   = 0;
                clsCommonResponses1.ResponseCode    = 400;
                clsCommonResponses1.ResponseMessage = "Something went wrong, please try again later.";
                clsCommonResponses2 = clsCommonResponses1;
            }
            return(clsCommonResponses2);
        }
Beispiel #11
0
        public cls_common_responses CreateUser(string sp_name, Users user_requests)
        {
            user_requests.CompanyID = new int?(1);
            cls_common_responses clsCommonResponses1 = new cls_common_responses();

            user_requests.pswd = Cryptography.Encrypt(user_requests.pswd);
            cls_common_responses clsCommonResponses2;

            try
            {
                using (CustomERPEntities customErpEntities = new CustomERPEntities())
                {
                    foreach (cls_common_responses clsCommonResponses3 in customErpEntities.Database.SqlQuery <cls_common_responses>(sp_name + " @prmIDNUMBER, @prmCompanyID, @prmUserType, @prmUserID, @prmUserName, @prmpswd, @prmEmailID, @prmMobileNo, @prmBOD, @prmIsActive, @prmIsSuperUser", (object)new SqlParameter("@prmIDNUMBER", (object)user_requests.IDNUMBER), (object)new SqlParameter("@prmCompanyID", (object)user_requests.CompanyID), (object)new SqlParameter("@prmUserType", (object)user_requests.UserType), (object)new SqlParameter("@prmUserID", (object)user_requests.UserID), (object)new SqlParameter("@prmUserName", (object)user_requests.UserName), (object)new SqlParameter("@prmpswd", (object)user_requests.pswd), (object)new SqlParameter("@prmEmailID", (object)user_requests.EmailID), (object)new SqlParameter("@prmMobileNo", (object)user_requests.MobileNo), (object)new SqlParameter("@prmBOD", (object)user_requests.BOD), (object)new SqlParameter("@prmIsActive", (object)user_requests.IsActive), (object)new SqlParameter("@prmIsSuperUser", (object)user_requests.IsSuperUser)))
                    {
                        if (clsCommonResponses3.ResponseCode == 200)
                        {
                            clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                            clsCommonResponses1.ResponseCode    = clsCommonResponses3.ResponseCode;
                            clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                        }
                        else if (clsCommonResponses3.ResponseCode != 400)
                        {
                            clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                            clsCommonResponses1.ResponseCode    = 400;
                            clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                        }
                        else
                        {
                            clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                            clsCommonResponses1.ResponseCode    = clsCommonResponses3.ResponseCode;
                            clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                        }
                    }
                    clsCommonResponses2 = clsCommonResponses1;
                }
            }
            catch (Exception ex)
            {
                clsCommonResponses1.ResponseGenID   = 0;
                clsCommonResponses1.ResponseCode    = 400;
                clsCommonResponses1.ResponseMessage = "Something went wrong, please try again later.";
                clsCommonResponses2 = clsCommonResponses1;
            }
            return(clsCommonResponses2);
        }
Beispiel #12
0
        public cls_common_responses CreateSuplier(
            string sp_name,
            Supplier supplier_requests)
        {
            cls_common_responses clsCommonResponses1 = new cls_common_responses();
            cls_common_responses clsCommonResponses2;

            try
            {
                using (CustomERPEntities customErpEntities = new CustomERPEntities())
                {
                    foreach (cls_common_responses clsCommonResponses3 in customErpEntities.Database.SqlQuery <cls_common_responses>(sp_name + " @prmIDNUMBER, @prmCompanyID, @prmSupplierName, @prmSupplierAddress, @prmPhoneNo1, @prmPhoneNo2, @prmEmailID,@prmCompanyName, @prmCompAddress, @prmWebsite, @prmCompEmail, @prmDesignation, @prmShippingAddress, @prmContFirstName1, @prmContSurname1, @prmContPosition1, @prmContEmail1, @prmContPhone1, @prmContFirstName2,@prmContSurname2, @prmContPosition2, @prmContEmail2, @prmContPhone2, @prmBankName, @prmBankAddress, @prmIBAN, @prmSWIFT, @prmAccountNumber, @prmNote, @prmIsActive, @prmCreatedBy, @prmCreatedDate, @prmUpdatedBy, @prmUpdatedDate", (object)new SqlParameter("@prmIDNUMBER", (object)supplier_requests.IDNUMBER), (object)new SqlParameter("@prmCompanyID", (object)supplier_requests.CompanyID), (object)new SqlParameter("@prmSupplierName", (object)supplier_requests.SupplierName), (object)new SqlParameter("@prmSupplierAddress", (object)supplier_requests.SupplierAddress), (object)new SqlParameter("@prmPhoneNo1", (object)supplier_requests.PhoneNo1), (object)new SqlParameter("@prmPhoneNo2", (object)supplier_requests.PhoneNo2), (object)new SqlParameter("@prmEmailID", (object)supplier_requests.EmailID), (object)new SqlParameter("@prmCompanyName", (object)supplier_requests.CompanyName), (object)new SqlParameter("@prmCompAddress", (object)supplier_requests.CompAddress), (object)new SqlParameter("@prmWebsite", (object)supplier_requests.Website), (object)new SqlParameter("@prmCompEmail", (object)supplier_requests.CompEmail), (object)new SqlParameter("@prmDesignation", (object)supplier_requests.Designation), (object)new SqlParameter("@prmShippingAddress", (object)supplier_requests.ShippingAddress), (object)new SqlParameter("@prmContFirstName1", (object)supplier_requests.ContFirstName1), (object)new SqlParameter("@prmContSurname1", (object)supplier_requests.ContSurname1), (object)new SqlParameter("@prmContPosition1", (object)supplier_requests.ContPosition1), (object)new SqlParameter("@prmContEmail1", (object)supplier_requests.ContEmail1), (object)new SqlParameter("@prmContPhone1", (object)supplier_requests.ContPhone1), (object)new SqlParameter("@prmContFirstName2", (object)supplier_requests.ContFirstName2), (object)new SqlParameter("@prmContSurname2", (object)supplier_requests.ContSurname2), (object)new SqlParameter("@prmContPosition2", (object)supplier_requests.ContPosition2), (object)new SqlParameter("@prmContEmail2", (object)supplier_requests.ContEmail2), (object)new SqlParameter("@prmContPhone2", (object)supplier_requests.ContPhone2), (object)new SqlParameter("@prmBankName", (object)supplier_requests.BankName), (object)new SqlParameter("@prmBankAddress", (object)supplier_requests.BankAddress), (object)new SqlParameter("@prmIBAN", (object)supplier_requests.IBAN), (object)new SqlParameter("@prmSWIFT", (object)supplier_requests.SWIFT), (object)new SqlParameter("@prmAccountNumber", (object)supplier_requests.AccountNumber), (object)new SqlParameter("@prmNote", (object)supplier_requests.Note), (object)new SqlParameter("@prmIsActive", (object)supplier_requests.IsActive), (object)new SqlParameter("@prmCreatedBy", (object)supplier_requests.CreatedBy), (object)new SqlParameter("@prmCreatedDate", (object)supplier_requests.CreatedDate), (object)new SqlParameter("@prmUpdatedBy", (object)supplier_requests.UpdatedBy), (object)new SqlParameter("@prmUpdatedDate", (object)supplier_requests.UpdatedDate)))
                    {
                        if (clsCommonResponses3.ResponseCode == 200)
                        {
                            clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                            clsCommonResponses1.ResponseCode    = clsCommonResponses3.ResponseCode;
                            clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                        }
                        else if (clsCommonResponses3.ResponseCode != 400)
                        {
                            clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                            clsCommonResponses1.ResponseCode    = 400;
                            clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                        }
                        else
                        {
                            clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                            clsCommonResponses1.ResponseCode    = clsCommonResponses3.ResponseCode;
                            clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                        }
                    }
                    clsCommonResponses2 = clsCommonResponses1;
                }
            }
            catch (Exception ex)
            {
                clsCommonResponses1.ResponseGenID   = 0;
                clsCommonResponses1.ResponseCode    = 400;
                clsCommonResponses1.ResponseMessage = "Something went wrong, please try again later.";
                clsCommonResponses2 = clsCommonResponses1;
            }
            return(clsCommonResponses2);
        }
Beispiel #13
0
        public cls_common_responses CreateExpenses(
            string sp_name,
            Expenses expenses_requests)
        {
            cls_common_responses clsCommonResponses1 = new cls_common_responses();
            cls_common_responses clsCommonResponses2;

            try
            {
                using (CustomERPEntities customErpEntities = new CustomERPEntities())
                {
                    foreach (cls_common_responses clsCommonResponses3 in customErpEntities.Database.SqlQuery <cls_common_responses>(sp_name + " @prmIDNUMBER, @prmCompanyID, @prmExpenseName, @prmPaidBy, @prmWallet, @prmItem, @prmItemID, @prmItemVarientID, @prmCurrency, @prmCost, @prmUSDCost, @prmNote, @prmIsActive, @prmCreatedBy", (object)new SqlParameter("prmIDNUMBER", (object)expenses_requests.IDNUMBER), (object)new SqlParameter("prmCompanyID", (object)expenses_requests.CompanyID), (object)new SqlParameter("@prmExpenseName", (object)expenses_requests.ExpenseName), (object)new SqlParameter("@prmPaidBy", (object)expenses_requests.PaidBy), (object)new SqlParameter("@prmWallet", (object)expenses_requests.Wallet), (object)new SqlParameter("@prmItem", (object)expenses_requests.Item), (object)new SqlParameter("@prmItemID", (object)expenses_requests.ItemID), (object)new SqlParameter("@prmItemVarientID", (object)expenses_requests.ItemVarientID), (object)new SqlParameter("@prmCurrency", (object)expenses_requests.Currency), (object)new SqlParameter("@prmCost", (object)expenses_requests.Cost), (object)new SqlParameter("@prmUSDCost", (object)expenses_requests.USDCost), (object)new SqlParameter("@prmNote", (object)expenses_requests.Note), (object)new SqlParameter("@prmIsActive", (object)expenses_requests.IsActive), (object)new SqlParameter("@prmCreatedBy", (object)expenses_requests.CreatedBy)))
                    {
                        if (clsCommonResponses3.ResponseCode == 200)
                        {
                            clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                            clsCommonResponses1.ResponseCode    = clsCommonResponses3.ResponseCode;
                            clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                        }
                        else if (clsCommonResponses3.ResponseCode != 400)
                        {
                            clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                            clsCommonResponses1.ResponseCode    = 400;
                            clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                        }
                        else
                        {
                            clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                            clsCommonResponses1.ResponseCode    = clsCommonResponses3.ResponseCode;
                            clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                        }
                    }
                    clsCommonResponses2 = clsCommonResponses1;
                }
            }
            catch (Exception ex)
            {
                clsCommonResponses1.ResponseGenID   = 0;
                clsCommonResponses1.ResponseCode    = 400;
                clsCommonResponses1.ResponseMessage = "Something went wrong, please try again later.";
                clsCommonResponses2 = clsCommonResponses1;
            }
            return(clsCommonResponses2);
        }
        public cls_common_responses CreateEmployee(
            string sp_name,
            Employee employee_requests)
        {
            cls_common_responses clsCommonResponses1 = new cls_common_responses();
            cls_common_responses clsCommonResponses2;

            try
            {
                using (CustomERPEntities customErpEntities = new CustomERPEntities())
                {
                    foreach (cls_common_responses clsCommonResponses3 in customErpEntities.Database.SqlQuery <cls_common_responses>(sp_name + " @prmIDNUMBER, @prmCompanyID, @prmEmpFirstName, @prmEmpSurName, @prmEmployeeAddress, @prmPhoneNo, @prmEmailID, @prmPosition,@prmEmploymentStart, @prmEmployeeEnd, @prmNotes, @prmIsEmployeement, @prmIsActive, @prmCreatedBy, @prmCreatedDate, @prmUpdatedBy, @prmUpdatedDate", (object)new SqlParameter("@prmIDNUMBER", (object)employee_requests.IDNUMBER), (object)new SqlParameter("@prmCompanyID", (object)employee_requests.CompanyID), (object)new SqlParameter("@prmEmpFirstName", (object)employee_requests.EmpFirstName), (object)new SqlParameter("@prmEmpSurName", (object)employee_requests.EmpSurName), (object)new SqlParameter("@prmEmployeeAddress", (object)employee_requests.EmployeeAddress), (object)new SqlParameter("@prmPhoneNo", (object)employee_requests.PhoneNo), (object)new SqlParameter("@prmEmailID", (object)employee_requests.EmailID), (object)new SqlParameter("@prmPosition", (object)employee_requests.Position), (object)new SqlParameter("@prmEmploymentStart", (object)employee_requests.EmploymentStart), (object)new SqlParameter("@prmEmployeeEnd", (object)employee_requests.EmployeeEnd), (object)new SqlParameter("@prmNotes", (object)employee_requests.Notes), (object)new SqlParameter("@prmIsEmployeement", (object)employee_requests.IsEmployeement), (object)new SqlParameter("@prmIsActive", (object)employee_requests.IsActive), (object)new SqlParameter("@prmCreatedBy", (object)employee_requests.CreatedBy), (object)new SqlParameter("@prmCreatedDate", (object)employee_requests.CreatedDate), (object)new SqlParameter("@prmUpdatedBy", (object)employee_requests.UpdatedBy), (object)new SqlParameter("@prmUpdatedDate", (object)employee_requests.UpdatedDate)))
                    {
                        if (clsCommonResponses3.ResponseCode == 200)
                        {
                            clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                            clsCommonResponses1.ResponseCode    = clsCommonResponses3.ResponseCode;
                            clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                        }
                        else if (clsCommonResponses3.ResponseCode != 400)
                        {
                            clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                            clsCommonResponses1.ResponseCode    = 400;
                            clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                        }
                        else
                        {
                            clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                            clsCommonResponses1.ResponseCode    = clsCommonResponses3.ResponseCode;
                            clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                        }
                    }
                    clsCommonResponses2 = clsCommonResponses1;
                }
            }
            catch (Exception ex)
            {
                clsCommonResponses1.ResponseGenID   = 0;
                clsCommonResponses1.ResponseCode    = 400;
                clsCommonResponses1.ResponseMessage = "Something went wrong, please try again later.";
                clsCommonResponses2 = clsCommonResponses1;
            }
            return(clsCommonResponses2);
        }
        public cls_common_responses Createwarehouse(
            string sp_name,
            Warehouse warehouse_requests)
        {
            cls_common_responses clsCommonResponses1 = new cls_common_responses();
            cls_common_responses clsCommonResponses2;

            try
            {
                using (CustomERPEntities customErpEntities = new CustomERPEntities())
                {
                    foreach (cls_common_responses clsCommonResponses3 in customErpEntities.Database.SqlQuery <cls_common_responses>(sp_name + " @prmIDNUMBER, @prmCompanyID, @prmWarehouseName, @prmAddress, @prmIsActive, @prmCreatedDate, @prmCreatedBy, @prmUpdateDate, @prmUpdatedBy", (object)new SqlParameter("@prmIDNUMBER", (object)warehouse_requests.IDNUMBER), (object)new SqlParameter("@prmCompanyID", (object)warehouse_requests.CompanyID), (object)new SqlParameter("@prmWarehouseName", (object)warehouse_requests.WarehouseName), (object)new SqlParameter("@prmAddress", (object)warehouse_requests.Address), (object)new SqlParameter("@prmIsActive", (object)warehouse_requests.IsActive), (object)new SqlParameter("@prmCreatedDate", (object)warehouse_requests.CreatedDate), (object)new SqlParameter("@prmCreatedBy", (object)warehouse_requests.CreatedBy), (object)new SqlParameter("@prmUpdateDate", (object)warehouse_requests.UpdatedDate), (object)new SqlParameter("@prmUpdatedBy", (object)warehouse_requests.UpdatedBy)))
                    {
                        if (clsCommonResponses3.ResponseCode == 200)
                        {
                            clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                            clsCommonResponses1.ResponseCode    = clsCommonResponses3.ResponseCode;
                            clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                        }
                        else if (clsCommonResponses3.ResponseCode != 400)
                        {
                            clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                            clsCommonResponses1.ResponseCode    = 400;
                            clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                        }
                        else
                        {
                            clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                            clsCommonResponses1.ResponseCode    = clsCommonResponses3.ResponseCode;
                            clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                        }
                    }
                    clsCommonResponses2 = clsCommonResponses1;
                }
            }
            catch (Exception ex)
            {
                clsCommonResponses1.ResponseGenID   = 0;
                clsCommonResponses1.ResponseCode    = 400;
                clsCommonResponses1.ResponseMessage = "Something went wrong, please try again later.";
                clsCommonResponses2 = clsCommonResponses1;
            }
            return(clsCommonResponses2);
        }
Beispiel #16
0
        public HttpResponseMessage DeleteEmployee(int EmployeeID)
        {
            EmployeeManager      employeeManager     = new EmployeeManager();
            cls_common_responses clsCommonResponses1 = new cls_common_responses();
            HttpResponseMessage  response;

            try
            {
                cls_common_responses clsCommonResponses2 = employeeManager.DeleteEmployee(EmployeeID);
                int responseCode = clsCommonResponses2.ResponseCode;
                response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses2);
            }
            catch (Exception ex)
            {
                clsCommonResponses1.ResponseCode    = 400;
                clsCommonResponses1.ResponseMessage = "Something went wrong, please try again later.";
                response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses1);
            }
            return(response);
        }
Beispiel #17
0
        public HttpResponseMessage UserLogin(cls_login_requests login_requests)
        {
            AccountManager       accountManager     = new AccountManager();
            cls_common_responses clsCommonResponses = new cls_common_responses();

            if (login_requests == null)
            {
                clsCommonResponses.ResponseCode    = 400;
                clsCommonResponses.ResponseMessage = "Please enter login credentials";
                return(this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses));
            }
            if (string.IsNullOrEmpty(login_requests.Email))
            {
                clsCommonResponses.ResponseCode    = 400;
                clsCommonResponses.ResponseMessage = "User ID is required";
                return(this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses));
            }
            if (string.IsNullOrEmpty(login_requests.Password))
            {
                clsCommonResponses.ResponseCode    = 400;
                clsCommonResponses.ResponseMessage = "Password is required";
                return(this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses));
            }
            HttpResponseMessage response;

            try
            {
                cls_login_responses clsLoginResponses = accountManager.LogIn("Proc_UserLogin", login_requests);
                int responseCode = clsLoginResponses.ResponseCode;
                response = this.Request.CreateResponse <cls_login_responses>(HttpStatusCode.OK, clsLoginResponses);
            }
            catch (Exception ex)
            {
                clsCommonResponses.ResponseCode    = 400;
                clsCommonResponses.ResponseMessage = "Something went wrong, please try again later.";
                response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses);
            }
            return(response);
        }
        public cls_common_responses CreateProduct(
            string sp_name,
            Item product_requests)
        {
            cls_common_responses clsCommonResponses1 = new cls_common_responses();
            cls_common_responses clsCommonResponses2;

            try
            {
                if (product_requests.IsImage == 1)
                {
                    string str = ProductManager.SaveBranchFile(product_requests.ItemImage, "Item", product_requests.ItemName);
                    product_requests.ItemImage = !(str != "error") ? "../dist/img/user-image.png" : str;
                }
                else if (product_requests.IDNUMBER == 0)
                {
                    product_requests.ItemImage = "../dist/img/user-image.png";
                }
                using (CustomERPEntities customErpEntities = new CustomERPEntities())
                {
                    foreach (cls_common_responses clsCommonResponses3 in customErpEntities.Database.SqlQuery <cls_common_responses>(sp_name + " @prmIDNUMBER, @prmCompanyID, @prmItemName, @prmItemImage, @prmCategoryID, @prmDescription, @prmcmLength, @prmcmHeight,@prmcmWidth, @prminchLength, @prminchHeight, @prminchWidth, @prmkgWeight, @prmlbsWeight, @prmNote, @prmIsActive, @prmCreatedBy, @prmUpdateBy", (object)new SqlParameter("@prmIDNUMBER", (object)product_requests.IDNUMBER), (object)new SqlParameter("@prmCompanyID", (object)product_requests.CompanyID), (object)new SqlParameter("@prmItemName", (object)product_requests.ItemName), (object)new SqlParameter("@prmItemImage", (object)product_requests.ItemImage), (object)new SqlParameter("@prmCategoryID", (object)product_requests.CategoryID), (object)new SqlParameter("@prmDescription", (object)product_requests.Description), (object)new SqlParameter("@prmcmLength", (object)product_requests.cmLength), (object)new SqlParameter("@prmcmHeight", (object)product_requests.cmHeight), (object)new SqlParameter("@prmcmWidth", (object)product_requests.cmWidth), (object)new SqlParameter("@prminchLength", (object)product_requests.inchLength), (object)new SqlParameter("@prminchHeight", (object)product_requests.inchHeight), (object)new SqlParameter("@prminchWidth", (object)product_requests.inchWidth), (object)new SqlParameter("@prmkgWeight", (object)product_requests.kgWeight), (object)new SqlParameter("@prmlbsWeight", (object)product_requests.lbsWeight), (object)new SqlParameter("@prmNote", (object)product_requests.Note), (object)new SqlParameter("@prmIsActive", (object)product_requests.IsActive), (object)new SqlParameter("@prmCreatedBy", (object)product_requests.CreatedBy), (object)new SqlParameter("@prmUpdateBy", (object)product_requests.UpdateBy)))
                    {
                        if (clsCommonResponses3.ResponseCode == 200)
                        {
                            if (!ProductManager.saveStocks(product_requests, clsCommonResponses3.ResponseGenID))
                            {
                                clsCommonResponses1.ResponseGenID   = 0;
                                clsCommonResponses1.ResponseCode    = 400;
                                clsCommonResponses1.ResponseMessage = "Something went wrong in Stock Insertion!!";
                            }
                            else
                            {
                                clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                                clsCommonResponses1.ResponseCode    = clsCommonResponses3.ResponseCode;
                                clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                            }
                        }
                        else if (clsCommonResponses3.ResponseCode != 400)
                        {
                            clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                            clsCommonResponses1.ResponseCode    = 400;
                            clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                        }
                        else
                        {
                            clsCommonResponses1.ResponseGenID   = clsCommonResponses3.ResponseGenID;
                            clsCommonResponses1.ResponseCode    = clsCommonResponses3.ResponseCode;
                            clsCommonResponses1.ResponseMessage = clsCommonResponses3.ResponseMessage;
                        }
                    }
                    clsCommonResponses2 = clsCommonResponses1;
                }
            }
            catch (Exception ex)
            {
                clsCommonResponses1.ResponseGenID   = 0;
                clsCommonResponses1.ResponseCode    = 400;
                clsCommonResponses1.ResponseMessage = "Something went wrong, please try again later.";
                clsCommonResponses2 = clsCommonResponses1;
            }
            return(clsCommonResponses2);
        }