Exemplo n.º 1
0
        public Suppliers GetSupplierById(int supplierId)
        {
            List <Suppliers> supplierList = new List <Suppliers>();

            // List<IBSparameter> parameters = new List<IBSparameter>();

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "@UserAccount";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = LoggedInUser;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);



                    IBSparameter SupplierIdParameter = new IBSparameter();
                    SupplierIdParameter.ParameterName = "@SupplierId";
                    SupplierIdParameter.DataType      = DbType.Int32;
                    SupplierIdParameter.Value         = supplierId;
                    SupplierIdParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(SupplierIdParameter);
                }

                DataSet dsSupplier = null;
                dsSupplier = GetDataSet("ERP_Get_SupplierById", parameters);

                var SupplierCollection = from Suppliers in dsSupplier.Tables[0].AsEnumerable()
                                         select new Suppliers
                {
                    SupplierId   = Suppliers.Field <int>("SupplierId"),
                    SupplierCode = Suppliers.Field <String>("SupplierCode"),
                    SupplierName = Suppliers.Field <String>("SupplierName"),
                    Address      = Suppliers.Field <String>("Address"),
                    City         = Suppliers.Field <String>("City"),
                    ContactEmail = Suppliers.Field <String>("ContactEmail"),
                    ContactName  = Suppliers.Field <String>("ContactName"),
                    ContactTitle = Suppliers.Field <String>("ContactTitle"),
                    Country      = Suppliers.Field <String>("Country"),
                    Phone1       = Suppliers.Field <String>("Phone1"),
                    Phone2       = Suppliers.Field <String>("Phone2"),
                    PostalCode   = Suppliers.Field <String>("PostalCode"),
                    Website      = Suppliers.Field <String>("Website"),
                    Fax          = Suppliers.Field <String>("Fax")
                };
                supplierList = SupplierCollection.ToList <Suppliers>();
            }

            catch (Exception ex)
            {
                Logger.Error("Supplier.GetSupplierById(" + LoggedInUser + "," + CompanyCode + "," + supplierId + ")", ex);
            }

            return(supplierList[0]);
        }
Exemplo n.º 2
0
        public ReturnResult DeleteSupplier(int supplierid)
        {
            //Category objCategory = new Category();
            ReturnResult returnResult = new ReturnResult();

            try
            {
                //int b=1, a=0;
                //int c = b / a;
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "@UserAccount";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = LoggedInUser;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);



                    IBSparameter CatergoryIdParameter = new IBSparameter();
                    CatergoryIdParameter.ParameterName = "@SupplierId";
                    CatergoryIdParameter.DataType      = DbType.Int32;
                    CatergoryIdParameter.Value         = supplierid;
                    CatergoryIdParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(CatergoryIdParameter);

                    IBSparameter ReturnParameter = new IBSparameter();
                    ReturnParameter.ParameterName = "@ReturnValue";
                    ReturnParameter.DataType      = DbType.Int32;
                    ReturnParameter.Value         = "";
                    ReturnParameter.Direction     = ParameterDirection.Output;
                    parameters.Add(ReturnParameter);
                }
                return(ExecuteSqlNonQuery("ERP_Delete_Supplier", parameters));
                //if (count > 0)
                //{
                //    returnResult.ID = count;
                //    returnResult.IsSuccess = true;
                //    returnResult.Message = "Category removed successfully.";
                //}
                ////DbCommand command = database.GetStoredProcCommand("ERP_Delete_Category"); // SP name

                ////database.AddInParameter(command, "@CategoryId", DbType.Int32, categoryid);
                ////database.AddInParameter(command, "@LoginUser", DbType.String, loginUser);

                ////database.ExecuteNonQuery(command);
            }

            catch (Exception ex)
            {
                Logger.Error("SupplierDAL.DeleteSupplier(" + LoggedInUser + "," + CompanyCode + "," + supplierid + ")", ex);
            }
            return(returnResult);
        }
Exemplo n.º 3
0
        public Stores GetStoreById(int StoreID)
        {
            List <Stores> storeList = new List <Stores>();

            // List<IBSparameter> parameters = new List<IBSparameter>();

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "@UserAccount";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = LoggedInUser;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);



                    IBSparameter StoreIdParameter = new IBSparameter();
                    StoreIdParameter.ParameterName = "@StoreID";
                    StoreIdParameter.DataType      = DbType.String;
                    StoreIdParameter.Value         = StoreID;
                    StoreIdParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(StoreIdParameter);
                }

                DataSet dsStore = null;
                dsStore = GetDataSet("ERP_Get_StoreByID", parameters);

                var StoreCollection = from Stores in dsStore.Tables[0].AsEnumerable()
                                      select new Stores
                {
                    StoreId   = Stores.Field <int>("StoreId"),
                    StoreName = Stores.Field <String>("StoreName"),
                    Address   = Stores.Field <String>("Address"),

                    City  = Stores.Field <String>("City"),
                    Email = Stores.Field <String>("Email"),
                };
                storeList = StoreCollection.ToList <Stores>();
            }

            catch (Exception ex)
            {
                //Logger.Error("CategoriesDAL.GetCategoryById(" + LoggedInUser + "," + CompanyCode + "," + categoryId + ")", ex);
            }

            return(storeList[0]);
        }
Exemplo n.º 4
0
        public CompanyMaster GetCompanyById(int CompanyID)
        {
            List <CompanyMaster> companyList = new List <CompanyMaster>();

            // List<IBSparameter> parameters = new List<IBSparameter>();

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "@UserAccount";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = LoggedInUser;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);



                    IBSparameter CompanyIdParameter = new IBSparameter();
                    CompanyIdParameter.ParameterName = "@CompanyID";
                    CompanyIdParameter.DataType      = DbType.String;
                    CompanyIdParameter.Value         = CompanyID;
                    CompanyIdParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(CompanyIdParameter);
                }

                DataSet dsCategory = null;
                dsCategory = GetDataSet("ERP_Get_CompanyByID", parameters);

                var CompanyCollection = from CompanyMaster in dsCategory.Tables[0].AsEnumerable()
                                        select new CompanyMaster
                {
                    CompanyId      = CompanyMaster.Field <int>("CompanyID"),
                    CompanyCode    = CompanyMaster.Field <String>("CompanyCode"),
                    CompanyName    = CompanyMaster.Field <String>("CompanyName"),
                    RegistrationNo = CompanyMaster.Field <String>("RegistrationNo"),
                    City           = CompanyMaster.Field <String>("City"),
                    Address        = CompanyMaster.Field <String>("Address"),
                };
                companyList = CompanyCollection.ToList <CompanyMaster>();
            }

            catch (Exception ex)
            {
                //Logger.Error("CategoriesDAL.GetCategoryById(" + LoggedInUser + "," + CompanyCode + "," + categoryId + ")", ex);
            }

            return(companyList[0]);
        }
