public ActionResult AddClientPrivateLabel(ClientPrivateLabel _ClientPrivateLabel)
        {
            try
            {
                if (_ClientPrivateLabel.ClientPrivateLabelLogo != null)
                {
                    _ClientPrivateLabel.ClientPrivateLabelLogoName = GlobalConst.VirtualPathFolders.ClientPrivateLableLogo + Path.GetExtension(_ClientPrivateLabel.ClientPrivateLabelLogo.FileName);
                }

                string[] _ids = new string[2];
                if (_ClientPrivateLabel.ClientPrivateLabelID > 0)
                {
                    _ids[0] = "Update";

                    if (_ClientPrivateLabel.ClientPrivateLabelLogoName != null)
                    {
                        _ClientPrivateLabel.ClientPrivateLabelLogoName = Path.GetFileName(_ClientPrivateLabel.ClientPrivateLabelLogoName);
                    }

                    _iClientService.updateClientPrivateLabel(Mapper.Map <MMC.MMCService.ClientService.ClientPrivateLabel>(_ClientPrivateLabel));
                    _ids[1] = _ClientPrivateLabel.ClientPrivateLabelID.ToString();
                    if (_ClientPrivateLabel.ClientPrivateLabelLogo != null)
                    {
                        StorageService _storageService;
                        _storageService = new StorageService();
                        var path = _storageService.GeneateStorageByStoragePath(Server.MapPath(System.Configuration.ConfigurationManager.AppSettings[GlobalConst.VirtualDirectoryPath.VirtualPath].ToString()) + GlobalConst.ConstantChar.DoubleBackSlash + _ClientPrivateLabel.ClientID.ToString() + GlobalConst.ConstantChar.DoubleBackSlash + GlobalConst.VirtualPathFolders.ClientPrivateLableLogo) + GlobalConst.ConstantChar.DoubleBackSlash + _ClientPrivateLabel.ClientPrivateLabelLogoName;
                        if ((System.IO.File.Exists(path)))
                        {
                            System.IO.File.Delete(path);
                        }
                        _ClientPrivateLabel.ClientPrivateLabelLogo.SaveAs(path);
                    }
                }
                else
                {
                    _ids[0] = "Add";
                    _ClientPrivateLabel.ClientPrivateLabelID = _iClientService.addClientPrivateLabel(Mapper.Map <MMC.MMCService.ClientService.ClientPrivateLabel>(_ClientPrivateLabel));
                    if (_ClientPrivateLabel.ClientPrivateLabelLogo != null)
                    {
                        StorageService _storageService;
                        _storageService = new StorageService();
                        var path = _storageService.GeneateStorageByStoragePath(Server.MapPath(System.Configuration.ConfigurationManager.AppSettings[GlobalConst.VirtualDirectoryPath.VirtualPath].ToString()) + GlobalConst.ConstantChar.DoubleBackSlash + _ClientPrivateLabel.ClientID.ToString() + GlobalConst.ConstantChar.DoubleBackSlash + GlobalConst.VirtualPathFolders.ClientPrivateLableLogo) + GlobalConst.ConstantChar.DoubleBackSlash + _ClientPrivateLabel.ClientPrivateLabelLogoName;
                        _ClientPrivateLabel.ClientPrivateLabelLogo.SaveAs(path);
                    }

                    _ids[1] = _ClientPrivateLabel.ClientPrivateLabelID.ToString();
                }
                return(Json(_ids, GlobalConst.ContentTypes.TextHtml, JsonRequestBehavior.AllowGet));
            }
            catch
            {
                return(Json("0"));
            }
        }
Exemple #2
0
        public void addClientPrivateLabel()
        {
            ClientPrivateLabel _clientPrivateLabel = new ClientPrivateLabel
            {
                ClientID = 27,
                ClientPrivateLabelAddress  = "ClientPrivateLabelAddress",
                ClientPrivateLabelCity     = "ClientPrivateLabelCity",
                ClientPrivateLabelName     = "ClientPrivateLabelName",
                ClientPrivateLabelStateID  = 1,
                ClientPrivateLabelZip      = "12345-6789",
                ClientPrivateLabelLogoName = "ClientPrivateLabelLogo.jpg",
                ClientPrivateLabelPhone    = "(321)654-6541",
                ClientPrivateLabelFax      = "(321)654-9874"
            };
            var _id = _clientRepository.addClientPrivateLabel(_clientPrivateLabel);

            Assert.IsTrue(_id > 0, "failed");
        }
 public int updateClientPrivateLabel(ClientPrivateLabel _clientPrivateLabel)
 {
     return(_clientPrivateLabelRepo.Update(_clientPrivateLabel));
 }
 public int updateClientPrivateLabel(ClientPrivateLabel _clientPrivateLabel)
 {
     return(_clientRepository.updateClientPrivateLabel(Mapper.Map <DTO.ClientPrivateLabel, MMC.Core.Data.Model.ClientPrivateLabel>(_clientPrivateLabel)));
 }
 public int addClientPrivateLabel(ClientPrivateLabel _clientPrivateLabel)
 {
     return(_clientPrivateLabelRepo.Add(_clientPrivateLabel).ClientPrivateLabelID);
 }