示例#1
0
        public InOutRevenue FillByNoSeri(string noseri)
        {
            InOutRevenue inOutRevenue = new InOutRevenue();

            string query = "SELECT r.inoutrevenueid, r.refid, r.movact, r.revenuetype, r.billto, r.liftoff, r.liftoffinfo, r.lifton, r.liftoninfo, r.wash, r.washinfo, r.admin, r.admininfo, r.storage, r.storageinfo, r.textflag, r.noseri, r.qty, r.iscanceled, r.contactpersonout, r.liftoffsplit, r.liftonsplit, r.washsplit, r.kodekasir, r.invby, r.kasirby, r.dtminv, r.dtmkasir, r.takedef, r.take20, r.take40, r.take45, r.kasirnote, r.principaladmin, r.principalliftoff, r.principallifton, r.principalwash, r.principalstorage,  r.spnote1, r.ppn FROM inoutrevenue r WHERE r.noseri=@noseri";


            try
            {
                using (NpgsqlConnection npgsqlConnection = AppConfig.GetConnection())
                {
                    if (npgsqlConnection.State == ConnectionState.Closed)
                    {
                        npgsqlConnection.Open();
                    }

                    using (NpgsqlCommand npgsqlCommand = new NpgsqlCommand(query, npgsqlConnection))
                    {
                        npgsqlCommand.Parameters.AddWithValue("@noseri", noseri);
                        using (NpgsqlDataReader npgsqlDataReader = npgsqlCommand.ExecuteReader())
                        {
                            if (npgsqlDataReader.Read())
                            {
                                MappingDataReaderToInOutRevenue(npgsqlDataReader, inOutRevenue);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(inOutRevenue);
        }
示例#2
0
        public InOutRevenue FillInOutRevenueByContCard(ContCard contCard)
        {
            InOutRevenue inOutRevenue    = new InOutRevenue();
            string       columnCondition = string.Empty;

            switch (contCard.CardMode)
            {
            case "IN":
                columnCondition = "r.refid";
                break;

            case "OUT":
                columnCondition = "r.inoutrevenueid";
                break;

            default:
                return(inOutRevenue);
            }
            string query = string.Format("SELECT {0} " +
                                         " FROM {1} {2} " +
                                         " WHERE {3} " +
                                         "   (SELECT refid FROM contcard WHERE contcardid = @ContCardId) AND noseri like 'K%' " +
                                         " ORDER BY r.inoutrevenueid, r.noseri",
                                         string.Format(DEFAULT_COLUMN, "r"),
                                         DEFAULT_TABLE,
                                         "r",
                                         columnCondition);

            try
            {
                using (NpgsqlConnection npgsqlConnection = AppConfig.GetConnection())
                {
                    if (npgsqlConnection.State == ConnectionState.Closed)
                    {
                        npgsqlConnection.Open();
                    }

                    using (NpgsqlCommand npgsqlCommand = new NpgsqlCommand(query, npgsqlConnection))
                    {
                        npgsqlCommand.Parameters.AddWithValue("@ContCardId", contCard.ContCardID);
                        using (NpgsqlDataReader npgsqlDataReader = npgsqlCommand.ExecuteReader())
                        {
                            if (npgsqlDataReader.Read())
                            {
                                MappingDataReaderToInOutRevenue(npgsqlDataReader, inOutRevenue);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(inOutRevenue);
        }
示例#3
0
        public EirOutPrint_(ContInOut obj)
        {
            this.mObj  = obj;
            this.mCust = new Customer();
            CustomerDAL customerDAL = new CustomerDAL();

            this.mCust = customerDAL.FillByCustomerCode(this.mObj.CustomerCode);
            this.mOr   = new InOutRevenue();
            InOutRevenueDAL inOutRevenueDAL = new InOutRevenueDAL();

            this.mOr = inOutRevenueDAL.FillByNoSeri(obj.NoSeriOrOut);
        }
示例#4
0
        public InOutRevenue FillInOutRevenueByInOutRevenueId(long inOutRevenueId)
        {
            InOutRevenue inOutRevenue = new InOutRevenue();

            try
            {
                using (NpgsqlConnection npgsqlConnection = AppConfig.GetConnection())
                {
                    if (npgsqlConnection.State == ConnectionState.Closed)
                    {
                        npgsqlConnection.Open();
                    }
                    string query = string.Format("SELECT {0} " +
                                                 " FROM {1} " +
                                                 " WHERE inoutrevenueid=@InOutRevenueId ",
                                                 string.Format(DEFAULT_COLUMN, string.Empty),
                                                 DEFAULT_TABLE);
                    using (NpgsqlCommand npgsqlCommand = new NpgsqlCommand(query, npgsqlConnection))
                    {
                        npgsqlCommand.Parameters.AddWithValue("@InOutRevenueId", inOutRevenueId);
                        using (NpgsqlDataReader npgsqlDataReader = npgsqlCommand.ExecuteReader())
                        {
                            if (npgsqlDataReader.Read())
                            {
                                MappingDataReaderToInOutRevenue(npgsqlDataReader, inOutRevenue);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(inOutRevenue);
        }
示例#5
0
        private void MappingDataReaderToInOutRevenue(NpgsqlDataReader npgsqlDataReader, InOutRevenue inOutRevenue)
        {
            inOutRevenue.InOutRevenueId   = npgsqlDataReader.GetInt64(0);
            inOutRevenue.RefId            = npgsqlDataReader.GetInt64(1);
            inOutRevenue.MovAct           = npgsqlDataReader.GetString(2);
            inOutRevenue.RevenueType      = npgsqlDataReader.GetString(3);
            inOutRevenue.BillTo           = npgsqlDataReader.GetString(4);
            inOutRevenue.LiftOff          = npgsqlDataReader.GetDouble(5);
            inOutRevenue.LiftOffInfo      = npgsqlDataReader.GetString(6);
            inOutRevenue.LiftOn           = npgsqlDataReader.GetDouble(7);
            inOutRevenue.LiftOnInfo       = npgsqlDataReader.GetString(8);
            inOutRevenue.Wash             = npgsqlDataReader.GetDouble(9);
            inOutRevenue.WashInfo         = npgsqlDataReader.GetString(10);
            inOutRevenue.Admin            = npgsqlDataReader.GetDouble(11);
            inOutRevenue.AdminInfo        = npgsqlDataReader.GetString(12);
            inOutRevenue.Storage          = npgsqlDataReader.GetDouble(13);
            inOutRevenue.StorageInfo      = npgsqlDataReader.GetString(14);
            inOutRevenue.TextFlag         = npgsqlDataReader.GetString(15);
            inOutRevenue.NoSeri           = npgsqlDataReader.GetString(16);
            inOutRevenue.Qty              = npgsqlDataReader.GetInt32(17);
            inOutRevenue.IsCanceled       = npgsqlDataReader.GetInt32(18);
            inOutRevenue.ContactPersonOut = npgsqlDataReader.GetString(19);
            inOutRevenue.LiftOffSplit     = npgsqlDataReader.GetDouble(20);
            inOutRevenue.LiftOnSplit      = npgsqlDataReader.GetDouble(21);
            inOutRevenue.WashSplit        = npgsqlDataReader.GetDouble(22);
            inOutRevenue.KodeKasir        = npgsqlDataReader.GetString(23);
            inOutRevenue.InvBy            = npgsqlDataReader.GetString(24);
            inOutRevenue.KasirBy          = npgsqlDataReader.GetString(25);
            if (npgsqlDataReader["dtminv"] != DBNull.Value)
            {
                inOutRevenue.DtmInv = npgsqlDataReader.GetDateTime(npgsqlDataReader.GetOrdinal("dtminv")).ToString(GlobalConstant.DATE_YMDHMS_LONG_FORMAT);
            }
            if (npgsqlDataReader["dtmkasir"] != DBNull.Value)
            {
                inOutRevenue.DtmInv = npgsqlDataReader.GetDateTime(npgsqlDataReader.GetOrdinal("dtmkasir")).ToString(GlobalConstant.DATE_YMDHMS_LONG_FORMAT);
            }
            inOutRevenue.TakeDef = new DefinedContainer(npgsqlDataReader.GetString(28)).ToString();
            inOutRevenue.Take20  = new ContainerSpecification(npgsqlDataReader.GetString(29)).ToString();
            inOutRevenue.Take40  = new ContainerSpecification(npgsqlDataReader.GetString(30)).ToString();
            inOutRevenue.Take45  = new ContainerSpecification(npgsqlDataReader.GetString(31)).ToString();

            inOutRevenue.KasirNote        = npgsqlDataReader.GetString(32);
            inOutRevenue.PrincipalAdmin   = npgsqlDataReader.GetDouble(33);
            inOutRevenue.PrincipalLiftOff = npgsqlDataReader.GetDouble(34);
            inOutRevenue.PrincipalLiftOn  = npgsqlDataReader.GetDouble(35);
            inOutRevenue.PrincipalWash    = npgsqlDataReader.GetDouble(36);
            inOutRevenue.PrincipalStorage = npgsqlDataReader.GetDouble(37);
            inOutRevenue.SpNote1          = npgsqlDataReader.GetString(38);
        }