/// <summary>
            /// Initiates link up of an external user identifier with an existing customer.
            /// </summary>
            /// <param name="emailAddress">The email address where the activation token has been sent.</param>
            /// <param name="activationToken">Activation token (a GUID).</param>
            /// <param name="externalIdentityId">The external identity identifier.</param>
            /// <param name="externalIdentityIssuer">The external identity issuer.</param>
            /// <param name="customerId">The identifier for existing customer.</param>
            /// <returns>Result for linking external identity to an existing customer.</returns>
            public LinkToExistingCustomerResult InitiateLinkToExistingCustomer(string emailAddress, string activationToken, string externalIdentityId, string externalIdentityIssuer, string customerId)
            {
                CustomerDataManager dataManager = this.GetDataManagerInstance();

                return(dataManager.InitiateLinkToExistingCustomer(emailAddress, activationToken, externalIdentityId, externalIdentityIssuer, customerId));
            }
            /// <summary>
            /// Unlinks the external identity from the customer account.
            /// </summary>
            /// <param name="externalIdentityId">The external identity identifier.</param>
            /// <param name="externalIdentityIssuer">The external identity issuer.</param>
            /// <param name="customerId">The customer identifier.</param>
            public void UnlinkExternalIdentityFromCustomer(string externalIdentityId, string externalIdentityIssuer, string customerId)
            {
                CustomerDataManager dataManager = this.GetDataManagerInstance();

                dataManager.UnlinkExternalIdentityFromCustomer(externalIdentityId, externalIdentityIssuer, customerId);
            }
예제 #3
0
        public static string GetCustomerImagePath(string customer)
        {
            CustomerData cust = CustomerDataManager.GetInstance().GetCustomer(customer);

            return(AppConfig.sd_path + cust.icon_texture);
        }
 public static void UpdateCustomer(Customer cust)
 {
     CustomerDataManager.UpdateCustomer(CustomerMap.reMapCustData(cust));
 }
예제 #5
0
        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;
        }
예제 #6
0
        protected override ShipmentModel PopulateModel(ShipmentModel model)
        {
            model.DateProcess = tbxDate.DateTime;
            model.BranchId    = BaseControl.BranchId;
            model.AutoNumber  = true;

            model.NeedRa = cbxRa.Checked;

            model.CityId   = BaseControl.CityId;
            model.CityName = BaseControl.CityName;

            if (lkpDestination.Value == null)
            {
                throw new BusinessException("");
            }

            model.DestCityId = (int)lkpDestination.Value;
            model.DestCity   = lkpDestination.Text;

            using (var dm = new CityDataManager())
            {
                var city = dm.GetFirst <CityModel>(WhereTerm.Default(model.DestCityId, "id"));
                if (city != null)
                {
                    model.DestBranchId  = city.BranchId;
                    model.DestCountryId = city.CountryId;
                    model.DestCity      = city.Name;

                    var destBranch =
                        new BranchDataManager().GetFirst <BranchModel>(WhereTerm.Default(city.BranchId, "id",
                                                                                         EnumSqlOperator.Equals));

                    if (destBranch != null)
                    {
                        model.DestBranchName = destBranch.Name;
                    }
                }
                else
                {
                    model.DestBranchId  = 0;
                    model.DestCountryId = 0;
                }
            }

            model.CustomerId = BaseControl.CorporateId;
            Customer         =
                new CustomerDataManager().GetFirst <CustomerModel>(WhereTerm.Default((int)model.CustomerId, "id"));
            model.CustomerName = Customer.Name;

            model.ShipperName    = Customer.Name;
            model.ShipperAddress = Customer.Address;
            model.ShipperPhone   = Customer.Phone;
            model.RefNumber      = string.Empty;

            model.ConsigneeName    = tbxConsigneeName.Text;
            model.ConsigneeAddress = tbxConsigneeAddress.Text;
            model.ConsigneePhone   = tbxConsigneePhone.Text;

            if (lkpPackage.Value == null)
            {
                throw new BusinessException("");
            }
            model.PackageTypeId = (int)lkpPackage.Value;
            model.PackageType   = lkpPackage.Text;

            if (lkpService.Value == null)
            {
                throw new BusinessException("");
            }
            model.ServiceTypeId = (int)lkpService.Value;

            if (lkpPayment.Value == null)
            {
                throw new BusinessException("");
            }
            model.PaymentMethodId = (int)lkpPayment.Value;
            model.PaymentMethod   = lkpPayment.Text;

            model.NatureOfGoods = tbxNatureOfGood.Text;
            model.Note          = tbxNote.Text;

            model.TtlPiece            = Convert.ToInt16(tbxTtlPiece.Value);
            model.TtlGrossWeight      = tbxTtlGrossWeight.Value;
            model.TtlChargeableWeight = tbxTtlChargeable.Value;

            model.Tariff           = tbxTariff.Value;
            model.HandlingFeeTotal = tbxHandlingFee.Value;
            model.TariffTotal      = tbxTtlTariff.Value;
            model.DiscountPercent  = 0;
            model.DiscountTotal    = 0;
            model.TariffNet        = tbxTariffNet.Value;

            model.PackingFee   = tbxPacking.Value;
            model.OtherFee     = tbxOther.Value;
            model.GoodsValue   = tbxGoodsValue.Value;
            model.InsuranceFee = tbxInsurance.Value;

            model.Total = tbxGrandTotal.Value;

            model.SalesTypeId = 1;

            if (CurrentModel.Id == 0)
            {
                model.PODStatus        = (int)EnumPodStatus.None;
                model.CreatedPc        = Environment.MachineName;
                model.Code             = new ShipmentDataManager().GenerateCorporatePODCode(model);
                model.TrackingStatusId = (int)EnumTrackingStatus.CorporateDataEntry;
            }

            return(model);
        }
