public ActionResult SaveCompany(CompanyModel model)
        {
            SendDbUtility.SaveCompany(model);


            return(RedirectToAction("Home", "Pattern"));
        }
        public ActionResult CompanyToDb(CreateCompanyModel newCompany)
        {
            SendDbUtility.sendCompanyModel(newCompany);


            return(RedirectToAction("Home", "Pattern"));
        }
 public ActionResult GetTable()
 {
     CompanyViewModel[] company;
     using (UserContext db = new UserContext())
     {
         company = SendDbUtility.GelAllCompanyList();
     }
     return(PartialView(company));
 }
 public ActionResult MainPage(AutModelViewModel model, string returnUrl)
 {
     if (ModelState.IsValid)
     {
         if (SendDbUtility.verifyAutefication(model))
         {
             FormsAuthentication.SetAuthCookie(model.Login, true);
             return(string.IsNullOrEmpty(returnUrl)?RedirectToAction("Home", "Pattern") : (ActionResult)Redirect(returnUrl));
         }
         ModelState.AddModelError("", "Не верное имя или пароль.");
     }
     return(View(model));
 }
        //Обновление данных о мастере
        public ActionResult UpdateResident(RegisterMasterModel model, HttpPostedFileBase upload)
        {
            UserContext db = new UserContext();



            byte[] imageData = null;
            // считываем переданный файл в массив байтов
            if (upload == null)
            {
                imageData = new byte[] {};
            }
            else
            {
                using (var binaryReader = new BinaryReader(upload.InputStream))
                {
                    imageData = binaryReader.ReadBytes(upload.ContentLength);
                }
            }

            // установка массива байтов
            model.Picture = imageData;

            if (model.Picture.Length != 0)
            {
                Utilities.SendDbUtility.CreatePicture(model.Picture, model.id);
            }



            if (model.Offers == null)
            {
                TempData["WrongMessage"] = "Выберите предоставляемые услуги!";
                return(RedirectToAction("PersonalData", "TimerClub"));
            }

            //Если пароль введен верно
            if (SendDbUtility.ComparePassword(model.Password, User.Identity.Name))
            {
                Utilities.SendDbUtility.ChangeResident(model);
                TempData["SuccessMessage"] = "Данные изменены!";
                return(RedirectToAction("PersonalData", "TimerClub"));
            }
            else
            {
                TempData["WrongMessage"] = "Пароль введен не верно!";
                return(RedirectToAction("PersonalData", "TimerClub"));
            }
        }
        public ActionResult LoginSalon(LoginMaster model)
        {
            if (SendDbUtility.ComparePasswordSalon(model.Password, model.Email))
            {
                FormsAuthentication.SetAuthCookie(model.Email, true);
                var salon = GetData.GetDataSalonAdmin(model.Email);
                Response.Cookies["ResidentName"].Value    = Server.UrlEncode(salon.ContactPerson);
                Response.Cookies["ResidentSurname"].Value = Server.UrlEncode(salon.SalonTitle);
                Response.Cookies["SalonId"].Value         = Server.UrlEncode(salon.Id.ToString());
                Response.Cookies["City"].Value            = Server.UrlEncode(salon.City);

                return(RedirectToAction("ShowBookedResidents", "TimerClub"));
            }
            return(RedirectToAction("MainPage", "TimerClub"));
        }
 public string RemoveFavorite(string data)
 {
     try
     {
         int  userId = SendDbUtility.GetResidentId(User.Identity.Name);
         bool res    = SendDbUtility.RemoveFavorite(Int32.Parse(data), userId);
         if (!res)
         {
             return("0");
         }
         return("1");
     }
     catch (Exception e)
     {
         return("0");
     }
 }
        public bool SaveUser(UserModelViewModel client)
        {
            UserModel model = new UserModel
            {
                Id                    = client.Id,
                Name                  = client.Name,
                Name_DativeCase       = client.Name_DativeCase,
                Surname               = client.Surname,
                Surname_DativeCase    = client.Surname_DativeCase,
                Patronymic            = client.Patronymic,
                Patronymic_DativeCase = client.Patronymic_DativeCase,
                CompanyId             = client.CompanyId,
                Position              = client.Position,
                Education             = client.Education
            };

            return(SendDbUtility.UpdateUser(model));
        }