Exemplo n.º 5
0
        public EmployeeMaster GetEmployeeById(int employeeID)
        {
            List <EmployeeMaster> EmployeeList = new List <EmployeeMaster>();

            // List<IBSparameter> parameters = new List<IBSparameter>();

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "@UserAccount";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = LoggedInUser;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);

                    IBSparameter EmployeeIDParameter = new IBSparameter();
                    EmployeeIDParameter.ParameterName = "@EmployeeID";
                    EmployeeIDParameter.DataType      = DbType.String;
                    EmployeeIDParameter.Value         = employeeID;
                    EmployeeIDParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(EmployeeIDParameter);
                }

                DataSet dsEmployee = null;
                dsEmployee = GetDataSet("ERP_Get_CompanyByID", parameters);

                var CompanyCollection = from EmployeeMaster in dsEmployee.Tables[0].AsEnumerable()
                                        select new EmployeeMaster
                {
                    EmployeeId = EmployeeMaster.Field <int>("EmployeeID"),
                    LastName   = EmployeeMaster.Field <String>("LastName"),
                    FirstName  = EmployeeMaster.Field <String>("FirstName"),
                    Region     = EmployeeMaster.Field <String>("Region"),
                    City       = EmployeeMaster.Field <String>("City"),
                    Address    = EmployeeMaster.Field <String>("Address"),
                    PostalCode = EmployeeMaster.Field <String>("PostalCode"),
                };
                EmployeeList = CompanyCollection.ToList <EmployeeMaster>();
            }

            catch (Exception ex)
            {
                //Logger.Error("CategoriesDAL.GetCategoryById(" + LoggedInUser + "," + CompanyCode + "," + categoryId + ")", ex);
            }

            return(EmployeeList[0]);
        }
Exemplo n.º 6
0
        public List <Suppliers> GetSuppliersList()
        {
            List <Suppliers> objSuppliersList = new List <Suppliers>();

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "@UserAccount";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = LoggedInUser;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);
                }

                DataSet dsSuppliers = null;
                dsSuppliers = GetDataSet("ERP_Get_SuppliersList", parameters);

                var supplierCollection = from Suppliers in dsSuppliers.Tables[0].AsEnumerable()
                                         select new Suppliers
                {
                    SupplierId   = Suppliers.Field <int>("SupplierId"),
                    SupplierCode = Suppliers.Field <String>("SupplierCode"),
                    SupplierName = Suppliers.Field <String>("SupplierName"),
                    Address      = Suppliers.Field <String>("Address"),
                    City         = Suppliers.Field <String>("City"),
                    ContactEmail = Suppliers.Field <String>("ContactEmail"),
                    ContactName  = Suppliers.Field <String>("ContactName"),
                    ContactTitle = Suppliers.Field <String>("ContactTitle"),
                    Country      = Suppliers.Field <String>("Country"),
                    Phone1       = Suppliers.Field <String>("Phone1"),
                    Phone2       = Suppliers.Field <String>("Phone2"),
                    PostalCode   = Suppliers.Field <String>("PostalCode"),
                    Website      = Suppliers.Field <String>("Website"),
                    Fax          = Suppliers.Field <String>("Fax")
                                   //LockStatus = Suppliers.Field<String>("LockStatus"),
                };
                objSuppliersList = supplierCollection.ToList <Suppliers>();
            }

            catch (Exception ex)
            {
                Logger.Error("SuppliersDAL.GetSuppliersList(" + LoggedInUser + "," + CompanyCode + ")", ex);
            }

            return(objSuppliersList);
        }
Exemplo n.º 7
0
        public List <Category> GetCategories()
        {
            List <Category> objCategories = new List <Category>();

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "@UserAccount";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = LoggedInUser;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);
                }
                else if (DBProvider == ProviderName.MySqlClient)
                {
                    IBSparameter userParameter = new IBSparameter();
                    userParameter.ParameterName = "p_UserAccount";
                    userParameter.DataType      = DbType.String;
                    userParameter.Value         = LoggedInUser;
                    userParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(userParameter);
                }

                DataSet dsCategory = null;
                dsCategory = GetDataSet("ERP_Get_Categories", parameters);

                var menuCollection = from Category in dsCategory.Tables[0].AsEnumerable()
                                     select new Category
                {
                    categoryid   = Category.Field <int>("categoryid"),
                    CategoryCode = Category.Field <String>("CategoryCode"),
                    CategoryName = Category.Field <String>("CategoryName"),
                    Description  = Category.Field <String>("Description"),
                };
                objCategories = menuCollection.ToList <Category>();
            }

            catch (Exception ex)
            {
                Logger.Error("CategoriesDAL.objCategories(" + LoggedInUser + "," + CompanyCode + ")", ex);
            }

            return(objCategories);
        }
Exemplo n.º 8
0
        public List <ProductMaster> GetProductList()
        {
            List <ProductMaster> objProductList = new List <ProductMaster>();

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "@UserAccount";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = LoggedInUser;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);
                }

                DataSet dsProduct = null;
                dsProduct = GetDataSet("ERP_Get_ProductList", parameters);

                var ProductCollection = from ProductMaster in dsProduct.Tables[0].AsEnumerable()
                                        select new ProductMaster
                {
                    ProductId         = ProductMaster.Field <int>("ProductId"),
                    ProductCode       = ProductMaster.Field <String>("ProductCode"),
                    ProductName       = ProductMaster.Field <String>("ProductName"),
                    BarCode           = ProductMaster.Field <String>("BarCode"),
                    SupplierName      = ProductMaster.Field <String>("SupplierName"),
                    CategoryName      = ProductMaster.Field <String>("CategoryName"),
                    CompanyPrice      = ProductMaster.Field <decimal>("CompanyPrice"),
                    RePOorderLevel    = ProductMaster.Field <int>("RePOorderLevel"),
                    RePOorderQuantity = ProductMaster.Field <int>("RePOorderQuantity"),
                    UOM               = ProductMaster.Field <String>("UOM"),
                    ReSOorderLevel    = ProductMaster.Field <int>("ReSOorderLevel"),
                    ReSOorderQuantity = ProductMaster.Field <int>("ReSOorderQuantity")
                };
                objProductList = ProductCollection.ToList <ProductMaster>();
            }

            catch (Exception ex)
            {
                Logger.Error("ProductDAL.GetProductList(" + LoggedInUser + "," + CompanyCode + ")", ex);
            }

            return(objProductList);
        }
Exemplo n.º 9
0
        public List <EmployeeMaster> BindEMPCode_Autocomplete(EmployeeMaster objEmployee)
        {
            List <EmployeeMaster> EmployeeList = new List <EmployeeMaster>();

            // List<IBSparameter> parameters = new List<IBSparameter>();

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "@UserAccount";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = LoggedInUser;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);

                    IBSparameter EmployeeIDParameter = new IBSparameter();
                    EmployeeIDParameter.ParameterName = "@EMPCode";
                    EmployeeIDParameter.DataType      = DbType.String;
                    EmployeeIDParameter.Value         = objEmployee.EmpCode;
                    EmployeeIDParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(EmployeeIDParameter);
                }

                DataSet dsEmployee = null;
                dsEmployee = GetDataSet("ERP_AutoComplete_BindEMPCode", parameters);

                var CompanyCollection = from EmployeeMaster in dsEmployee.Tables[0].AsEnumerable()
                                        select new EmployeeMaster
                {
                    EmpCode = EmployeeMaster.Field <string>("EmpCode"),
                };
                EmployeeList = CompanyCollection.ToList <EmployeeMaster>();
            }

            catch (Exception ex)
            {
                //Logger.Error("CategoriesDAL.GetCategoryById(" + LoggedInUser + "," + CompanyCode + "," + categoryId + ")", ex);
            }

            return(EmployeeList);
        }