예제 #7
0
        private IEnumerable <ShipmentModel.ShipmentReportRow> GetPrintDataSource()
        {
            var model = ConvertModel <ShipmentModel, ShipmentModel.ShipmentReportRow>(CurrentModel as ShipmentModel);

            if (model == null)
            {
                return(null);
            }

            using (var customerDm = new CustomerDataManager())
            {
                var customer = customerDm.GetFirst <CustomerModel>(WhereTerm.Default(model.CustomerId ?? 0, "id"));
                if (customer != null)
                {
                    model.CustomerCode = customer.Code;
                }
            }

            using (var serviceTypeDm = new ServiceTypeDataManager())
            {
                var serviceType = serviceTypeDm.GetFirst <ServiceTypeModel>(WhereTerm.Default(model.ServiceTypeId, "id"));
                if (serviceType != null)
                {
                    model.ServiceType = serviceType.Name;
                }
            }

            using (var employeeDm = new EmployeeDataManager())
            {
                var employee = employeeDm.GetFirst <EmployeeModel>(WhereTerm.Default(model.MessengerId ?? 0, "id"));
                if (employee != null)
                {
                    model.MessengerCode = employee.Code;
                }
            }

            using (var paymentMethodDm = new PaymentMethodDataManager())
            {
                var paymentMethod = paymentMethodDm.GetFirst <PaymentMethodModel>(WhereTerm.Default(model.PaymentMethodId, "id"));
                if (paymentMethod != null)
                {
                    model.PaymentMethod = paymentMethod.Name;
                }
            }

            using (var branchDm = new BranchDataManager())
            {
                var branch = branchDm.GetFirst <BranchModel>(WhereTerm.Default(model.BranchId, "id"));
                if (branch != null)
                {
                    model.ShipmentHeader = branch.HeaderShipment;
                }
            }

            using (var packageDm = new PackageTypeDataManager())
            {
                var package = packageDm.GetFirst <PackageTypeModel>(WhereTerm.Default(model.PackageTypeId, "id"));
                if (package != null)
                {
                    model.PackageType = package.Name;
                }
            }

            return(new List <ShipmentModel.ShipmentReportRow>
            {
                model
            });
        }
예제 #8
0
        protected override void PopulateForm(ShipmentModel model)
        {
            tbxSearch_Code.Text = model.Code;

            tbxDate.Text        = model.DateProcess.ToString("dd-MM-yyyy");
            tbxOrigin.Text      = model.CityName;
            tbxDestination.Text = model.DestCity;

            using (var customerDataManager = new CustomerDataManager())
            {
                var i =
                    customerDataManager.GetFirst <CustomerModel>(WhereTerm.Default(model.CustomerId ?? 0, "id",
                                                                                   EnumSqlOperator.Equals));
                tbxCustomerCode.Text = (i != null) ? i.Code : "";
            }

            tbxCustomer.Text = model.CustomerName;

            tbxName.Text    = model.ShipperName;
            tbxAddress.Text = model.ShipperAddress;
            tbxPhone.Text   = model.ShipperPhone;

            tbxConsigneeName.Text    = model.ConsigneeName;
            tbxConsigneeAddress.Text = model.ConsigneeAddress;
            tbxConsigneePhone.Text   = model.ConsigneePhone;

            using (var packageTypeDataManager = new PackageTypeDataManager())
            {
                var i = packageTypeDataManager.GetFirst <PackageTypeModel>(WhereTerm.Default(model.PackageTypeId, "id", EnumSqlOperator.Equals));
                tbxPackage.Text = (i != null) ? i.Name : "";
            }

            using (var serviceTypeDataManager = new ServiceTypeDataManager())
            {
                var i = serviceTypeDataManager.GetFirst <ServiceTypeModel>(WhereTerm.Default(model.ServiceTypeId, "id", EnumSqlOperator.Equals));
                tbxService.Text = (i != null) ? i.Name : "";
            }

            using (var paymentMethodDataManager = new PaymentMethodDataManager())
            {
                var i =
                    paymentMethodDataManager.GetFirst <PaymentMethodModel>(WhereTerm.Default(model.PaymentMethodId, "id",
                                                                                             EnumSqlOperator.Equals));
                tbxPayment.Text = (i != null) ? i.Name : "";
            }
            tbxNatureOfGood.Text = model.NatureOfGoods;

            tbxTtlPiece.Value      = model.TtlPiece;
            tbxTtlWeight.Value     = model.TtlGrossWeight;
            tbxTtlChargeable.Value = model.TtlChargeableWeight;

            tbxDate.Enabled        = false;
            tbxOrigin.Enabled      = false;
            tbxDestination.Enabled = false;

            tbxTtlPiece.Enabled      = false;
            tbxTtlWeight.Enabled     = false;
            tbxTtlChargeable.Enabled = false;

            _SetControlEnableState(pnlShipperInformation, false);
            _SetControlEnableState(pnlConsigneeInformation, false);
            _SetControlEnableState(pnlOtherInformation, false);

            rbData_New.Enabled    = false;
            rbData_Save.Enabled   = false;
            rbData_Delete.Enabled = false;

            RefreshGrid();
            tbxSearch_Code.Focus();
        }
