Esempio n. 1
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            PartnerModel clientNou = new PartnerModel();

            clientNou.ClientId  = this.client.ClientId;
            clientNou.Nume      = tbNume.Text;
            clientNou.Prenume   = tbPrenume.Text;
            clientNou.CodClient = tbCod.Text;
            clientNou.Telefon   = tbTelefon.Text;
            clientNou.Email     = tbEmail.Text;
            BLClients    blClient     = new BLClients();
            DialogResult dialogResult = MessageBox.Show("Sigur doriti sa modificati datele clientului?", "Adresa Client", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                blClient.UpdateClient(clientNou, out string message);
                MessageBox.Show(message, "Status", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                form.initializareDataGridView();
                this.Close();
            }
            else if (dialogResult == DialogResult.No)
            {
                this.Hide();
            }
        }
Esempio n. 2
0
        public async Task <ErrorCodeLib.Models.ResultModel> Create([FromBody] ProjectModel model)
        {
            var result = new ErrorCodeLib.Models.ResultModel();

            model.created = DateTime.Now;
            //檢查partner
            var exist_partner = new PartnerModel();

            if (!string.IsNullOrEmpty(model.partner_id))
            {
                string[] partner_id_arr = model.partner_id.Split(",");
                foreach (var i in partner_id_arr)
                {
                    try
                    {
                        exist_partner = _repo_partner.FindById(Convert.ToInt32(i));
                    }
                    catch (Exception e)
                    {
                        result = ErrorCode.PARAMETER_INVALID(null, "partner_id", "cht");
                        return(result);
                    }
                    if (exist_partner == null)
                    {
                        result = ErrorCode.DB_ERROR_NOT_FOUND(null, "partner_id", "cht");
                        return(result);
                    }
                }
            }
            result = _repo_project.Create(model);

            return(result);
        }
Esempio n. 3
0
 private void BtnAdresa_Click(object sender, EventArgs e)
 {
     if (filled)
     {
         if (dataGridViewClienti.SelectedRows.Count > 0)
         {
             PartnerModel client = new PartnerModel();
             foreach (DataGridViewRow row in dataGridViewClienti.SelectedRows)
             {
                 client.ClientId  = Convert.ToInt32(row.Cells[0].Value.ToString());
                 client.Nume      = row.Cells[1].Value.ToString();
                 client.Prenume   = row.Cells[2].Value.ToString();
                 client.CodClient = row.Cells[3].Value.ToString();
                 client.Telefon   = row.Cells[4].Value.ToString();
                 client.Email     = row.Cells[5].Value.ToString();
                 AddressModel adresa = new AddressModel();
                 adresa.PartnerId = Convert.ToInt32(Convert.ToInt32(row.Cells[0].Value.ToString()));
                 EditClientAddressForm form = new EditClientAddressForm(adresa, client);
                 form.Show();
             }
         }
         else
         {
             MessageBox.Show("Selectati clientul pentru a vedea adresele!", "Status", MessageBoxButtons.OK,
                             MessageBoxIcon.Information);
         }
     }
     else
     {
         MessageBox.Show("Lista clieti goala! Efectuati o cautare!", "Status", MessageBoxButtons.OK,
                         MessageBoxIcon.Information);
     }
 }
        public ActionResult Create()
        {
            WorkContext.Breadcrumbs.Add(new Breadcrumb {
                Text = T("Quản lý đối tác"), Url = "#"
            });
            WorkContext.Breadcrumbs.Add(new Breadcrumb {
                Text = T("Thêm thông tin đối tác"), Url = Url.Action("Index")
            });
            var model = new PartnerModel();

            var result = new ControlFormResult <PartnerModel>(model);

            result.Title                = this.T("Thêm thông tin đối tác");
            result.FormMethod           = FormMethod.Post;
            result.UpdateActionName     = "Update";
            result.ShowCancelButton     = false;
            result.ShowBoxHeader        = false;
            result.FormWrapperStartHtml = Constants.Form.FormWrapperStartHtml;
            result.FormWrapperEndHtml   = Constants.Form.FormWrapperEndHtml;

            result.RegisterFileUploadOptions("Logo.FileName", new ControlFileUploadOptions
            {
                AllowedExtensions = "jpg,jpeg,png,gif"
            });

            result.AddAction().HasText(this.T("Thêm mới")).HasUrl(this.Url.Action("Create")).HasButtonStyle(ButtonStyle.Success);
            result.AddAction().HasText(this.T("Back")).HasUrl(this.Url.Action("Index")).HasButtonStyle(ButtonStyle.Danger);
            return(result);
        }