Exemplo n.º 10
0
        public ReturnResult DeleteEmployee(int employeeID)
        {
            ReturnResult returnResult = new ReturnResult();

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "@UserAccount";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = LoggedInUser;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);



                    IBSparameter CompanyIdParameter = new IBSparameter();
                    CompanyIdParameter.ParameterName = "@EmployeeID";
                    CompanyIdParameter.DataType      = DbType.String;
                    CompanyIdParameter.Value         = employeeID;
                    CompanyIdParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(CompanyIdParameter);

                    IBSparameter Flag = new IBSparameter();
                    Flag.ParameterName = "@Flag";
                    Flag.DataType      = DbType.String;
                    Flag.Value         = "D";
                    Flag.Direction     = ParameterDirection.Input;
                    parameters.Add(Flag);
                }
                return(ExecuteSqlNonQuery("ERP_Save_Company", parameters));
            }

            catch (Exception ex)
            {
                // Logger.Error("CategoriesDAL.DeleteCategory(" + LoggedInUser + "," + CompanyCode + "," + categoryid + ")", ex);
            }
            return(returnResult);
        }
Exemplo n.º 11
0
        public List <Lookup> GetLookupList(string lookupType)
        {
            List <Lookup> objLookupList = new List <Lookup>();

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "@LookupType";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = lookupType;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);
                }
                else if (DBProvider == ProviderName.MySqlClient)
                {
                }

                DataSet dsLookup = null;
                dsLookup = GetDataSet("ERP_Get_LookUpData", parameters);

                var menuCollection = from Lookup in dsLookup.Tables[0].AsEnumerable()
                                     select new Lookup
                {
                    //LookupId = Lookup.Field<int>("Lookupid"),
                    Code = Lookup.Field <String>("Code"),
                    Text = Lookup.Field <String>("Text"),
                };
                objLookupList = menuCollection.ToList <Lookup>();
            }

            catch (Exception ex)
            {
                Logger.Error("CommonDAL.GetLookupList(" + LoggedInUser + "," + CompanyCode + ")", ex);
            }

            return(objLookupList);
        }
Exemplo n.º 12
0
        public List <Stores> GetStores()
        {
            List <Stores> objStores = new List <Stores>();

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "@UserAccount";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = LoggedInUser;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);
                }

                DataSet dsStores = null;
                dsStores = GetDataSet("ERP_Get_Stores", parameters);

                var MenuCollection = from Stores in dsStores.Tables[0].AsEnumerable()
                                     select new Stores
                {
                    StoreId   = Stores.Field <int>("StoreID"),
                    StoreName = Stores.Field <String>("StoreName"),
                    Address   = Stores.Field <String>("Address"),
                    City      = Stores.Field <String>("City"),
                    Phone1    = Stores.Field <String>("Phone1"),
                    Email     = Stores.Field <String>("Email"),
                };
                objStores = MenuCollection.ToList <Stores>();
            }

            catch (Exception ex)
            {
                //Logger.Error("CategoriesDAL.objCategories(" + LoggedInUser + "," + CompanyCode + ")", ex);
            }

            return(objStores);
        }
Exemplo n.º 13
0
        public List <CompanyMaster> GetCompanies()
        {
            List <CompanyMaster> objCompanies = new List <CompanyMaster>();

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "@UserAccount";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = LoggedInUser;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);
                }

                DataSet dsCategory = null;
                dsCategory = GetDataSet("ERP_Get_Companies", parameters);

                var MenuCollection = from CompanyMaster in dsCategory.Tables[0].AsEnumerable()
                                     select new CompanyMaster
                {
                    CompanyId      = CompanyMaster.Field <int>("CompanyID"),
                    CompanyCode    = CompanyMaster.Field <String>("CompanyCode"),
                    CompanyName    = CompanyMaster.Field <String>("CompanyName"),
                    RegistrationNo = CompanyMaster.Field <String>("RegistrationNo"),
                };
                objCompanies = MenuCollection.ToList <CompanyMaster>();
            }

            catch (Exception ex)
            {
                Logger.Error("CategoriesDAL.objCategories(" + LoggedInUser + "," + CompanyCode + ")", ex);
            }

            return(objCompanies);
        }
