Ejemplo n.º 1
0
        private void DataPortal_Fetch(int id)
        {
            using (var ctx = ConnectionManager <SqlConnection> .GetManager(ConfigHelper.GetDatabase(), false))
            {
                using (var cmd = ctx.Connection.CreateCommand())
                {
                    cmd.CommandText = string.Format(@"
                            SELECT b.bill,b.billtype,b.billno,b.billdate,b.consignee,b.billingaddress,
	                            c.contact AS {0}contact,c.code AS {0}code,c.name AS {0}name,
	                            v.contact AS {1}contact,v.code AS {1}code,v.name AS {1}name,
	                            b.billofladingno,b.voyageno,b.wtaxrate,b.totalbill,b.duedate,b.status,
	                            billofladingno,b.createdby,b.datecreated,b.updatedby,b.dateupdated,b.isincludebank
                            FROM bill b
                            LEFT JOIN contact c ON b.consignee = c.contact
                            LEFT JOIN contactaddress cca ON c.contact = cca.contact
                            LEFT JOIN contact v ON b.vessel = v.contact
                            LEFT JOIN contactaddress vca ON v.contact = vca.contact
                            WHERE b.bill = @id", _Consignee.Name, _Vessel.Name);
                    cmd.Parameters.AddWithValue("@id", id);
                    using (var dr = new SafeDataReader(cmd.ExecuteReader()))
                    {
                        if (dr.Read())
                        {
                            LoadProperty(_Id, dr.GetInt32("bill"));
                            LoadProperty(_BillType, dr.GetInt32("billtype"));
                            LoadProperty(_BillNo, dr.GetString("billno"));
                            LoadProperty(_BillDate, dr.GetSmartDate("billdate"));
                            LoadProperty(_Consignee, BaseContactInfo.Get(dr, _Consignee.Name));
                            LoadProperty(_BillingAddress, dr.GetString("billingaddress"));
                            LoadProperty(_Vessel, BaseContactInfo.Get(dr, _Vessel.Name));
                            LoadProperty(_BillOfLadingNo, dr.GetString("BillOfLadingNo"));
                            LoadProperty(_VoyageNo, dr.GetString("voyageno"));
                            LoadProperty(_WTaxRate, dr.GetDecimal("wtaxrate"));
                            LoadProperty(_TotalBill, dr.GetDecimal("totalbill"));
                            LoadProperty(_DueDate, dr.GetSmartDate("duedate"));
                            LoadProperty(_Status, dr.GetInt32("status"));
                            LoadProperty(_CreatedBy, dr.GetInt32("createdby"));
                            LoadProperty(_DateCreated, dr.GetSmartDate("datecreated"));
                            LoadProperty(_UpdatedBy, dr.GetInt32("updatedby"));
                            LoadProperty(_DateUpdated, dr.GetSmartDate("dateupdated"));
                            LoadProperty(_IsIncludePayeeBankAccount, dr.GetBoolean("isincludebank"));
                        }
                    }
                }
            }
            LoadProperty(_BillItems, BillItems.Get(new SingleCriteria <int>(this.Id)));
            LoadProperty(_Payments, PaymentInfos.Get(new PaymentInfos.Criteria()
            {
                BillId = this.Id, Status = CargoConstants.PaymentStatus.Approved.Id
            }));
        }
Ejemplo n.º 2
0
        private void DataPortal_Fetch(int id)
        {
            using (var ctx = ConnectionManager <SqlConnection> .GetManager(ConfigHelper.GetDatabase(), false))
            {
                using (var cmd = ctx.Connection.CreateCommand())
                {
                    cmd.CommandText = string.Format(@"
                                  SELECT d.disbursement,d.type,d.documentno,d.documentdate, d.recipient,d.controlnumber, d.plateno,
                                    d.preparedby, d.approvedby,d.receivedby,d.createdby,d.datecreated,d.updatedby,d.dateupdated,
	                                  d.status,v.contact AS {0}contact,v.code AS {0}code,v.name AS {0}name,
                                    vt.vouchertype AS {1}vouchertype,vt.type AS {1}type,vt.name AS {1}name
                                  FROM disbursement d
                                  LEFT JOIN contact v ON d.vessel = v.contact
                                  LEFT JOIN vouchertype vt ON d.type = vt.vouchertype
                                  WHERE disbursement = @id", _Vessel.Name, _Type.Name);
                    cmd.Parameters.AddWithValue("@id", id);
                    using (var dr = new SafeDataReader(cmd.ExecuteReader()))
                    {
                        if (dr.Read())
                        {
                            LoadProperty(_Id, dr.GetInt32("disbursement"));
                            LoadProperty(_Type, dr.GetInt32("type"));
                            LoadProperty(_DocumentNo, dr.GetString("documentno"));
                            LoadProperty(_DocumentDate, dr.GetSmartDate("documentdate"));
                            LoadProperty(_Recipient, dr.GetString("recipient"));
                            LoadProperty(_ControlNumber, dr.GetInt32("controlnumber"));
                            LoadProperty(_PlateNo, dr.GetString("plateno"));
                            LoadProperty(_PreparedBy, dr.GetString("preparedby"));
                            LoadProperty(_ApprovedBy, dr.GetString("approvedby"));
                            LoadProperty(_ReceivedBy, dr.GetString("receivedby"));
                            LoadProperty(_Status, dr.GetInt32("status"));
                            LoadProperty(_CreatedBy, dr.GetInt32("createdby"));
                            LoadProperty(_DateCreated, dr.GetSmartDate("datecreated"));
                            LoadProperty(_UpdatedBy, dr.GetInt32("updatedby"));
                            LoadProperty(_DateUpdated, dr.GetSmartDate("dateupdated"));
                            LoadProperty(_Vessel, BaseContactInfo.Get(dr, _Vessel.Name));
                            LoadProperty(_Type, VoucherTypeInfo.Get(dr, _Type.Name));
                        }
                    }
                }
            }
            LoadProperty(_DisbursementItems, DisbursementItems.Get(new SingleCriteria <int>(this.Id)));
        }
Ejemplo n.º 3
0
        protected override void OnSaved()
        {
            base.OnSaved();
            BaseContactInfos.Get(new BaseContactInfos.Criteria()
            {
                Id = this.Model.Contact.Id
            }, (oo, ee) =>
            {
                if (ee.Error != null)
                {
                    throw ee.Error;
                }

                BaseContactInfo contact = null;
                if (ee.Object.Count > 0)
                {
                    contact = ee.Object[0];
                    EventAggregator.GetEvent <CommonEvents.DialogResultEvent>().Publish(contact);
                }
                this.View.Close();
            });
        }
Ejemplo n.º 4
0
        private void DataPortal_Fetch(int id)
        {
            using (var ctx = ConnectionManager <SqlConnection> .GetManager(ConfigHelper.GetDatabase(), false))
            {
                using (var cmd = ctx.Connection.CreateCommand())
                {
                    cmd.CommandText = string.Format(@"
                            SELECT p.payment,p.paymentno,p.paymentdate,p.ornumber,p.remarks,p.status,
                              p.createdby,p.datecreated,p.updatedby,p.dateupdated,
	                            c.contact AS {0}contact,c.code AS {0}code,c.name AS {0}name
                            FROM payment p
                            LEFT JOIN contact c ON p.consignee = c.contact
                            WHERE p.payment = @id", _Consignee.Name);
                    cmd.Parameters.AddWithValue("@id", id);
                    using (var dr = new SafeDataReader(cmd.ExecuteReader()))
                    {
                        if (dr.Read())
                        {
                            LoadProperty(_Id, dr.GetInt32("payment"));
                            LoadProperty(_PaymentNo, dr.GetString("paymentno"));
                            LoadProperty(_PaymentDate, dr.GetSmartDate("paymentdate"));
                            LoadProperty(_Consignee, BaseContactInfo.Get(dr, _Consignee.Name));
                            LoadProperty(_ORNumber, dr.GetString("ornumber"));
                            LoadProperty(_Remarks, dr.GetString("remarks"));
                            LoadProperty(_Status, dr.GetInt32("status"));
                            LoadProperty(_CreatedBy, dr.GetInt32("createdby"));
                            LoadProperty(_DateCreated, dr.GetSmartDate("datecreated"));
                            LoadProperty(_UpdatedBy, dr.GetInt32("updatedby"));
                            LoadProperty(_DateUpdated, dr.GetSmartDate("dateupdated"));
                        }
                    }
                }
            }
            LoadProperty(_PaymentDetails, PaymentDetails.Get(new SingleCriteria <int>(this.Id)));
            LoadProperty(_TotalAmountPaid, this.PaymentDetails.Sum(x => x.AmountPaid));
        }