Esempio n. 5
0
 private void ModificareClientToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (filled)
     {
         if (dataGridViewClienti.SelectedRows.Count > 0)
         {
             PartnerModel client = new PartnerModel();
             foreach (DataGridViewRow row in dataGridViewClienti.SelectedRows)
             {
                 client.ClientId  = Convert.ToInt32(row.Cells[0].Value.ToString());
                 client.Nume      = row.Cells[1].Value.ToString();
                 client.Prenume   = row.Cells[2].Value.ToString();
                 client.CodClient = row.Cells[3].Value.ToString();
                 client.Telefon   = row.Cells[4].Value.ToString();
                 client.Email     = row.Cells[5].Value.ToString();
             }
             EditClientForm form = new EditClientForm(client, this);
             form.Show();
         }
         else
         {
             MessageBox.Show("Selectati un client pentru editare!", "Status", MessageBoxButtons.OK,
                             MessageBoxIcon.Information);
         }
     }
     else
     {
         MessageBox.Show("Lista clieti goala! Efectuati o cautare!", "Status", MessageBoxButtons.OK,
                         MessageBoxIcon.Information);
     }
 }
        private static PartnerModel FromBranchToPartnerModel(Branch branch, CategoryModel[] categories)
        {
            var partner = new PartnerModel
            {
                Name_Ru        = GetValue(branch.Name, Languages.Ru),
                Name_En        = GetValue(branch.Name, Languages.En),
                Description_Ru = GetValue(branch.Description, Languages.Ru),
                Description_En = GetValue(branch.Description, Languages.En),
                Comment        = branch.Comment,
                Image          = branch.Image,
                Logo           = branch.Icon,
                Id             = branch.PartnerId,
                Discount       = GetDiscount(branch.Discounts),
                SelectDiscount = branch.Discounts?.FirstOrDefault()?.DiscountType
            };

            var categoriesList = new List <CategoryModel>();

            foreach (var id in branch.CategoryIds)
            {
                var category = categories.FirstOrDefault(x => x.Id == id);
                if (category != null)
                {
                    categoriesList.Add(category);
                }
            }
            partner.Categories   = categoriesList;
            partner.WebAddresses = WebAddressMapper.MapToWebAddressModels(branch.WebAddresses);
            return(partner);
        }
        public static PartnerModel Map(List <Branch> branches, CategoryModel[] categories)
        {
            var partner = new PartnerModel {
                Contacts = new List <ContactModel>()
            };

            if (branches == null || branches.Count == 0)
            {
                return(partner);
            }

            if (categories == null)
            {
                categories = new CategoryModel[0];
            }

            var contacts = new List <ContactModel>();

            partner = FromBranchToPartnerModel(branches.First(), categories);

            for (var i = 0; i < branches.Count; i++)
            {
                var branch = branches[i];

                var coordinates = MapGeoJsonToString(branch);
                var contact     = ContactMapper.MapToContactModels(branch.Address, branch.Phones, coordinates, branch.Id);
                contacts.Add(contact);
            }

            partner.Contacts = contacts;
            return(partner);
        }
        public async Task <HttpResponseMessage> SavePartnerAsync([FromBody] PartnerModel partner)
        {
            var branches        = Mapper.PartnerMapper.MapToBranches(partner);
            var partnerBranches = await _partnerApplicationService.GetPartnerDetailsAsync(partner.Id);

            var newPartner = new Branch();

            newPartner = branches.ElementAt(0).PartnerId != null?branches.First(x => x.Id == x.PartnerId) : branches.ElementAt(0);

            var partnerFirst = await _partnerApplicationService.UpsertPartnerAsync(newPartner);

            foreach (var branch in branches)
            {
                branch.PartnerId = partnerFirst.PartnerId;
                var qwerty = await _partnerApplicationService.UpsertBranchAsync(branch);
            }
            foreach (var branch in partnerBranches)
            {
                if (branches.FirstOrDefault(x => x?.Id == branch.Id) == null)
                {
                    await _partnerApplicationService.DeleteBranchAsync(branch.Id);
                }
            }

            return(new HttpResponseMessage(HttpStatusCode.OK));
        }