示例#9
0
        public ActionResult AddWorkingPlace(WorkingPlaceModel model, IEnumerable <HttpPostedFileBase> SalonPhoto)
        {
            if (!ModelState.IsValid)
            {
                TempData["ErrorMessage"] = "Не заполнены все обязательные поля!";
                return(RedirectToAction("SalonPlaces", "Admin", new { id = model.SalonId }));
            }

            Utilities.SendDbUtility.AddWorkingPlace(model);
            foreach (var file in SalonPhoto)
            {
                if (file != null)
                {
                    SendDbUtility.SaveSalonPhoto(file, model.Id.ToString());
                }
            }
            return(RedirectToAction("SalonPlaces", "Admin", new { id = model.SalonId }));
        }
        public ActionResult PasswordChange(ChangePasswordModel model)
        {
            if (!SendDbUtility.ComparePassword(model.OldPassword, User.Identity.Name))
            {
                TempData["WrongMessage"] = "Пароль введен не верно!";
                return(RedirectToAction("PasswordView", "TimerClub"));
            }

            if (SendDbUtility.ChangePassword(User.Identity.Name, model.NewPassword))
            {
                TempData["SuccessMessage"] = "Пароль успешно изменен!";
                return(RedirectToAction("PersonalData", "TimerClub"));
            }
            else
            {
                TempData["WrongMessage"] = "Ошибка!";
                return(RedirectToAction("PasswordView", "TimerClub"));
            }
        }
示例#11
0
        public ActionResult PrintPage()
        {
            var modelsPic = SendDbUtility.GetAllPictures();
            var modelsCom = SendDbUtility.GelAllCompanyList();

            //SelectList itemsPic = new SelectList(modelsPic, "Id", "Name");
            //SelectList itemsCom = new SelectList(modelsCom, "Id", "CompanyName");
            ViewBag.Pictures  = modelsPic;
            ViewBag.Companies = modelsCom;

            object[] x =
            {
                new CompanyModel(),
                new UserModel(),
                new PictureModel()
            };

            return(View(x));
        }