Exemplo n.º 14
0
        public ReturnResult SaveEmployee(EmployeeMaster employee)
        {
            EmployeeMaster objEmployee  = new EmployeeMaster();
            ReturnResult   returnResult = new ReturnResult();

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter EmployeeIDParameter = new IBSparameter();
                    EmployeeIDParameter.ParameterName = "@EmployeeID";
                    EmployeeIDParameter.DataType      = DbType.String;
                    EmployeeIDParameter.Value         = employee.EmployeeId;
                    EmployeeIDParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(EmployeeIDParameter);


                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "@UserAccount";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = LoggedInUser;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);

                    IBSparameter EmpCodeParameter = new IBSparameter();
                    EmpCodeParameter.ParameterName = "@EmpCode";
                    EmpCodeParameter.DataType      = DbType.String;
                    EmpCodeParameter.Value         = employee.EmpCode;
                    EmpCodeParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(EmpCodeParameter);

                    IBSparameter FirstNameParameter = new IBSparameter();
                    FirstNameParameter.ParameterName = "@FirstName";
                    FirstNameParameter.DataType      = DbType.String;
                    FirstNameParameter.Value         = employee.FirstName;
                    FirstNameParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(FirstNameParameter);


                    IBSparameter LastNameParameter = new IBSparameter();
                    LastNameParameter.ParameterName = "@LastName";
                    LastNameParameter.DataType      = DbType.String;
                    LastNameParameter.Value         = employee.LastName;
                    LastNameParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(LastNameParameter);

                    IBSparameter CompanyAddressParameter = new IBSparameter();
                    CompanyAddressParameter.ParameterName = "@Address";
                    CompanyAddressParameter.DataType      = DbType.String;
                    CompanyAddressParameter.Value         = employee.Address;
                    CompanyAddressParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(CompanyAddressParameter);

                    IBSparameter EmployeeCityParameter = new IBSparameter();
                    EmployeeCityParameter.ParameterName = "@City";
                    EmployeeCityParameter.DataType      = DbType.String;
                    EmployeeCityParameter.Value         = employee.City;
                    EmployeeCityParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(EmployeeCityParameter);



                    IBSparameter TitleParameter = new IBSparameter();
                    TitleParameter.ParameterName = "@Title";
                    TitleParameter.DataType      = DbType.String;
                    TitleParameter.Value         = employee.City;
                    TitleParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(TitleParameter);

                    IBSparameter RegionParameter = new IBSparameter();
                    RegionParameter.ParameterName = "@Region";
                    RegionParameter.DataType      = DbType.String;
                    RegionParameter.Value         = employee.Region;
                    RegionParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(RegionParameter);


                    IBSparameter PostalCode_Parameter = new IBSparameter();
                    PostalCode_Parameter.ParameterName = "@PostalCode";
                    PostalCode_Parameter.DataType      = DbType.String;
                    PostalCode_Parameter.Value         = employee.PostalCode;
                    PostalCode_Parameter.Direction     = ParameterDirection.Input;
                    parameters.Add(PostalCode_Parameter);


                    IBSparameter Country_Parameter = new IBSparameter();
                    Country_Parameter.ParameterName = "@Country";
                    Country_Parameter.DataType      = DbType.String;
                    Country_Parameter.Value         = employee.PostalCode;
                    Country_Parameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Country_Parameter);



                    //IBSparameter PostalCodeParameter = new IBSparameter();
                    //PostalCodeParameter.ParameterName = "@PostalCode";
                    //PostalCodeParameter.DataType = DbType.String;
                    //PostalCodeParameter.Value = employee.PostalCode;
                    //PostalCodeParameter.Direction = ParameterDirection.Input;
                    //PostalCodeParameter.Add(PostalCodeParameter);

                    //IBSparameter CountryParameter = new IBSparameter();
                    //CountryParameter.ParameterName = "@Country";
                    //CountryParameter.DataType = DbType.String;
                    //CountryParameter.Value = employee.Country;
                    //CountryParameter.Direction = ParameterDirection.Input;
                    //CountryParameter.Add(CountryParameter);


                    IBSparameter Flag = new IBSparameter();
                    Flag.ParameterName = "@Flag";
                    Flag.DataType      = DbType.String;
                    Flag.Value         = "I";
                    Flag.Direction     = ParameterDirection.Input;
                    parameters.Add(Flag);

                    //IBSparameter returnParameter = new IBSparameter();
                    //returnParameter.ParameterName = "@ReturnValue";
                    //returnParameter.DataType = DbType.Int32;
                    //returnParameter.Value = "";
                    //returnParameter.Direction = ParameterDirection.Output;
                    //parameters.Add(returnParameter);
                }

                return(ExecuteSqlNonQuery("ERP_Save_Employee", parameters));
            }

            catch (Exception ex)
            {
                //Logger.Error("CompanyDAL.SaveCompany(" + LoggedInUser + "," + CompanyCode + "," + company.CompanyCode + ")", ex);
            }
            return(returnResult);
        }
Exemplo n.º 15
0
        public bool isUserHasPermission(string permissionName)
        {
            bool returnValue = false;

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter userParameter = new IBSparameter();
                    userParameter.ParameterName = "@UserAccount";
                    userParameter.DataType      = DbType.String;
                    userParameter.Value         = LoggedInUser;
                    userParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(userParameter);

                    IBSparameter userRoleParameter = new IBSparameter();
                    userRoleParameter.ParameterName = "@RoleId";
                    userRoleParameter.DataType      = DbType.String;
                    userRoleParameter.Value         = UserRoleId;
                    userRoleParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(userRoleParameter);

                    IBSparameter permissionNameParameter = new IBSparameter();
                    permissionNameParameter.ParameterName = "@PermissionName";
                    permissionNameParameter.DataType      = DbType.String;
                    permissionNameParameter.Value         = permissionName;
                    permissionNameParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(permissionNameParameter);
                }
                else if (DBProvider == ProviderName.MySqlClient)
                {
                    IBSparameter userParameter = new IBSparameter();
                    userParameter.ParameterName = "p_UserAccount";
                    userParameter.DataType      = DbType.String;
                    userParameter.Value         = LoggedInUser;
                    userParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(userParameter);

                    IBSparameter userRoleParameter = new IBSparameter();
                    userRoleParameter.ParameterName = "p_RoleId";
                    userRoleParameter.DataType      = DbType.String;
                    userRoleParameter.Value         = UserRoleId;
                    userRoleParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(userRoleParameter);

                    IBSparameter permissionNameParameter = new IBSparameter();
                    permissionNameParameter.ParameterName = "p_PermissionName";
                    permissionNameParameter.DataType      = DbType.String;
                    permissionNameParameter.Value         = permissionName;
                    permissionNameParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(permissionNameParameter);
                }
                DataSet dsPermission = null;
                dsPermission = GetDataSet("ERP_Is_Role_HasPermission", parameters);

                if (dsPermission != null && Convert.ToBoolean(dsPermission.Tables[0].Rows[0][0]))
                {
                    returnValue = true;
                }
            }
            catch (Exception ex)
            {
            }
            return(returnValue);
        }
Exemplo n.º 16
0
        public List <LoginViewModel> getUserLoginDetail(LoginViewModel userMaster)
        {
            List <LoginViewModel> loginView  = new List <LoginViewModel>();
            List <IBSparameter>   parameters = new List <IBSparameter>();

            try
            {
                System.Web.HttpContext.Current.Session["UserAccount"] = userMaster.UserAccount;

                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "@UserAccount";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = userMaster.UserAccount;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);

                    IBSparameter PasswordParameter = new IBSparameter();
                    PasswordParameter.ParameterName = "@Password";
                    PasswordParameter.DataType      = DbType.String;
                    PasswordParameter.Value         = userMaster.Password;
                    PasswordParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(PasswordParameter);
                }
                else if (DBProvider == ProviderName.MySqlClient)
                {
                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "p_UserAccount";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = userMaster.UserAccount;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);

                    IBSparameter PasswordParameter = new IBSparameter();
                    PasswordParameter.ParameterName = "p_Password";
                    PasswordParameter.DataType      = DbType.String;
                    PasswordParameter.Value         = userMaster.Password;
                    PasswordParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(PasswordParameter);

                    IBSparameter ApplicationParameter = new IBSparameter();
                    ApplicationParameter.ParameterName = "p_appName";
                    ApplicationParameter.DataType      = DbType.String;
                    ApplicationParameter.Value         = "Inventory";
                    ApplicationParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(ApplicationParameter);
                }

                DataSet dsLoginViewModel = null;
                dsLoginViewModel = GetDataSet("ERP_Get_UserDetail", parameters);

                var LoginViewCollection = from LoginViewModel in dsLoginViewModel.Tables[0].AsEnumerable()
                                          select new LoginViewModel
                {
                    UserAccount        = LoginViewModel.Field <String>("UserAccount"),
                    SignInStatus       = LoginViewModel.Field <String>("SignInStatus"),
                    RoleId             = LoginViewModel.Field <int>("RoleId"),
                    CompanyCode        = LoginViewModel.Field <String>("CompanyCode"),
                    DBConnectionString = LoginViewModel.Field <String>("DBConnectionString"),
                    DBProviderName     = LoginViewModel.Field <String>("DBProviderName"),
                };
                loginView = LoginViewCollection.ToList <LoginViewModel>();
            }
            catch (Exception ex)
            {
            }
            return(loginView);
        }