예제 #9
0
        private void Print(object sender, ItemClickEventArgs e)
        {
            var print = new PickupPrint();

            using (var printTool = new ReportPrintTool(print))
            {
                var ds = new CorporatePickupDetailDataManager().GetPickupDetailPrint(CurrentModel.Id);
                print.DataSource = ds;
                var model    = CurrentModel as CorporatePickupModel;
                var curModel = new CorporatePickupDataManager().GetFirst <CorporatePickupModel>(WhereTerm.Default(CurrentModel.Id, "id"));
                if (curModel != null)
                {
                    if (!curModel.IsPrint)
                    {
                        foreach (var obj in ds)
                        {
                            InsertTracking                  = true;
                            PodStatusModel.ShipmentId       = obj.ShipmentId;
                            PodStatusModel.TrackingStatusId = (int)EnumTrackingStatus.Pickup;
                            PodStatusModel.EmployeeId       = model.MessengerId;
                            FormTrackingStatus              = EnumTrackingStatus.Pickup;
                            PodStatusModel.PositionStatusId = BaseControl.BranchId;
                            PodStatusModel.PositionStatus   = EnumPositionStatus.Agent.ToString();

                            ShipmentStatusUpdate();
                        }
                    }

                    curModel.IsPrint      = true;
                    curModel.ModifiedPc   = Environment.MachineName;
                    curModel.Modifiedby   = BaseControl.UserLogin;
                    curModel.Modifieddate = DateTime.Now;

                    new CorporatePickupDataManager().Update <CorporatePickupModel>(curModel);
                }

                print.RequestParameters = false;
                print.Parameters.Add(new Parameter
                {
                    Name    = "Code",
                    Value   = ((CorporatePickupModel)CurrentModel).Code,
                    Visible = false
                });

                print.Parameters.Add(new Parameter
                {
                    Name    = "DateProcess",
                    Value   = ((CorporatePickupModel)CurrentModel).DateProcess,
                    Visible = false
                });

                var customer = new CustomerDataManager().GetFirst <CustomerModel>(WhereTerm.Default(BaseControl.CorporateId, "id", EnumSqlOperator.Equals));
                print.Parameters.Add(new Parameter
                {
                    Name    = "CorporateName",
                    Value   = string.Format("{0} {1}", customer.Code, customer.Name),
                    Visible = false
                });

                print.Parameters.Add(new Parameter
                {
                    Name    = "Printed",
                    Value   = string.Format("{0} {1}", BaseControl.UserLogin, DateTime.Now.ToString("d-MMM-yyyy HH:mm")),
                    Visible = false
                });

                print.CreateDocument();

                printTool.PrintingSystem.StartPrint += (o, args) =>
                {
                    args.PrintDocument.PrinterSettings.PrinterName = BaseControl.PrinterSetting.InkJet;
                };
                printTool.Print();
            }
        }
예제 #10
0
        protected override DataTable GetData()
        {
            var dt = CustomerDataManager.Search(oSearchFilter.SearchParameters, SessionVariables.RequestProfile);

            return(dt);
        }
예제 #11
0
        protected override void PopulateForm(ShipmentModel model)
        {
            LastCustomerId = model.CustomerId ?? 0;

            cbxRa.Checked = model.NeedRa;

            tbxDate.DateTime    = model.DateProcess;
            tbxNo.Text          = model.Code;
            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") };

            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;
            tbxDiscount.Value    = model.DiscountPercent;
            tbxTtlDiscount.Value = model.DiscountTotal;
            tbxTariffNet.Value   = model.TariffNet;

            tbxOther.Value      = model.OtherFee;
            tbxGoodsValue.Value = model.GoodsValue;
            tbxInsurance.Value  = model.InsuranceFee;

            tbxDiscount.Enabled = !lkpService.Text.ToUpper().Equals("CITY COURIER");

            tbxGlobalTotal.Value = model.Total;

            tbxTtlDiscount.Value = model.DiscountTotal;
            rbPod_Void.Enabled   = true;

            EnabledForm(false);

            if (model.Voided)
            {
                MessageBox.Show(@"POD sudah di-VOID!");

                rbPod_Void.Enabled = false;
                EnabledForm(false);

                tbxDiscount.Enabled = false;
            }
        }