示例#12
0
        public ActionResult UserToDb(UserModelViewModel client)
        {
            UserModel model = new UserModel
            {
                Name                  = client.Name,
                Name_DativeCase       = client.Name_DativeCase,
                Surname               = client.Surname,
                Surname_DativeCase    = client.Surname_DativeCase,
                Patronymic            = client.Patronymic,
                Patronymic_DativeCase = client.Patronymic_DativeCase,
                CompanyId             = client.CompanyId,
                Position              = client.Position,
                Education             = client.Education
            };

            SendDbUtility.SendUserToDb(model);

            return(RedirectToAction("Home", "Pattern"));
        }
        public ActionResult LoginMaster(LoginMaster model)
        {
            if (SendDbUtility.ComparePassword(model.Password, model.Email))
            {
                FormsAuthentication.SetAuthCookie(model.Email, true);
                var resident = GetData.GetDataResident(model.Email);
                Response.Cookies["ResidentName"].Value    = Server.UrlEncode(resident.Name);
                Response.Cookies["ResidentSurname"].Value = Server.UrlEncode(resident.Surname);
                Response.Cookies["City"].Value            = Server.UrlEncode(resident.City);

                var cookie = new HttpCookie("SalonId")
                {
                    Expires = DateTime.Now.AddDays(-1d)
                };
                Response.Cookies.Add(cookie);

                return(RedirectToAction("FindWorkPlaces", "TimerClub"));
            }
            return(RedirectToAction("MainPage", "TimerClub"));
        }
        public string CheckFreeSlotsAjax(string date, string times)
        {
            string               res   = "";
            DateTime             Date  = DateTime.Parse(date);
            TimeSpan             from  = TimeSpan.Parse(times.Split('-')[0]);
            TimeSpan             to    = TimeSpan.Parse(times.Split('-')[1]);
            List <TimeSlotModel> slots = SendDbUtility.GetAllTimeSlots();

            foreach (var slot in slots)
            {
                TimeSpan slotFrom = TimeSpan.Parse(slot.Time.Split('-')[0]);
                TimeSpan slotTo   = TimeSpan.Parse(slot.Time.Split('-')[1]);
                if (Date == slot.Date && slotFrom >= from && slotTo <= to && !slot.Booked)
                {
                    res += slot.PlaceId.ToString() + ",";
                }
            }

            return(res);
        }
        public ActionResult ViewFavorites()
        {
            List <FavoriteModel> models = new List <FavoriteModel>();
            int userId = Utilities.SendDbUtility.GetResidentId(User.Identity.Name);

            string[] favorites = Utilities.SendDbUtility.GetFavorites(userId).Split(',');
            for (int i = 0; i < favorites.Length - 1; i++)
            {
                WorkingPlaceModel place = Utilities.SendDbUtility.GetWorkingPlace(Int32.Parse(favorites[i]));
                SalonModel        salon;

                try
                {
                    salon = SendDbUtility.GetSalon(place.SalonId);
                    models.Add(new FavoriteModel()
                    {
                        PlaceId        = Int32.Parse(favorites[i]),
                        SalonTitle     = salon.SalonTitle,
                        SalonAdress    = salon.Adress,
                        Rate1h         = place.Rate1h,
                        Rateday        = place.RateDay,
                        RateHalfMounth = place.RateHalfMounth,
                        RateMounth     = place.RateMounth
                    });
                }
                catch (Exception e)
                {
                }
            }

            if (Request.Cookies.AllKeys.Contains("SalonId"))
            {
                models.Clear();
            }


            ViewBag.ErrorMessage = TempData["ErrorMessage"];
            ViewBag.InfoMessage  = TempData["InfoMessage"];

            return(View(models));
        }
        public ActionResult RegisterMaster(RegisterMasterModel model)
        {
            //FormsAuthentication.SetAuthCookie("Васильев Вася", false);
            // Если такой емайл уже есть в бд
            if (SendDbUtility.CheckEmail(model.Email))
            {
                TempData["WrongMessage"] = "Такой email уже зарегистрирован!";
                return(RedirectToAction("MainPage", "TimerClub"));
            }

            // Если такой телефон уже есть в бд
            if (SendDbUtility.CheckPhone(model.PhoneNumber))
            {
                TempData["WrongMessage"] = "Такой номер телефона уже зарегистрирован!";
                return(RedirectToAction("MainPage", "TimerClub"));
            }

            // Заносим модель в бд
            Utilities.SendDbUtility.SendMaster(model);

            FormsAuthentication.SetAuthCookie(model.Email, true);
            var resident = GetData.GetDataResident(model.Email);

            Response.Cookies["ResidentName"].Value    = Server.UrlEncode(resident.Name);
            Response.Cookies["ResidentSurname"].Value = Server.UrlEncode(resident.Surname);
            Response.Cookies["City"].Value            = Server.UrlEncode(resident.City);

            var cookie = new HttpCookie("SalonId")
            {
                Expires = DateTime.Now.AddDays(-1d)
            };

            Response.Cookies.Add(cookie);

            return(RedirectToAction("FindWorkPlaces", "TimerClub"));
        }