Exemplo n.º 17
0
        public List <Menus> GetMenu()
        {
            List <Menus>        menuList   = new List <Menus>();
            List <IBSparameter> parameters = new List <IBSparameter>();

            try
            {
                if (LoggedInUser == null && System.Web.HttpContext.Current.Session["UserAccount"] != null)
                {
                    LoggedInUser = Convert.ToString(System.Web.HttpContext.Current.Session["UserAccount"]);
                }

                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter userParameter = new IBSparameter();
                    userParameter.ParameterName = "@UserAccount";
                    userParameter.DataType      = DbType.String;
                    userParameter.Value         = LoggedInUser;
                    userParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(userParameter);

                    IBSparameter userRoleParameter = new IBSparameter();
                    userRoleParameter.ParameterName = "@RoleID";
                    userRoleParameter.DataType      = DbType.Int32;
                    userRoleParameter.Value         = UserRoleId;
                    userRoleParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(userRoleParameter);
                }
                else if (DBProvider == ProviderName.MySqlClient)
                {
                    IBSparameter userParameter = new IBSparameter();
                    userParameter.ParameterName = "p_UserAccount";
                    userParameter.DataType      = DbType.String;
                    userParameter.Value         = LoggedInUser;
                    userParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(userParameter);

                    IBSparameter passwordParameter = new IBSparameter();
                    passwordParameter.ParameterName = "p_RoleID";
                    passwordParameter.DataType      = DbType.Int32;
                    passwordParameter.Value         = UserRoleId;
                    passwordParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(passwordParameter);
                }
                DataSet dsMenu = null;
                dsMenu = GetDataSet("ERP_Get_Menu", parameters);

                var menuCollection = from Menus in dsMenu.Tables[0].AsEnumerable()
                                     select new Menus
                {
                    ModuleId       = Menus.Field <int>("ModuleId"),
                    ModuleName     = Menus.Field <String>("ModuleName"),
                    ParentId       = Menus.Field <int?>("ParentId"),
                    ActionName     = Menus.Field <String>("ActionName"),
                    ControllerName = Menus.Field <String>("ControllerName"),
                };
                menuList = menuCollection.ToList <Menus>();

                System.Web.HttpContext.Current.Session["CompanyName"] = "NIBIB NEW"; // take this from output parameter
            }

            catch (Exception ex)
            {
                //Logger.Error("NIBIB.EA.DataAccessLayer.AssignmentDal.GetAssignmentList(" + assignmentID + "," + currentUser + "," + isAssignmentOwner + ")", ex);
            }

            return(menuList);
        }
Exemplo n.º 18
0
        public Category GetCategoryById(int categoryId)
        {
            List <Category> categoryList = new List <Category>();

            // List<IBSparameter> parameters = new List<IBSparameter>();

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter userParameter = new IBSparameter();
                    userParameter.ParameterName = "@UserAccount";
                    userParameter.DataType      = DbType.String;
                    userParameter.Value         = LoggedInUser;
                    userParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(userParameter);



                    IBSparameter catergoryIdParameter = new IBSparameter();
                    catergoryIdParameter.ParameterName = "@CategoryId";
                    catergoryIdParameter.DataType      = DbType.String;
                    catergoryIdParameter.Value         = categoryId;
                    catergoryIdParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(catergoryIdParameter);
                }
                else if (DBProvider == ProviderName.MySqlClient)
                {
                    IBSparameter userParameter = new IBSparameter();
                    userParameter.ParameterName = "p_UserAccount";
                    userParameter.DataType      = DbType.String;
                    userParameter.Value         = LoggedInUser;
                    userParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(userParameter);

                    IBSparameter catergoryIdParameter = new IBSparameter();
                    catergoryIdParameter.ParameterName = "p_CategoryId";
                    catergoryIdParameter.DataType      = DbType.String;
                    catergoryIdParameter.Value         = categoryId;
                    catergoryIdParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(catergoryIdParameter);
                }

                DataSet dsCategory = null;
                dsCategory = GetDataSet("ERP_Get_CategoryById", parameters);

                var CategoryCollection = from Category in dsCategory.Tables[0].AsEnumerable()
                                         select new Category
                {
                    categoryid   = Category.Field <int>("categoryid"),
                    CategoryCode = Category.Field <String>("CategoryCode"),
                    CategoryName = Category.Field <String>("CategoryName"),
                    Description  = Category.Field <String>("Description"),
                };
                categoryList = CategoryCollection.ToList <Category>();
            }

            catch (Exception ex)
            {
                Logger.Error("CategoriesDAL.GetCategoryById(" + LoggedInUser + "," + CompanyCode + "," + categoryId + ")", ex);
            }

            return(categoryList[0]);
        }
