protected virtual void SaveExpand(ShipmentExpandModel expandModel) { var expand = new ShipmentExpandDataManager().GetFirst <ShipmentExpandModel>(WhereTerm.Default(CurrentModel.Id, "shipment_id")); if (expand != null) { new ShipmentExpandDataManager().Update <ShipmentExpandModel>(expandModel); } else { new ShipmentExpandDataManager().Save <ShipmentExpandModel>(expandModel); } }
protected override void AfterSave() { //base.AfterSave(); tbxSearch_Code.Focus(); PodStatusModel.ShipmentId = CurrentModel.Id; PodStatusModel.PositionStatusId = BaseControl.BranchId; PodStatusModel.PositionStatus = EnumPositionStatus.Agent.ToString(); ShipmentStatusUpdate(); var model = CurrentModel as ShipmentModel; if (model == null) { return; } var expand = new ShipmentExpandDataManager().GetFirst <ShipmentExpandModel>(WhereTerm.Default(CurrentModel.Id, "shipment_id")); if (expand != null) { expand.VolumeL = tbxL.Value; expand.VolumeW = tbxW.Value; expand.VolumeH = tbxH.Value; expand.UsePacking = cbxPacking.Checked; expand.IsCod = false; expand.TotalCod = 0; new ShipmentExpandDataManager().Update <ShipmentExpandModel>(expand); } else { expand.ShipmentId = CurrentModel.Id; expand.VolumeL = tbxL.Value; expand.VolumeW = tbxW.Value; expand.VolumeH = tbxH.Value; expand.UsePacking = cbxPacking.Checked; expand.IsCod = false; expand.TotalCod = 0; new ShipmentExpandDataManager().Save <ShipmentExpandModel>(expand); } tbxSearch_Code.Text = model.Code; PerformFind(); }
protected override void PopulateForm(ShipmentModel model) { LastCustomerId = model.CustomerId ?? 0; cbxRa.Checked = model.NeedRa; tbxDate.DateTime = model.DateProcess; tbxSearch_Code.Text = model.Code; if (model.CustomerId != null) { Customer = new CustomerDataManager().GetFirst <CustomerModel>(WhereTerm.Default((int)model.CustomerId, "id")); lkpConsignee.DefaultValue = new IListParameter[] { WhereTerm.Default(Customer.Id, "id") }; } lkpDestination.DefaultValue = new IListParameter[] { WhereTerm.Default(model.DestCityId, "id") }; tbxConsigneeName.Text = model.ConsigneeName; tbxConsigneeAddress.Text = model.ConsigneeAddress; tbxConsigneePhone.Text = model.ConsigneePhone; lkpPackage.DefaultValue = new IListParameter[] { WhereTerm.Default(model.PackageTypeId, "id") }; lkpService.DefaultValue = new IListParameter[] { WhereTerm.Default(model.ServiceTypeId, "id") }; lkpPayment.DefaultValue = new IListParameter[] { WhereTerm.Default(model.PaymentMethodId, "id") }; var service = new ServiceDataManager().GetFirst <ServiceTypeModel>(WhereTerm.Default(model.ServiceTypeId, "id")); if (service.Name == "DARAT") { MinWeight = 10; } if (service.Name == "LAUT") { MinWeight = 30; } tbxNatureOfGood.Text = model.NatureOfGoods; tbxNote.Text = model.Note; tbxTtlPiece.Value = model.TtlPiece; tbxTtlGrossWeight.Value = model.TtlGrossWeight; tbxTtlChargeable.Value = model.TtlChargeableWeight; tbxTariff.Value = model.Tariff; tbxHandlingFee.Value = model.HandlingFee; tbxTtlTariff.Value = model.TariffTotal; tbxTariffNet.Value = model.TariffNet; tbxOther.Value = model.OtherFee; tbxGoodsValue.Value = model.GoodsValue; tbxPacking.Value = model.PackingFee; tbxInsurance.Value = model.InsuranceFee; tbxGrandTotal.Value = model.Total; var expand = new ShipmentExpandDataManager().GetFirst <ShipmentExpandModel>(WhereTerm.Default(model.Id, "shipment_id")); if (expand != null) { tbxL.Value = expand.VolumeL; tbxW.Value = expand.VolumeW; tbxH.Value = expand.VolumeH; cbxPacking.Checked = expand.UsePacking; } rbPod_Void.Enabled = true; EnabledForm(true); if (model.Voided) { MessageBox.Show(@"POD sudah di-VOID!"); rbPod_Void.Enabled = false; EnabledForm(false); } if (model.Posted || (DateTime.Now - model.DateProcess).TotalDays > 0 || model.Voided || model.TrackingStatusId != (int)EnumTrackingStatus.CorporateDataEntry) { rbPod_Void.Enabled = false; EnabledForm(false); } tbxTtlChargeable.Enabled = false; tbxPacking.Enabled = false; }