Exemplo n.º 1
0
        public List <CustomerInfo> getAllCustomer(int pageSize, int pageIndex)
        {
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                List <CustomerInfo> ListCustomer = CustomerDataLayer.GetInstance().GetAllCustomer(connection);
                //int min = pageIndex * pageSize;
                //int max = pageIndex * pageSize + pageSize;

                //if (min > ListCustomer.Count) return new List<CustomerInfo>();
                //if (max >= ListCustomer.Count) pageSize = ListCustomer.Count - min;
                //if (pageSize <= 0) return new List<CustomerInfo>();
                return(ListCustomer);
            }
            //
            //SqlConnectionFactory sqlConnection = new SqlConnectionFactory();
            //using (SqlConnection connection = sqlConnection.GetConnection())
            //{
            //    List<CustomerInfo> ListCustomer = CustomerDataLayer.GetInstance().GetAllCustomer(connection);
            //    int min = pageIndex * pageSize;
            //    int max = pageIndex * pageSize + pageSize;

            //    if (min > ListCustomer.Count) return new List<CustomerInfo>();
            //    if (max >= ListCustomer.Count) pageSize = ListCustomer.Count - min;
            //    if (pageSize <= 0) return new List<CustomerInfo>();
            //    return ListCustomer.GetRange(min, pageSize);
            //}
        }
Exemplo n.º 2
0
        public ContractPrintModel GetNegotiationPrintModel(int contractID, string _userID)
        {
            ContractPrintModel   record        = new ContractPrintModel();
            NegotiationInfo      info          = new NegotiationInfo();
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();
            NewContractInfo      contractInfo  = getContractNew(contractID, _userID);

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                info = NegotiationDataLayer.GetInstance().getNegotiation(connection, contractInfo.NegotiationID, _userID);
                if (record == null || info == null)
                {
                    return(null);
                }

                CustomerInfo cusInfo = CustomerDataLayer.GetInstance().getCustomer(connection, info.CustomerID);

                record.ContractCode = contractInfo.ContractCode;
                record.DateIn       = contractInfo.DateIn;
                record.ASide        = "BỆNH VIỆN TRUYỀN MÁU HUYẾT HỌC";
                record.BSide        = info.CustomerName;

                record.ALocation  = info.Location;
                record.APhone     = info.Phone;
                record.AFax       = info.Fax;
                record.ABankID    = info.BankID;
                record.ATaxCode   = info.TaxCode;
                record.ARepresent = info.Represent;
                record.APosition  = info.Position;

                record.BLocation       = cusInfo.Address;
                record.BPhone          = cusInfo.Phone;
                record.BFax            = cusInfo.Fax;
                record.BBankID         = cusInfo.BankNumber + " " + cusInfo.BankName;
                record.BTaxCode        = cusInfo.TaxCode;
                record.BRepresent      = cusInfo.Surrogate;
                record.BPosition       = cusInfo.Position;
                record.NegotiationTime = info.DateIn;
                record.Term            = info.Term;
                record.NegotiationCode = info.NegotiationCode;
                record.VATNumber       = info.VATNumber;
                record.IsVAT           = info.IsVAT;
                record.QuoteTotalCost  = info.QuoteTotalCost;
                record.Items           = QuoteDataLayer.GetInstance().getSelectedItemsQuote(connection,
                                                                                            record.QuoteID);
                record.QuoteID   = info.QuoteID;
                record.QuoteCode = info.QuoteCode;


                record.BidType          = info.BidType;
                record.BidExpirated     = info.BidExpirated;
                record.BidExpiratedUnit = info.BidExpiratedUnit;

                record.Items = QuoteDataLayer.GetInstance().getSelectedItemsQuote(connection,
                                                                                  record.QuoteID);

                return(record);
            }
        }
Exemplo n.º 3
0
        public List <CustomerInfo> getCustomer(CustomerSeachCriteria _criteria)
        {
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                List <CustomerInfo> ListCustomer = CustomerDataLayer.GetInstance().getCustomer(connection, _criteria);
                return(ListCustomer);
            }
        }
Exemplo n.º 4
0
        public CustomerInfo getCustomerbyId(string _bidPlanCode)
        {
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                CustomerInfo Customer = CustomerDataLayer.GetInstance().getCustomerByBidPlanCode(connection, _bidPlanCode);
                return(Customer);
            }
        }
Exemplo n.º 5
0
        public CustomerInfo getCustomerbyId(int _ID)
        {
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                CustomerInfo Customer = CustomerDataLayer.GetInstance().getCustomer(connection, _ID);
                return(Customer);
            }
        }
Exemplo n.º 6
0
        public int getNewId()
        {
            SqlConnectionFactory sqlConnection = new SqlConnectionFactory();

            using (SqlConnection connection = sqlConnection.GetConnection())
            {
                List <CustomerInfo> ListCustomer = CustomerDataLayer.GetInstance().GetAllCustomer(connection);
                CustomerInfo        lastCustomer = ListCustomer.Last();
                if (lastCustomer != null)
                {
                    return(lastCustomer.CustomerID + 1);
                }
                return(1);
            }
        }