Exemple #1
0
        //FERNANDES
        public static List <Model.mdlCustomer> GetCustomerorWarehouseCoordinate(List <Model.mdlVisitTracking> lParamlist)
        {
            var mdlCustomerList = new List <Model.mdlCustomer>();

            foreach (var lParam in lParamlist)
            {
                List <SqlParameter> sp = new List <SqlParameter>()
                {
                    new SqlParameter()
                    {
                        ParameterName = "@CustomerID", SqlDbType = SqlDbType.NVarChar, Value = lParam.CustomerID
                    },
                    new SqlParameter()
                    {
                        ParameterName = "@WarehouseID", SqlDbType = SqlDbType.NVarChar, Value = lParam.WarehouseID
                    }
                };

                if (lParam.CustomerID == lParam.WarehouseID)
                {
                    DataTable dtCustomer = Manager.DataFacade.DTSQLCommand(@"SELECT CustomerID, CustomerName, Latitude, Longitude,CustomerAddress
                                                                            FROM Customer
                                                                            WHERE CustomerID=@CustomerID AND Latitude <> '' AND Latitude <> '0' AND Latitude IS NOT NULL
                                                                                                     AND Longitude <> '' AND Longitude <> '0' AND Longitude IS NOT NULL", sp);

                    foreach (DataRow row in dtCustomer.Rows)
                    {
                        var mdlCustomer = new Model.mdlCustomer();
                        mdlCustomer.CustomerID      = row["CustomerID"].ToString();
                        mdlCustomer.CustomerName    = row["CustomerName"].ToString();
                        mdlCustomer.CustomerAddress = row["CustomerAddress"].ToString();
                        mdlCustomer.Latitude        = row["Latitude"].ToString();
                        mdlCustomer.Longitude       = row["Longitude"].ToString();

                        mdlCustomerList.Add(mdlCustomer);
                    }
                }
                else
                {
                    DataTable dtCustomer = Manager.DataFacade.DTSQLCommand(@"SELECT WarehouseID, WarehouseName, Latitude, Longitude, WarehouseAddress
                                                                            FROM Warehouse
                                                                            WHERE CustomerID=@CustomerID AND WarehouseID=@WarehouseID AND Latitude <> '' AND Latitude <> '0' AND Latitude IS NOT NULL
                                                                                                     AND Longitude <> '' AND Longitude <> '0' AND Longitude IS NOT NULL", sp);

                    foreach (DataRow row in dtCustomer.Rows)
                    {
                        var mdlCustomer = new Model.mdlCustomer();
                        mdlCustomer.CustomerID      = row["WarehouseID"].ToString();
                        mdlCustomer.CustomerName    = row["WarehouseName"].ToString();
                        mdlCustomer.CustomerAddress = row["WarehouseAddress"].ToString();
                        mdlCustomer.Latitude        = row["Latitude"].ToString();
                        mdlCustomer.Longitude       = row["Longitude"].ToString();

                        mdlCustomerList.Add(mdlCustomer);
                    }
                }
            }

            return(mdlCustomerList);
        }
Exemple #2
0
        public static List <Model.mdlCustomer> GetSearchCustomerByBranch(string keyword, string branchid)
        {
            List <SqlParameter> sp = new List <SqlParameter>()
            {
            };

            var mdlCustList = new List <Model.mdlCustomer>();

            DataTable dtCust = Manager.DataFacade.DTSQLCommand(@"SELECT   CustomerID, 
			                                                                        CustomerName,
                                                                                    CustomerAddress, BranchID
                                                                                    from Customer
				                                                            Where BranchID IN ("                 + branchid + ") and (CustomerID LIKE '%" + keyword + "%' or CustomerName LIKE '%" + keyword + "%')", sp);

            foreach (DataRow row in dtCust.Rows)
            {
                var mdlCust = new Model.mdlCustomer();
                mdlCust.CustomerID      = row["CustomerID"].ToString();
                mdlCust.CustomerName    = row["CustomerName"].ToString();
                mdlCust.CustomerAddress = row["CustomerAddress"].ToString();
                mdlCust.BranchID        = row["BranchID"].ToString();

                mdlCustList.Add(mdlCust);
            }
            return(mdlCustList);
        }
Exemple #3
0
        public static List <Model.mdlCustomer> GetCustomerCoordinate(string lBranchID)
        {
            List <SqlParameter> sp = new List <SqlParameter>()
            {
                new SqlParameter()
                {
                    ParameterName = "@BranchID", SqlDbType = SqlDbType.NVarChar, Value = lBranchID
                },
            };

            var mdlCustomerList = new List <Model.mdlCustomer>();

            DataTable dtCustomer = Manager.DataFacade.DTSQLCommand(@"SELECT CustomerID, CustomerName, CustomerAddress, Phone, PIC, Latitude, Longitude
                                                                        FROM Customer
                                                                        WHERE BranchID=@BranchID AND Latitude <> '' AND Latitude <> '0' AND Latitude IS NOT NULL
                                                                                                 AND Longitude <> '' AND Longitude <> '0' AND Longitude IS NOT NULL", sp);

            foreach (DataRow row in dtCustomer.Rows)
            {
                var mdlCustomer = new Model.mdlCustomer();
                mdlCustomer.CustomerID      = row["CustomerID"].ToString();
                mdlCustomer.CustomerName    = row["CustomerName"].ToString();
                mdlCustomer.CustomerAddress = row["CustomerAddress"].ToString();
                mdlCustomer.Phone           = row["Phone"].ToString();
                mdlCustomer.PIC             = row["PIC"].ToString();
                mdlCustomer.Latitude        = row["Latitude"].ToString();
                mdlCustomer.Longitude       = row["Longitude"].ToString();

                mdlCustomerList.Add(mdlCustomer);
            }
            return(mdlCustomerList);
        }
Exemple #4
0
        public static List <Model.mdlCustomer> LoadCustomer(Model.mdlParam json)
        {
            var mdlCustomerList = new List <Model.mdlCustomer>();

            List <SqlParameter> sp = new List <SqlParameter>()
            {
                new SqlParameter()
                {
                    ParameterName = "@Date", SqlDbType = SqlDbType.DateTime, Value = Convert.ToDateTime(json.Date).Date
                },
                new SqlParameter()
                {
                    ParameterName = "@EmployeeID", SqlDbType = SqlDbType.NVarChar, Value = json.EmployeeID
                },
                new SqlParameter()
                {
                    ParameterName = "@BranchID", SqlDbType = SqlDbType.NVarChar, Value = json.BranchID
                }
            };

            DataTable dtCustomer = Manager.DataFacade.DTSQLCommand(@"SELECT * FROM Customer", sp);

            foreach (DataRow drCustomer in dtCustomer.Rows)
            {
                var mdlCustomer = new Model.mdlCustomer();
                mdlCustomer.CustomerID        = drCustomer["CustomerID"].ToString();
                mdlCustomer.CustomerName      = drCustomer["CustomerName"].ToString();
                mdlCustomer.CustomerAddress   = drCustomer["CustomerAddress"].ToString();
                mdlCustomer.Phone             = drCustomer["Phone"].ToString();
                mdlCustomer.Email             = drCustomer["Email"].ToString();
                mdlCustomer.PIC               = drCustomer["PIC"].ToString();
                mdlCustomer.CustomerTypeID    = drCustomer["CustomerTypeID"].ToString();
                mdlCustomer.Latitude          = drCustomer["Latitude"].ToString();
                mdlCustomer.Longitude         = drCustomer["Longitude"].ToString();
                mdlCustomer.BranchID          = drCustomer["BranchID"].ToString();
                mdlCustomer.Radius            = drCustomer["Radius"].ToString();
                mdlCustomer.City              = drCustomer["City"].ToString();
                mdlCustomer.CountryRegionCode = drCustomer["CountryRegionCode"].ToString();
                //mdlCustomer.Blocked = drCustomer["Blocked"].ToString();
                mdlCustomer.Account           = drCustomer["Account"].ToString();
                mdlCustomer.Channel           = drCustomer["Channel"].ToString();
                mdlCustomer.Distributor       = drCustomer["Distributor"].ToString();
                mdlCustomer.EmployeeID        = drCustomer["EmployeeID"].ToString();
                mdlCustomer.Mobilephone1      = drCustomer["Mobilephone1"].ToString();
                mdlCustomer.Mobilephone2      = drCustomer["Mobilephone2"].ToString();
                mdlCustomer.BankAccountNumber = drCustomer["BankAccountNumber"].ToString();
                mdlCustomerList.Add(mdlCustomer);
            }
            return(mdlCustomerList);
        }