Exemplo n.º 1
0
        public JsonResult DeleteFile(string file, string entitytype)
        {
            var entityTypeId = entitytype.AsInt();
            var Entitytype   = (EntityType)entityTypeId;

            switch (Entitytype)
            {
            case EntityType.None:
                break;

            case EntityType.Person:
                GetPersonnelPictureService().DeleteByImageName(Path.GetFileNameWithoutExtension(file));
                break;

            case EntityType.Company:
                GetCompanyPictureService().DeleteByImageName(Path.GetFileNameWithoutExtension(file));
                break;

            case EntityType.ZetaCodeNormalIplik:
                GetZetaCodeNormalIplikPictureService().DeleteByImageName(Path.GetFileNameWithoutExtension(file));
                break;

            default:
                break;
            }

            filesHelper.DeleteFile(file);
            UnitOfWorkAsync.SaveChanges();
            return(Json("OK", JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        private void SaveImages(List <ViewDataUploadFilesResult> resultList, FileControllerIndexViewModel model)
        {
            var entityTypeId = model.Entitytype.AsInt();
            var Entitytype   = (EntityType)entityTypeId;

            foreach (var item in resultList)
            {
                var filename = item.name;

                switch (Entitytype)
                {
                case EntityType.None:
                    break;

                case EntityType.Person:
                    GetPersonnelPictureService().Insert(new Entities.Models.PersonnelPicture
                    {
                        CompanyId   = model.CompanyId,
                        PersonnelId = model.EntityId,
                        Extension   = Path.GetExtension(filename),
                        //Id = model.ImageId.AsInt(),
                        Name      = Path.GetFileNameWithoutExtension(filename),
                        CreatedOn = DateTime.UtcNow,
                        CreatedBy = User.Identity.GetUserId()
                    });
                    break;

                case EntityType.Company:
                    GetCompanyPictureService().Insert(new Entities.Models.CompanyPicture
                    {
                        CompanyId = model.CompanyId,
                        Name      = Path.GetFileNameWithoutExtension(filename),
                        Extension = Path.GetExtension(filename),
                        //Id = model.ImageId.AsInt(),
                        CreatedOn = DateTime.UtcNow,
                        CreatedBy = User.Identity.GetUserId()
                    });
                    break;

                case EntityType.ZetaCodeNormalIplik:
                    GetZetaCodeNormalIplikPictureService().Insert(new Entities.Models.ZetaCodeNormalIplikPicture
                    {
                        CompanyId             = model.CompanyId,
                        ZetaCodeNormalIplikId = model.EntityId.AsInt(),
                        Name      = Path.GetFileNameWithoutExtension(filename),
                        Extension = Path.GetExtension(filename),
                        //Id = model.ImageId.AsInt(),
                        CreatedOn = DateTime.UtcNow,
                        CreatedBy = User.Identity.GetUserId()
                    });
                    break;

                default:
                    break;
                }
            }

            UnitOfWorkAsync.SaveChanges();
        }
        public ActionResult GetBlueCompanyData(string companyId)
        {
            MyJsonResult jsonResult = new MyJsonResult();
            var          company    = GetCompanyService().GetCompanyCodeById(companyId);

            if (company != null)
            {
                var blueSequence = new Helezon.FollowMe.Entities.Models.SequenceBlueSiparisNo();
                blueSequence.BlueCompanyId = companyId;
                GetNormalIplikService().GetSequenceBlueSiparisNo(blueSequence);
                UnitOfWorkAsync.SaveChanges();
                jsonResult.Data           = new { BlueCode = company.Code, SiparisNo = blueSequence.SiparisNo };
                jsonResult.SuccessMessage = "Sipariş No Hesaplandı";
                return(Json(jsonResult, JsonRequestBehavior.AllowGet));
            }
            jsonResult.ErrorMessage = "Şirket Bulunamadı";
            return(Json(jsonResult, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public JsonResult SetFeaturedPicture(string filename, string entitytype)
        {
            try
            {
                var entityTypeId = entitytype.AsInt();
                var Entitytype   = (EntityType)entityTypeId;
                switch (Entitytype)
                {
                case EntityType.None:
                    break;

                case EntityType.Person:
                    GetPersonnelPictureService().SetFeaturedPicture(filename);
                    break;

                case EntityType.Company:
                    GetCompanyPictureService().SetFeaturedPicture(filename);
                    break;

                case EntityType.ZetaCodeNormalIplik:
                    GetZetaCodeNormalIplikPictureService().SetFeaturedPicture(filename);
                    break;

                default:
                    break;
                }
                UnitOfWorkAsync.SaveChanges();
                return(Json(new MyJsonResult()
                {
                    SuccessMessage = "Vitrin Resmi Seçildi"
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new MyJsonResult()
                {
                    ErrorMessage = ex.ToString()
                }, JsonRequestBehavior.AllowGet));
            }
        }