Esempio n. 9
0
        public int InsertPartners(PartnerModel Partner)
        {
            try
            {
                using (var query = new SqlQuery())
                {
                    var result = query.ExecuteNonQuery("InsertUpdatePartners", new Dictionary <string, object>
                    {
                        { "PartnerId", Partner.PartnerId },
                        { "PartnerName", Partner.PartnerName },
                        { "ContactNo", Partner.ContactNo },
                        { "Email", Partner.Email },
                        { "Address", Partner.Address },


                        { "IsActive", Partner.IsActive }
                    });
                    return(result);
                }
            }
            catch (Exception ex)
            {
                //Logger.LogError("Admin:Login", ex.Message);
                string msg = ex.ToString();
                throw;
            }
        }
Esempio n. 10
0
        private void ExecuteSelect(PartnerModel partner)
        {
            try
            {
                var name       = partner.Name;
                var startIndex = name.IndexOf(" ", StringComparison.InvariantCulture) + 1;
                SearchText = name.Substring(0, name.IndexOf(" ", startIndex, StringComparison.InvariantCulture));
                SunCustomers.Clear();
                SunCustomers = new ObservableCollection <SunSystemCustomer>(_sunCustomerCollection
                                                                            .Where(x => x.VatCode.Trim() == partner.TaxRegistrationNo.Trim()).ToList());

                var sunCodes = SunCustomers.Select(x => x.Code.Trim()).ToArray();
                OdooCustomers =
                    new ObservableCollection <SunAccount>(_odooSunAccounts
                                                          .Where(x => sunCodes.Contains(x.SunAccountCode)).ToList());

                foreach (var customer in SunCustomers)
                {
                    if (OdooCustomers.Any(x => x.SunAccountCode == customer.Code.Trim() && x.IsProject))
                    {
                        customer.IsProject = true;
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                //throw;
            }
        }
Esempio n. 11
0
        public static PartnerModel Map(List <Branch> branches, CategoryModel[] categories, List <string> galleryImagesIds, PartnerRatingStatisticsModel rating)
        {
            var partner = new PartnerModel
            {
                Contacts = new List <ContactModel>()
            };

            if (branches == null || branches.Count == 0)
            {
                return(partner);
            }

            if (categories == null)
            {
                categories = new CategoryModel[0];
            }

            var contacts = new List <ContactModel>();

            partner = FromBranchToPartnerModel(branches.First(b => b.Id == b.PartnerId), categories);
            foreach (var branch in branches)
            {
                var coordinates = MapGeoJsonToString(branch);
                var contact     = ContactMapper.MapToContactModels(branch.Address, branch.Phones, coordinates, branch.Id);
                contacts.Add(contact);
            }

            partner.Contacts = contacts;
            partner.Gallery  = galleryImagesIds;
            partner.Rating   = rating;

            return(partner);
        }
Esempio n. 12
0
        public IActionResult Post([FromBody] PartnerModel partner)
        {
            if (partner.Email == null)
            {
                return(Ok(new { success = false }));
            }
            PartnerModel user = db.Partners.FirstOrDefault(x => x.Email == partner.Email);

            return(Ok(new
            {
                user.Id,
                user.TypeClient,
                user.OGRN,
                user.KPP,
                user.Email,
                user.Position,
                user.CorrespondentAccount,
                user.SeriesAndNumberCertificate,
                user.INN,
                user.ActingBasis,
                user.NameOrganization,
                user.OGRNIP,
                user.LegalAddress,
                user.ActualAddress,
                user.PhoneNumber,
                user.CheckingAccount,
                user.BankName,
                user.BIK,
                user.Fio,
                user.DateOfIssueCertificate
            }));
        }
Esempio n. 13
0
        public ActionResult EliminarConfirmed(string id)
        {
            PartnerModel partner = _partnerRepository.ObtenerPartnerPorId(id);

            partner.Estado    = "Baja";
            partner.FechaBaja = DateTime.Today.ToLongDateString();

            _partnerRepository.Actualizar(partner);

            //var direcciones = _direccionRepository.ObtenerTodaslasDireccionesPorIdPartner(id);
            //if (direcciones != null)
            //{
            //    foreach (var dire in direcciones)
            //    {
            //        _direccionRepository.Eliminar(dire);
            //    }
            //}

            //var personasDeContacto = _personaDeContactoRepository.ObetenerPersonasDeContactoPorIdPartner(id);

            //if (personasDeContacto != null)
            //{
            //    foreach (var per in personasDeContacto)
            //    {
            //        _personaDeContactoRepository.Eliminar(per);
            //    }
            //}
            return(RedirectToAction("Index"));
        }
Esempio n. 14
0
 public EditClientForm(PartnerModel client, ClientsForm clientsForm)
 {
     InitializeComponent();
     this.client = client;
     this.form   = clientsForm;
     InitForm();
 }
Esempio n. 15
0
        public ActionResult List()
        {
            PartnerModel model = new PartnerModel();

            model.Partners = partnerServices.GetPartners();
            return(PartialView("_List", model));
        }
Esempio n. 16
0
        public long CreatePartner(PartnerModel model)
        {
            var partner = new PartnerEntity { Name = model.Name, Disabled = model.Disabled };

            this.Manager.Create(partner);

            return partner.Id;
        }
Esempio n. 17
0
        public PartnerModel GetCreateModel()
        {
            var model = new PartnerModel();

            this.FillPartnerModel(model);

            return model;
        }
Esempio n. 18
0
        // GET: Dashboard/Partner
        public ActionResult Index(string search)
        {
            PartnerModel model = new PartnerModel();

            model.Search   = search;
            model.Partners = partnerServices.SearchPartners(search);
            return(View(model));
        }
Esempio n. 19
0
        public int InsertarActualizarPartner(PartnerModel partner)
        {
            Mapper.CreateMap <PartnerModel, InsertarActualizarPartnerCommand>();
            var command = Mapper.Map <PartnerModel, InsertarActualizarPartnerCommand>(partner);
            var resp    = (InsertarActualizarPartnerOutput)command.Execute();

            return(resp.idpartner);
        }
 private ReportData CreateReportData(PartnerModel model, StructureSet structureSet)
 {
     return(new ReportData
     {
         Patient = model,
         StructureSet = structureSet
     });
 }
        public PartnerModel GetCreateModel()
        {
            var model = new PartnerModel();

            this.FillPartnerModel(model);

            return(model);
        }
Esempio n. 22
0
        public void UpdateClient(PartnerModel clientNou, out string errorMessage)
        {
            errorMessage = "OK";

            DAClients daClients = new DAClients();

            daClients.UpdateClient(clientNou);
            errorMessage = "Client modificat!";
        }
        public ActionResult CreatePartner([FromBody] PartnerModel partner)
        {
            _logger.LogInformation("Adding a new partner");

            var partnerData = PartnerMapper.SerializePartner(partner);
            var newPartner  = _partnerService.CreatePartner(partnerData);

            return(Ok(newPartner));
        }
Esempio n. 24
0
 private static void ProcessPartnerMainImages(PartnerModel partner, IImageConverter imageConverter)
 {
     partner.Image = string.IsNullOrEmpty(partner.Image)
         ? partner.Image
         : Convert.ToBase64String(imageConverter.Convert(Convert.FromBase64String(partner.Image), ImageOptions.Image));
     partner.Logo = string.IsNullOrEmpty(partner.Logo)
         ? partner.Logo
         : Convert.ToBase64String(imageConverter.Convert(Convert.FromBase64String(partner.Logo), ImageOptions.Icon));
 }
        public long CreatePartner(PartnerModel model)
        {
            var partner = new PartnerEntity {
                Name = model.Name, Disabled = model.Disabled
            };

            this.Manager.Create(partner);

            return(partner.Id);
        }
Esempio n. 26
0
        private PartnerModel GetModelPartner()
        {
            PartnerModel partnerModel = new PartnerModel();

            partnerModel.Categories = db.Categories.ToList();
            var contact = db.Contacts.OrderByDescending(x => x).FirstOrDefault();

            partnerModel.Contacts = contact == null ? new Models.Objects.Contact() : contact;
            return(partnerModel);
        }
Esempio n. 27
0
        public PartnerModel GetEditModel(long id)
        {
            var partner = this.Manager.Load(id);

            var model = new PartnerModel { PartnerId = partner.Id, Name = partner.Name, Disabled = partner.Disabled };

            this.FillPartnerModel(model);

            return model;
        }
Esempio n. 28
0
 public async Task <IActionResult> Create([Bind("Id,PartnerTypeId,Name,StartDate,EndDate")] PartnerModel partner)
 {
     if (ModelState.IsValid)
     {
         partner = _partnerFactory.CreatePartner(partner);
         return(RedirectToAction(nameof(Index)));
     }
     ViewData["PartnerTypeId"] = new SelectList(_partnerTypeFactory.GetAllPartnerTypes(), "Id", "Name", partner.PartnerTypeId);
     return(View(partner));
 }
Esempio n. 29
0
        // Metoda postavljanja varijabili koja se poziva prije unosa i izmjne podatka
        private PartnerModel SetProperties()
        {
            PartnerModel partner = new PartnerModel();

            if (!edit.NullOrWhite(txt_id))
            {
                partner.Id = Convert.ToInt32(txt_id.Text.Trim());
            }
            partner.Naziv = txt_naziv.Text.Trim();
            return(partner);
        }
Esempio n. 30
0
        private void AssignInitialValue(ManifestModel manifestModel)
        {
            try
            {
                NewBatchModel            = manifestModel?.NewBatches.FirstOrDefault();
                SizeButtonTitle          = manifestModel?.Size;
                DestinationTitle         = manifestModel?.OwnerName;
                ManifestId               = manifestModel?.ManifestId;
                ConstantManager.Barcodes = manifestModel?.BarcodeModels;

                try
                {
                    PartnerModel partner = new PartnerModel()
                    {
                        PartnerId = manifestModel?.ReceiverId,
                        FullName  = manifestModel?.OwnerName
                    };
                    ConstantManager.Partner = partner;
                    if (manifestModel.Tags != null)
                    {
                        ConstantManager.Tags = new List <Tag>();
                        foreach (var item in manifestModel.Tags)
                        {
                            ConstantManager.Tags.Add(item);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Crashes.TrackError(ex);
                }

                foreach (var item in manifestModel.NewPallets)
                {
                    PalletModel palletModel = new PalletModel
                    {
                        Count      = item.PalletItems.Count,
                        ManifestId = ManifestId,
                        BatchId    = item.PalletId
                    };
                    palletModel.Barcode = ConstantManager.Barcodes;
                    if (PalletCollection == null)
                    {
                        PalletCollection = new List <PalletModel>();
                    }
                    PalletCollection.Add(palletModel);
                    IsPalletze = item.IsPalletze;
                }
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex);
            }
        }
Esempio n. 31
0
        public static string CheckPartnerApplications(PartnerController partnerController, Partner partner, List <ACSApplicationModel> expectedACSApplicationModels)
        {
            // Get partners applications
            ViewResult viewResult = (ViewResult)partnerController.Details(partner.Id, false);

            if (viewResult.ViewData.Model.GetType() != typeof(PartnerModel))
            {
                return("PartnerController returned wrong action result. Expected: " + typeof(PartnerModel).ToString() + " Got: " + viewResult.ViewData.Model.GetType().ToString());
            }

            // Did the controller return any errors?
            if (partnerController.ViewData.ModelState.Count != 0)
            {
                return("PartnerController returned " + partnerController.ViewData.ModelState.Count.ToString()); // + " model errors: " + storeController.ViewData.ModelState[0].Errors[0]);
            }

            PartnerModel actualPartnerModel = (PartnerModel)viewResult.ViewData.Model;

            // Check that the partner has the correct applications
            foreach (ACSApplicationModel expectedACSApplicationModel in expectedACSApplicationModels)
            {
                ACSApplication foundACSApplication = null;
                foreach (ACSApplication actualACSApplication in actualPartnerModel.ACSApplications)
                {
                    if (expectedACSApplicationModel.ACSApplication.Id == actualACSApplication.Id)
                    {
                        foundACSApplication = actualACSApplication;
                        break;
                    }
                }

                if (foundACSApplication == null)
                {
                    return("PartnerController didn't return partner application " + expectedACSApplicationModel.ACSApplication.Id.ToString());
                }

                if (foundACSApplication.ExternalApplicationId != expectedACSApplicationModel.ACSApplication.ExternalApplicationId)
                {
                    return("ExternalApplicationId mismatch. Expected: " + expectedACSApplicationModel.ACSApplication.ExternalApplicationId + " Got: " + foundACSApplication.ExternalApplicationId);
                }
                if (foundACSApplication.Name != expectedACSApplicationModel.ACSApplication.Name)
                {
                    return("Name mismatch. Expected: " + expectedACSApplicationModel.ACSApplication.Name + " Got: " + foundACSApplication.Name);
                }
                if (foundACSApplication.PartnerId != expectedACSApplicationModel.ACSApplication.PartnerId)
                {
                    return("PartnerId mismatch. Expected: " + expectedACSApplicationModel.ACSApplication.PartnerId + " Got: " + foundACSApplication.PartnerId);
                }
            }

            // All good
            return("");
        }
        public PartnerModel GetEditModel(long id)
        {
            var partner = this.Manager.Load(id);

            var model = new PartnerModel {
                PartnerId = partner.Id, Name = partner.Name, Disabled = partner.Disabled
            };

            this.FillPartnerModel(model);

            return(model);
        }
Esempio n. 33
0
 public IActionResult AddPartner(PartnerModel partner)
 {
     if (ModelState.IsValid)
     {
         _hotelRepository.AddNewPartner(partner);
         return(RedirectToAction("partnerlist"));
     }
     else
     {
         return(View(partner));
     }
 }
Esempio n. 34
0
        public long UpdatePartner(PartnerModel model)
        {
            Contract.Assert(model.PartnerId.HasValue);

            var partner = this.Manager.Load(model.PartnerId.Value);

            partner.Name = model.Name;
            partner.Disabled = model.Disabled;

            using (var tx = new Transaction())
            {
                this.Manager.Update(partner);

                tx.Complete();
            }

            return partner.Id;
        }
Esempio n. 35
0
 public void FillPartnerModel(PartnerModel model)
 {
 }