Exemplo n.º 19
0
        public ReturnResult SaveSupplier(Suppliers supplier)
        {
            // Suppliers objSupplier = new Suppliers();
            ReturnResult returnResult = new ReturnResult();

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "@UserAccount";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = LoggedInUser;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);

                    IBSparameter SupplierIdParameter = new IBSparameter();
                    SupplierIdParameter.ParameterName = "@SupplierId";
                    SupplierIdParameter.DataType      = DbType.String;
                    SupplierIdParameter.Value         = supplier.SupplierId;
                    SupplierIdParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(SupplierIdParameter);

                    IBSparameter SupplierCodeParameter = new IBSparameter();
                    SupplierCodeParameter.ParameterName = "@SupplierCode";
                    SupplierCodeParameter.DataType      = DbType.String;
                    SupplierCodeParameter.Value         = supplier.SupplierCode;
                    SupplierCodeParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(SupplierCodeParameter);


                    IBSparameter SupplierNameParameter = new IBSparameter();
                    SupplierNameParameter.ParameterName = "@SupplierName";
                    SupplierNameParameter.DataType      = DbType.String;
                    SupplierNameParameter.Value         = supplier.SupplierName;
                    SupplierNameParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(SupplierNameParameter);

                    IBSparameter SupplierContactParameter = new IBSparameter();
                    SupplierContactParameter.ParameterName = "@ContactName";
                    SupplierContactParameter.DataType      = DbType.String;
                    SupplierContactParameter.Value         = supplier.ContactName;
                    SupplierContactParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(SupplierContactParameter);

                    IBSparameter SupplierContactTitleParameter = new IBSparameter();
                    SupplierContactTitleParameter.ParameterName = "@ContactTitle";
                    SupplierContactTitleParameter.DataType      = DbType.String;
                    SupplierContactTitleParameter.Value         = supplier.ContactTitle;
                    SupplierContactTitleParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(SupplierContactTitleParameter);

                    IBSparameter AddressParameter = new IBSparameter();
                    AddressParameter.ParameterName = "@Address";
                    AddressParameter.DataType      = DbType.String;
                    AddressParameter.Value         = supplier.Address;
                    AddressParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(AddressParameter);

                    IBSparameter CityParameter = new IBSparameter();
                    CityParameter.ParameterName = "@City";
                    CityParameter.DataType      = DbType.String;
                    CityParameter.Value         = supplier.City;
                    CityParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(CityParameter);

                    IBSparameter PostalCodeParameter = new IBSparameter();
                    PostalCodeParameter.ParameterName = "@PostalCode";
                    PostalCodeParameter.DataType      = DbType.String;
                    PostalCodeParameter.Value         = supplier.PostalCode;
                    PostalCodeParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(PostalCodeParameter);

                    IBSparameter CountryParameter = new IBSparameter();
                    CountryParameter.ParameterName = "@Country";
                    CountryParameter.DataType      = DbType.String;
                    CountryParameter.Value         = supplier.Country;
                    CountryParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(CountryParameter);

                    IBSparameter Phone1Parameter = new IBSparameter();
                    Phone1Parameter.ParameterName = "@Phone1";
                    Phone1Parameter.DataType      = DbType.String;
                    Phone1Parameter.Value         = supplier.Phone1;
                    Phone1Parameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Phone1Parameter);

                    IBSparameter Phone2Parameter = new IBSparameter();
                    Phone2Parameter.ParameterName = "@Phone2";
                    Phone2Parameter.DataType      = DbType.String;
                    Phone2Parameter.Value         = supplier.Phone2;
                    Phone2Parameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Phone2Parameter);

                    IBSparameter FaxParameter = new IBSparameter();
                    FaxParameter.ParameterName = "@Fax";
                    FaxParameter.DataType      = DbType.String;
                    FaxParameter.Value         = supplier.Fax;
                    FaxParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(FaxParameter);

                    IBSparameter WebSiteParameter = new IBSparameter();
                    WebSiteParameter.ParameterName = "@Website";
                    WebSiteParameter.DataType      = DbType.String;
                    WebSiteParameter.Value         = supplier.Website;
                    WebSiteParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(WebSiteParameter);

                    IBSparameter ContactEmailParameter = new IBSparameter();
                    ContactEmailParameter.ParameterName = "@ContactEmail";
                    ContactEmailParameter.DataType      = DbType.String;
                    ContactEmailParameter.Value         = supplier.ContactEmail;
                    ContactEmailParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(ContactEmailParameter);

                    IBSparameter ReturnParameter = new IBSparameter();
                    ReturnParameter.ParameterName = "@ReturnValue";
                    ReturnParameter.DataType      = DbType.Int32;
                    ReturnParameter.Value         = "";
                    ReturnParameter.Direction     = ParameterDirection.Output;
                    parameters.Add(ReturnParameter);
                }
                //ReturnResult returnValue = new ReturnResult();
                return(ExecuteSqlNonQuery("ERP_SAVE_Suppliers", parameters));
                //if (returnValue .IsSuccess)
                //{
                //     returnResult.ID = count;
                //     returnResult.IsSuccess=true;
                //     returnResult.Message = "Category saved successfully.";
                //}
                //else
                //{

                //}


                //DbCommand command = database.GetStoredProcCommand("ERP_Save_Category"); // SP name

                //database.AddInParameter(command, "@CategoryId", DbType.Int32, category.categoryid);
                //database.AddInParameter(command, "@CategoryName", DbType.String, category.categoryname);
                //database.AddInParameter(command, "@Description", DbType.String, category.description);
                //database.AddInParameter(command, "@LoginUser", DbType.String, loginUser);

                //database.ExecuteNonQuery(command);
            }

            catch (Exception ex)
            {
                Logger.Error("SupplierDAL.SaveSupplier(" + LoggedInUser + "," + CompanyCode + "," + supplier.SupplierCode + ")", ex);
            }
            return(returnResult);
        }
Exemplo n.º 20
0
        public ReturnResult SaveCategory(Category category)
        {
            Category     objCategory  = new Category();
            ReturnResult returnResult = new ReturnResult();

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter userParameter = new IBSparameter();
                    userParameter.ParameterName = "@UserAccount";
                    userParameter.DataType      = DbType.String;
                    userParameter.Value         = LoggedInUser;
                    userParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(userParameter);

                    IBSparameter catergoryIdParameter = new IBSparameter();
                    catergoryIdParameter.ParameterName = "@CategoryId";
                    catergoryIdParameter.DataType      = DbType.String;
                    catergoryIdParameter.Value         = category.categoryid;
                    catergoryIdParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(catergoryIdParameter);

                    IBSparameter catergoryCodeParameter = new IBSparameter();
                    catergoryCodeParameter.ParameterName = "@CategoryCode";
                    catergoryCodeParameter.DataType      = DbType.String;
                    catergoryCodeParameter.Value         = category.CategoryCode;
                    catergoryCodeParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(catergoryCodeParameter);


                    IBSparameter catergoryNameParameter = new IBSparameter();
                    catergoryNameParameter.ParameterName = "@CategoryName";
                    catergoryNameParameter.DataType      = DbType.String;
                    catergoryNameParameter.Value         = category.CategoryName;
                    catergoryNameParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(catergoryNameParameter);

                    IBSparameter catergoryDescParameter = new IBSparameter();
                    catergoryDescParameter.ParameterName = "@Description";
                    catergoryDescParameter.DataType      = DbType.String;
                    catergoryDescParameter.Value         = category.Description;
                    catergoryDescParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(catergoryDescParameter);

                    IBSparameter returnParameter = new IBSparameter();
                    returnParameter.ParameterName = "@ReturnValue";
                    returnParameter.DataType      = DbType.Int32;
                    returnParameter.Value         = "";
                    returnParameter.Direction     = ParameterDirection.Output;
                    parameters.Add(returnParameter);
                }
                else if (DBProvider == ProviderName.MySqlClient)
                {
                    IBSparameter userParameter = new IBSparameter();
                    userParameter.ParameterName = "p_UserAccount";
                    userParameter.DataType      = DbType.String;
                    userParameter.Value         = LoggedInUser;
                    userParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(userParameter);

                    IBSparameter catergoryIdParameter = new IBSparameter();
                    catergoryIdParameter.ParameterName = "p_CategoryId";
                    catergoryIdParameter.DataType      = DbType.Int32;
                    catergoryIdParameter.Value         = category.categoryid;
                    catergoryIdParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(catergoryIdParameter);

                    IBSparameter catergoryCodeParameter = new IBSparameter();
                    catergoryCodeParameter.ParameterName = "p_CategoryCode";
                    catergoryCodeParameter.DataType      = DbType.String;
                    catergoryCodeParameter.Value         = category.CategoryCode;
                    catergoryCodeParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(catergoryCodeParameter);


                    IBSparameter catergoryNameParameter = new IBSparameter();
                    catergoryNameParameter.ParameterName = "p_CategoryName";
                    catergoryNameParameter.DataType      = DbType.String;
                    catergoryNameParameter.Value         = category.CategoryName;
                    catergoryNameParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(catergoryNameParameter);

                    IBSparameter catergoryDescParameter = new IBSparameter();
                    catergoryDescParameter.ParameterName = "p_Description";
                    catergoryDescParameter.DataType      = DbType.String;
                    catergoryDescParameter.Value         = category.Description;
                    catergoryDescParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(catergoryDescParameter);

                    IBSparameter returnParameter = new IBSparameter();
                    returnParameter.ParameterName = "p_ReturnValue";
                    returnParameter.DataType      = DbType.Int32;
                    returnParameter.Value         = "";
                    returnParameter.Direction     = ParameterDirection.Output;
                    parameters.Add(returnParameter);
                }
                //ReturnResult returnValue = new ReturnResult();
                return(ExecuteSqlNonQuery("ERP_Save_Category", parameters));
                //if (returnValue .IsSuccess)
                //{
                //     returnResult.ID = count;
                //     returnResult.IsSuccess=true;
                //     returnResult.Message = "Category saved successfully.";
                //}
                //else
                //{

                //}


                //DbCommand command = database.GetStoredProcCommand("ERP_Save_Category"); // SP name

                //database.AddInParameter(command, "@CategoryId", DbType.Int32, category.categoryid);
                //database.AddInParameter(command, "@CategoryName", DbType.String, category.categoryname);
                //database.AddInParameter(command, "@Description", DbType.String, category.description);
                //database.AddInParameter(command, "@LoginUser", DbType.String, loginUser);

                //database.ExecuteNonQuery(command);
            }

            catch (Exception ex)
            {
                Logger.Error("CategoriesDAL.SaveCategory(" + LoggedInUser + "," + CompanyCode + "," + category.CategoryCode + ")", ex);
            }
            return(returnResult);
        }