示例#17
0
        public async Task Execute(IJobExecutionContext context)
        {
            try
            {
                string isError      = "";
                int    addedSlots   = 0;
                int    deletedSlots = 0;
                using (UserContext dbUse = new UserContext())
                {
                    try
                    {
                        IEnumerable <TimeSlotModel> slots = dbUse.TimeSlotModels.Where(t => t.Date < DateTime.Today);
                        dbUse.TimeSlotModels.RemoveRange(slots);
                        dbUse.BookingModels.RemoveRange(dbUse.BookingModels.Where(t => t.Date < DateTime.Today));
                        var lusd = slots.ToList();
                        deletedSlots = lusd.Count();
                        dbUse.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        isError = "Ошибка в удалении прошедших дат:\n" + e.ToString();
                    }
                }

                using (UserContext dbUse = new UserContext())
                {
                    try
                    {
                        List <WorkingPlaceModel> allPlaces = SendDbUtility.GetAllWorkingPlaces();

                        foreach (var place in allPlaces)
                        {
                            //SalonModel salon = SendDbUtility.GetSalon(place.SalonId);
                            //string[] workingTime = salon.OperatingMode.Split('-');
                            //int constFrom = Int32.Parse(workingTime[0].Trim().Substring(0, 2));
                            //int constTo = Int32.Parse(workingTime[1].Trim().Substring(0, 2));

                            //int from;
                            //int to;
                            //int tempTo;
                            //int tempFrom;
                            //DateTime dateNow = DateTime.Today;

                            //for (int i = 0; i < 14; i++)
                            //{

                            //    from = constFrom;
                            //    to = constTo;
                            //    while (from != to)
                            //    {
                            //        tempFrom = from;
                            //        tempTo = ++from;
                            //        string isExist = SendDbUtility.CheckTimeSlot(dateNow,
                            //            tempFrom.ToString() + ":00-" + tempTo.ToString() + ":00", place.Id);
                            //        if (isExist == "0")
                            //        {
                            //            dbUse.TimeSlotModels.Add(new TimeSlotModel()
                            //            {
                            //                PlaceId = place.Id,
                            //                SalonId = place.SalonId,
                            //                Time = tempFrom.ToString() + ":00-" + tempTo.ToString() + ":00",
                            //                Booked = false,
                            //                Date = dateNow
                            //            });
                            //            addedSlots++;
                            //        }
                            //        else if(isExist != "1")
                            //        {
                            //            isError = "Ошибка в проверке тайм слота:\n" + isExist;
                            //        }
                            //    }
                            //    dateNow = dateNow.AddDays(1);
                            //}



                            SalonModel salon          = SendDbUtility.GetSalon(place.SalonId);
                            string[]   workingTimeMon = salon.OperatingModeMon.Split('-');
                            int        constFromMon   = Int32.Parse(workingTimeMon[0].Trim().Substring(0, 2));
                            int        constToMon     = Int32.Parse(workingTimeMon[1].Trim().Substring(0, 2));

                            string[] workingTimeTue = salon.OperatingModeTue.Split('-');
                            int      constFromTue   = Int32.Parse(workingTimeTue[0].Trim().Substring(0, 2));
                            int      constToTue     = Int32.Parse(workingTimeTue[1].Trim().Substring(0, 2));

                            string[] workingTimeWed = salon.OperatingModeWed.Split('-');
                            int      constFromWed   = Int32.Parse(workingTimeWed[0].Trim().Substring(0, 2));
                            int      constToWed     = Int32.Parse(workingTimeWed[1].Trim().Substring(0, 2));

                            string[] workingTimeThu = salon.OperatingModeThu.Split('-');
                            int      constFromThu   = Int32.Parse(workingTimeThu[0].Trim().Substring(0, 2));
                            int      constToThu     = Int32.Parse(workingTimeThu[1].Trim().Substring(0, 2));

                            string[] workingTimeFri = salon.OperatingModeFri.Split('-');
                            int      constFromFri   = Int32.Parse(workingTimeFri[0].Trim().Substring(0, 2));
                            int      constToFri     = Int32.Parse(workingTimeFri[1].Trim().Substring(0, 2));

                            string[] workingTimeSat = salon.OperatingModeSat.Split('-');
                            int      constFromSat   = Int32.Parse(workingTimeSat[0].Trim().Substring(0, 2));
                            int      constToSat     = Int32.Parse(workingTimeSat[1].Trim().Substring(0, 2));

                            string[] workingTimeSun = salon.OperatingModeSun.Split('-');
                            int      constFromSun   = Int32.Parse(workingTimeSun[0].Trim().Substring(0, 2));
                            int      constToSun     = Int32.Parse(workingTimeSun[1].Trim().Substring(0, 2));

                            if (constFromMon > constToMon)
                            {
                                constFromMon = constToMon;
                            }
                            if (constFromTue > constToTue)
                            {
                                constFromTue = constToTue;
                            }
                            if (constFromWed > constToWed)
                            {
                                constFromWed = constToWed;
                            }
                            if (constFromThu > constToThu)
                            {
                                constFromThu = constToThu;
                            }
                            if (constFromFri > constToFri)
                            {
                                constFromFri = constToFri;
                            }


                            if (constFromSat > constToSat)
                            {
                                constFromSat = constToSat;
                            }
                            if (constFromSun > constToSun)
                            {
                                constFromSun = constToSun;
                            }
                            int      from;
                            int      to;
                            int      tempTo;
                            int      tempFrom;
                            DateTime dateNow = DateTime.Today;
                            for (int i = 0; i < 14; i++)
                            {
                                if (dateNow.DayOfWeek == DayOfWeek.Saturday)
                                {
                                    from = constFromSat;
                                    to   = constToSat;
                                }
                                else if (dateNow.DayOfWeek == DayOfWeek.Sunday)
                                {
                                    from = constFromSun;
                                    to   = constToSun;
                                }
                                else if (dateNow.DayOfWeek == DayOfWeek.Monday)
                                {
                                    from = constFromMon;
                                    to   = constToMon;
                                }
                                else if (dateNow.DayOfWeek == DayOfWeek.Tuesday)
                                {
                                    from = constFromTue;
                                    to   = constToTue;
                                }
                                else if (dateNow.DayOfWeek == DayOfWeek.Wednesday)
                                {
                                    from = constFromWed;
                                    to   = constToWed;
                                }
                                else if (dateNow.DayOfWeek == DayOfWeek.Thursday)
                                {
                                    from = constFromThu;
                                    to   = constToThu;
                                }
                                else if (dateNow.DayOfWeek == DayOfWeek.Friday)
                                {
                                    from = constFromFri;
                                    to   = constToFri;
                                }
                                else
                                {
                                    throw new NotImplementedException();
                                }
                                while (from != to)
                                {
                                    tempFrom = from;
                                    tempTo   = ++from;

                                    string isExist = SendDbUtility.CheckTimeSlot(dateNow,
                                                                                 tempFrom.ToString() + ":00-" + tempTo.ToString() + ":00", place.Id);
                                    if (isExist == "0")
                                    {
                                        dbUse.TimeSlotModels.Add(new TimeSlotModel()
                                        {
                                            PlaceId = place.Id,
                                            SalonId = place.SalonId,
                                            Time    = tempFrom.ToString() + ":00-" + tempTo.ToString() + ":00",
                                            Booked  = false,
                                            Date    = dateNow
                                        });
                                        addedSlots++;
                                    }
                                    else if (isExist != "1")
                                    {
                                        isError = "Ошибка в проверке тайм слота:\n" + isExist;
                                    }
                                }

                                dateNow = dateNow.AddDays(1);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        isError = "Ошибка в добавлении новых дат:\n" + e.ToString();
                    }
                    if (isError != "")
                    {
                        WriteLogs(isError);
                        await Execute(context);
                    }
                    else
                    {
                        dbUse.SaveChanges();
                        WriteLogs("Обновление прошло успешно \nУдалено " + deletedSlots + " слотов \nДобавлено " + addedSlots + " слотов");
                    }
                }
            }
            catch (Exception e)
            {
                WriteLogs("Глобальная ошибка обновления");
            }
        }
示例#18
0
        public bool SetBlocks(string data)
        {
            SetBlockModel         b     = JsonConvert.DeserializeObject <SetBlockModel>(data);
            var                   picId = Int32.Parse(b.picId);
            List <List <string> > a;

            a = b.bounds;

            using (var dbUse = new UserContext())
            {
                var pic = dbUse.PicturesModels.Find(picId);
                pic.Name          = b.Name;
                pic.NaturalHeight = int.Parse(b.NaturalHeight);
                pic.NaturalWidth  = int.Parse(b.NaturalWidth);
                if (a.Count == 0)
                {
                    dbUse.PositionModels.RemoveRange(pic.PositionModels);
                }
                if (!b.stamps.Any())
                {
                    dbUse.StampPositions.RemoveRange(pic.StampPositions);
                }
                dbUse.Entry(pic).State = EntityState.Modified;
                dbUse.SaveChanges();
            }
            if (a.Count == 0 && !b.stamps.Any())
            {
                return(false);
            }

            using (var dbUse = new UserContext())
            {
                PictureModel picture = dbUse.PicturesModels.Find(picId);

                foreach (var block in a)
                {
                    PositionModel model = picture?.PositionModels.FirstOrDefault(t => t.Id == int.Parse(block[4]));
                    if (model != null)
                    {
                        model.Id         = int.Parse(block[4]);
                        model.PictureId  = picId;
                        model.PosX       = float.Parse(block[0].Replace('.', ','));
                        model.PosY       = float.Parse(block[1].Replace('.', ','));
                        model.Width      = float.Parse(block[2].Replace('.', ','));
                        model.Type       = block[5];
                        model.FontSize   = int.Parse(block[7]);
                        model.Height     = float.Parse(block[6].Replace('.', ','));
                        model.Text       = block[5].Contains("Статичный текст") ? block[8].Replace("\n", "*newline*") : "";
                        model.FontWeight = block[9];
                        model.Alignment  = block[10];


                        if (block[5] == "Статичный текст из бд")
                        {
                            dbUse.AutoTexts.AddOrUpdate(new AutoTextModel
                            {
                                Text = block[8].Replace("\n", "*newline*")
                            });
                        }
                        dbUse.Entry(model).State = EntityState.Modified;
                    }
                    else
                    {
                        model = new PositionModel()
                        {
                            PictureId  = picId,
                            PosX       = float.Parse(block[0].Replace('.', ',')),
                            PosY       = float.Parse(block[1].Replace('.', ',')),
                            Width      = float.Parse(block[2].Replace('.', ',')),
                            Type       = block[5],
                            FontSize   = int.Parse(block[7]),
                            Height     = float.Parse(block[6].Replace('.', ',')),
                            Text       = block[5].Contains("Статичный текст") ? block[8] : "",
                            FontWeight = block[9],
                            Alignment  = block[10]
                        };
                        if (block[5] == "Статичный текст из бд")
                        {
                            dbUse.AutoTexts.AddOrUpdate(new AutoTextModel
                            {
                                Text = block[8]
                            });
                        }
                        dbUse.PositionModels.AddOrUpdate(model);
                    }
                }
                foreach (var stamp in b.stamps)
                {
                    StampPositions stamps = picture.StampPositions.FirstOrDefault(t => t.StampPositionId == stamp.StampPositionId);
                    if (stamps != null)
                    {
                        stamps.Height             = float.Parse(stamp.Height.Replace('.', ','));
                        stamps.Width              = float.Parse(stamp.Width.Replace('.', ','));
                        stamps.PosX               = float.Parse(stamp.PosX.Replace('.', ','));
                        stamps.PosY               = float.Parse(stamp.PosY.Replace('.', ','));
                        stamps.Type               = stamp.Type;
                        dbUse.Entry(stamps).State = EntityState.Modified;
                    }
                    else
                    {
                        stamps = new StampPositions
                        {
                            PicId  = picId,
                            Type   = stamp.Type,
                            Height = float.Parse(stamp.Height.Replace('.', ',')),
                            Width  = float.Parse(stamp.Width.Replace('.', ',')),
                            PosX   = float.Parse(stamp.PosX.Replace('.', ',')),
                            PosY   = float.Parse(stamp.PosY.Replace('.', ','))
                        };
                        dbUse.StampPositions.AddOrUpdate(stamps);
                    }
                }
                foreach (var photo in b.photos)
                {
                    PhotoModel photos = picture.PhotoModels.FirstOrDefault(t => t.PhotoModelId == photo.PhotoModelId);
                    if (photos != null)
                    {
                        photos.Height             = float.Parse(photo.Height.Replace('.', ','));
                        photos.Width              = float.Parse(photo.Width.Replace('.', ','));
                        photos.PosX               = float.Parse(photo.PosX.Replace('.', ','));
                        photos.PosY               = float.Parse(photo.PosY.Replace('.', ','));
                        photos.PhotoModelId       = photo.PhotoModelId;
                        dbUse.Entry(photos).State = EntityState.Modified;
                    }
                    else
                    {
                        photos = new PhotoModel
                        {
                            PicId        = picId,
                            PhotoModelId = photo.PhotoModelId,
                            Height       = float.Parse(photo.Height.Replace('.', ',')),
                            Width        = float.Parse(photo.Width.Replace('.', ',')),
                            PosX         = float.Parse(photo.PosX.Replace('.', ',')),
                            PosY         = float.Parse(photo.PosY.Replace('.', ','))
                        };
                        dbUse.PhotoModel.AddOrUpdate(photos);
                    }
                }
                foreach (var photo in b.images)
                {
                    StaticImageModel photos = picture.StaticImageModels.FirstOrDefault(t => t.StaticImageModelId == photo.StaticImageModelId);
                    if (photos != null)
                    {
                        photos.Height             = float.Parse(photo.Height.Replace('.', ','));
                        photos.Width              = float.Parse(photo.Width.Replace('.', ','));
                        photos.PosX               = float.Parse(photo.PosX.Replace('.', ','));
                        photos.PosY               = float.Parse(photo.PosY.Replace('.', ','));
                        photos.StaticImageModelId = photo.StaticImageModelId;
                        dbUse.Entry(photos).State = EntityState.Modified;
                    }
                    else
                    {
                        photos = new StaticImageModel
                        {
                            PicId = picId,
                            StaticImageModelId = photo.StaticImageModelId,
                            Height             = float.Parse(photo.Height.Replace('.', ',')),
                            Width = float.Parse(photo.Width.Replace('.', ',')),
                            PosX  = float.Parse(photo.PosX.Replace('.', ',')),
                            PosY  = float.Parse(photo.PosY.Replace('.', ','))
                        };
                        dbUse.StaticImageModel.AddOrUpdate(photos);
                    }
                }
                if (a.Count != 0)
                {
                    dbUse.PositionModels.RemoveRange(picture.PositionModels.Where(t => dbUse.Entry(t).State == EntityState.Unchanged));
                }
                if (b.stamps.Any())
                {
                    dbUse.StampPositions.RemoveRange(picture.StampPositions.Where(t => dbUse.Entry(t).State == EntityState.Unchanged));
                }
                dbUse.SaveChanges();
            }

            SendDbUtility.UpdateImage(int.Parse(b.Id), b.Name);
            return(true);
        }
示例#19
0
 public bool RemoveUser(int id)
 {
     return(SendDbUtility.DeleteUserById(id));
 }
示例#20
0
 public bool RemoveCompany(int id)
 {
     return(SendDbUtility.DeleteCompany(id));
 }
示例#21
0
        public ActionResult UpdatePicture(string Name, int Id)
        {
            SendDbUtility.UpdateImage(Id, Name);

            return(RedirectToAction("EditorPattern", "Pattern"));
        }
示例#22
0
        public ActionResult Home()
        {
            var company = SendDbUtility.GelAllCompanyList();

            return(View(company));
        }