Exemplo n.º 21
0
        public ReturnResult SaveCompany(CompanyMaster company)
        {
            CompanyMaster objCompany   = new CompanyMaster();
            ReturnResult  returnResult = new ReturnResult();

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter CompanyIDParameter = new IBSparameter();
                    CompanyIDParameter.ParameterName = "@CompanyID";
                    CompanyIDParameter.DataType      = DbType.String;
                    CompanyIDParameter.Value         = company.CompanyId;
                    CompanyIDParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(CompanyIDParameter);


                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "@UserAccount";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = LoggedInUser;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);

                    IBSparameter CompanyCodeParameter = new IBSparameter();
                    CompanyCodeParameter.ParameterName = "@CompanyCode";
                    CompanyCodeParameter.DataType      = DbType.String;
                    CompanyCodeParameter.Value         = company.CompanyCode;
                    CompanyCodeParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(CompanyCodeParameter);

                    IBSparameter CompanyNameParameter = new IBSparameter();
                    CompanyNameParameter.ParameterName = "@CompanyName";
                    CompanyNameParameter.DataType      = DbType.String;
                    CompanyNameParameter.Value         = company.CompanyName;
                    CompanyNameParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(CompanyNameParameter);


                    IBSparameter CompanyRegistrationNoParameter = new IBSparameter();
                    CompanyRegistrationNoParameter.ParameterName = "@RegistrationNo";
                    CompanyRegistrationNoParameter.DataType      = DbType.String;
                    CompanyRegistrationNoParameter.Value         = company.RegistrationNo;
                    CompanyRegistrationNoParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(CompanyRegistrationNoParameter);

                    IBSparameter CompanyAddressParameter = new IBSparameter();
                    CompanyAddressParameter.ParameterName = "@Address";
                    CompanyAddressParameter.DataType      = DbType.String;
                    CompanyAddressParameter.Value         = company.Address;
                    CompanyAddressParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(CompanyAddressParameter);

                    IBSparameter CompanyCityParameter = new IBSparameter();
                    CompanyCityParameter.ParameterName = "@City";
                    CompanyCityParameter.DataType      = DbType.String;
                    CompanyCityParameter.Value         = company.City;
                    CompanyCityParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(CompanyCityParameter);


                    IBSparameter Flag = new IBSparameter();
                    Flag.ParameterName = "@Flag";
                    Flag.DataType      = DbType.String;
                    Flag.Value         = "I";
                    Flag.Direction     = ParameterDirection.Input;
                    parameters.Add(Flag);

                    IBSparameter returnParameter = new IBSparameter();
                    returnParameter.ParameterName = "@ReturnValue";
                    returnParameter.DataType      = DbType.Int32;
                    returnParameter.Value         = "";
                    returnParameter.Direction     = ParameterDirection.Output;
                    parameters.Add(returnParameter);
                }

                return(ExecuteSqlNonQuery("ERP_Save_Company", parameters));
            }

            catch (Exception ex)
            {
                Logger.Error("CompanyDAL.SaveCompany(" + LoggedInUser + "," + CompanyCode + "," + company.CompanyCode + ")", ex);
            }
            return(returnResult);
        }
Exemplo n.º 22
0
        public ReturnResult SaveProduct(ProductMaster product)
        {
            Category     objCategory  = new Category();
            ReturnResult returnResult = new ReturnResult();

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "@UserAccount";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = LoggedInUser;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);

                    IBSparameter ProductIdParameter = new IBSparameter();
                    ProductIdParameter.ParameterName = "@ProductId";
                    ProductIdParameter.DataType      = DbType.String;
                    ProductIdParameter.Value         = product.ProductId;
                    ProductIdParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(ProductIdParameter);

                    IBSparameter ProductCodeParameter = new IBSparameter();
                    ProductCodeParameter.ParameterName = "@ProductCode";
                    ProductCodeParameter.DataType      = DbType.String;
                    ProductCodeParameter.Value         = product.ProductCode;
                    ProductCodeParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(ProductCodeParameter);


                    IBSparameter CatergoryNameParameter = new IBSparameter();
                    CatergoryNameParameter.ParameterName = "@ProductName";
                    CatergoryNameParameter.DataType      = DbType.String;
                    CatergoryNameParameter.Value         = product.CategoryName;
                    CatergoryNameParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(CatergoryNameParameter);

                    IBSparameter UOMParameter = new IBSparameter();
                    UOMParameter.ParameterName = "@UOM";
                    UOMParameter.DataType      = DbType.String;
                    UOMParameter.Value         = product.UOM;
                    UOMParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(UOMParameter);

                    IBSparameter BarcodeParameter = new IBSparameter();
                    BarcodeParameter.ParameterName = "@Barcode";
                    BarcodeParameter.DataType      = DbType.String;
                    BarcodeParameter.Value         = product.BarCode;
                    BarcodeParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(BarcodeParameter);

                    IBSparameter CategoryIdParameter = new IBSparameter();
                    CategoryIdParameter.ParameterName = "@CategoryId";
                    CategoryIdParameter.DataType      = DbType.Int32;
                    CategoryIdParameter.Value         = product.CategoryId;
                    CategoryIdParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(CategoryIdParameter);

                    IBSparameter SupplierIdParameter = new IBSparameter();
                    SupplierIdParameter.ParameterName = "@SupplierId";
                    SupplierIdParameter.DataType      = DbType.Int32;
                    SupplierIdParameter.Value         = product.SupplierId;
                    SupplierIdParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(SupplierIdParameter);

                    IBSparameter CompanyPriceParameter = new IBSparameter();
                    CompanyPriceParameter.ParameterName = "@CompanyPrice";
                    CompanyPriceParameter.DataType      = DbType.Decimal;
                    CompanyPriceParameter.Value         = product.CompanyPrice;
                    CompanyPriceParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(CompanyPriceParameter);

                    IBSparameter RePOorderLevelParameter = new IBSparameter();
                    RePOorderLevelParameter.ParameterName = "@RePOorderLevel";
                    RePOorderLevelParameter.DataType      = DbType.Int32;
                    RePOorderLevelParameter.Value         = product.RePOorderLevel;
                    RePOorderLevelParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(RePOorderLevelParameter);

                    IBSparameter RePOorderQuantityParameter = new IBSparameter();
                    RePOorderQuantityParameter.ParameterName = "@RePOorderQuantity";
                    RePOorderQuantityParameter.DataType      = DbType.Int32;
                    RePOorderQuantityParameter.Value         = product.RePOorderQuantity;
                    RePOorderQuantityParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(RePOorderQuantityParameter);

                    //IBSparameter ReSOorderLevelParameter = new IBSparameter();
                    //ReSOorderLevelParameter.ParameterName = "@ReSOorderLevel";
                    //ReSOorderLevelParameter.DataType = DbType.Int32;
                    //ReSOorderLevelParameter.Value = product.ReSOorderLevel;
                    //ReSOorderLevelParameter.Direction = ParameterDirection.Input;
                    //parameters.Add(ReSOorderLevelParameter);

                    //IBSparameter ReSOorderQuantityParameter = new IBSparameter();
                    //ReSOorderQuantityParameter.ParameterName = "@ReSOorderQuantity";
                    //ReSOorderQuantityParameter.DataType = DbType.Int32;
                    //ReSOorderQuantityParameter.Value = product.ReSOorderQuantity;
                    //ReSOorderQuantityParameter.Direction = ParameterDirection.Input;
                    //parameters.Add(ReSOorderQuantityParameter);

                    IBSparameter ReturnParameter = new IBSparameter();
                    ReturnParameter.ParameterName = "@ReturnValue";
                    ReturnParameter.DataType      = DbType.Int32;
                    ReturnParameter.Value         = "";
                    ReturnParameter.Direction     = ParameterDirection.Output;
                    parameters.Add(ReturnParameter);
                }
                //ReturnResult returnValue = new ReturnResult();
                return(ExecuteSqlNonQuery("ERP_Save_Product", parameters));
                //if (returnValue .IsSuccess)
                //{
                //     returnResult.ID = count;
                //     returnResult.IsSuccess=true;
                //     returnResult.Message = "Category saved successfully.";
                //}
                //else
                //{

                //}


                //DbCommand command = database.GetStoredProcCommand("ERP_Save_Category"); // SP name

                //database.AddInParameter(command, "@CategoryId", DbType.Int32, category.categoryid);
                //database.AddInParameter(command, "@CategoryName", DbType.String, category.categoryname);
                //database.AddInParameter(command, "@Description", DbType.String, category.description);
                //database.AddInParameter(command, "@LoginUser", DbType.String, loginUser);

                //database.ExecuteNonQuery(command);
            }

            catch (Exception ex)
            {
                Logger.Error("ProductDAL.SaveProduct(" + LoggedInUser + "," + CompanyCode + "," + product.ProductCode + ")", ex);
            }
            return(returnResult);
        }
Exemplo n.º 23
0
        public ReturnResult SaveStore(Stores store)
        {
            Stores       objStore     = new Stores();
            ReturnResult returnResult = new ReturnResult();

            try
            {
                if (DBProvider == ProviderName.SqlClient)
                {
                    IBSparameter StoreIDParameter = new IBSparameter();
                    StoreIDParameter.ParameterName = "@StoreID";
                    StoreIDParameter.DataType      = DbType.String;
                    StoreIDParameter.Value         = store.StoreId;
                    StoreIDParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(StoreIDParameter);


                    IBSparameter Userparameter = new IBSparameter();
                    Userparameter.ParameterName = "@UserAccount";
                    Userparameter.DataType      = DbType.String;
                    Userparameter.Value         = LoggedInUser;
                    Userparameter.Direction     = ParameterDirection.Input;
                    parameters.Add(Userparameter);

                    IBSparameter StoreNameParameter = new IBSparameter();
                    StoreNameParameter.ParameterName = "@StoreName";
                    StoreNameParameter.DataType      = DbType.String;
                    StoreNameParameter.Value         = store.StoreName;
                    StoreNameParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(StoreNameParameter);

                    IBSparameter StoreCompanyIDParameter = new IBSparameter();
                    StoreCompanyIDParameter.ParameterName = "@CompanyID";
                    StoreCompanyIDParameter.DataType      = DbType.Int32;
                    StoreCompanyIDParameter.Value         = 1;
                    StoreCompanyIDParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(StoreCompanyIDParameter);

                    IBSparameter StoreAddressParameter = new IBSparameter();
                    StoreAddressParameter.ParameterName = "@Address";
                    StoreAddressParameter.DataType      = DbType.String;
                    StoreAddressParameter.Value         = store.Address;
                    StoreAddressParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(StoreAddressParameter);

                    IBSparameter StoreCityParameter = new IBSparameter();
                    StoreCityParameter.ParameterName = "@City";
                    StoreCityParameter.DataType      = DbType.String;
                    StoreCityParameter.Value         = store.City;
                    StoreCityParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(StoreCityParameter);

                    IBSparameter StoreEmailParameter = new IBSparameter();
                    StoreEmailParameter.ParameterName = "@Email";
                    StoreEmailParameter.DataType      = DbType.String;
                    StoreEmailParameter.Value         = store.Email;
                    StoreEmailParameter.Direction     = ParameterDirection.Input;
                    parameters.Add(StoreEmailParameter);

                    IBSparameter Flag = new IBSparameter();
                    Flag.ParameterName = "@Flag";
                    Flag.DataType      = DbType.String;
                    Flag.Value         = "I";
                    Flag.Direction     = ParameterDirection.Input;
                    parameters.Add(Flag);

                    //IBSparameter returnParameter = new IBSparameter();
                    //returnParameter.ParameterName = "@ReturnValue";
                    //returnParameter.DataType = DbType.Int32;
                    //returnParameter.Value = "";
                    //returnParameter.Direction = ParameterDirection.Output;
                    //parameters.Add(returnParameter);
                }

                return(ExecuteSqlNonQuery("ERP_Save_Store", parameters));
            }

            catch (Exception ex)
            {
                // Logger.Error("CompanyDAL.SaveCompany(" + LoggedInUser + "," + CompanyCode + "," + company.CompanyCode + ")", ex);
            }
            return(returnResult);
        }