Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string strId = Request.QueryString["Id"];
            int    id    = Convert.ToInt32(strId);

            craftsMan = CraftsManDataHelper.GetCraftsManById(id);
        }
        protected void ButtonResume_Click(object sender, EventArgs e)
        {
            string craft       = String.Format("{0}", Request.Form["ctl00$MainContent$input_craft"]);
            string description = String.Format("{0}", Request.Form["ctl00$MainContent$input_description"]);
            string price       = String.Format("{0}", Request.Form["ctl00$MainContent$input_price"]);
            string phone       = String.Format("{0}", Request.Form["ctl00$MainContent$phone"]);
            string firstName   = String.Format("{0}", Request.Form["ctl00$MainContent$input_firstName"]);
            string lastName    = String.Format("{0}", Request.Form["ctl00$MainContent$input_lastName"]);
            string address     = String.Format("{0}", Request.Form["ctl00$MainContent$address"]);
            string email       = String.Format("{0}", Request.Form["ctl00$MainContent$email"]);
            string city        = String.Format("{0}", Request.Form["ctl00$MainContent$city"]);

            var objPhotos = String.Format("{0}", Request.Form["ResumePhotos"]);

            Rentoolo.Model.CraftsMan resume = new Model.CraftsMan();

            if (objPhotos != null)
            {
                String[] listPhotos = objPhotos.Split(',');

                var jsonPhotos = JsonConvert.SerializeObject(listPhotos);

                resume.ImgUrls = jsonPhotos;
            }
            else
            {
                resume.ImgUrls = "[\"/img/kitchen/falafel-s-ovoshami.jpg\"]";
            }
            try
            {
                int category = 1;
                resume.Category = category;

                resume.Id = category;  // TODO переделать
            }
            catch { }
            try
            {
                resume.Price = float.Parse(price);
            }
            catch { }

            //resume.CreatedUserId = User.UserId;
            resume.Сraft       = craft;
            resume.Created     = DateTime.Now;
            resume.Address     = address;
            resume.Description = description;
            resume.Phone       = phone;
            resume.FirstName   = firstName;
            resume.LastName    = lastName;
            resume.Region      = city; //TODO переделать поля в бд
            resume.Email       = email;

            CraftsManDataHelper.AddCraftsMan(resume);

            Response.Redirect("CraftsManTasks.aspx");
        }
Example #3
0
        public static CraftsMan GetCraftsMan(long id)
        {
            using (var dc = new RentooloEntities())
            {
                CraftsMan item = dc.CraftsMan.FirstOrDefault(x => x.Id == id);

                return(item);
            }
        }
Example #4
0
        public static long AddCraftsMan(CraftsMan item)
        {
            using (var dc = new RentooloEntities())
            {
                var result = dc.CraftsMan.Add(item);

                var res = dc.SaveChanges();

                return(result.Id);
            }
        }
        protected void ButtonResume_Click(object sender, EventArgs e)
        {
            string craft       = String.Format("{0}", Request.Form["MainContent$input_craft"]);
            string description = String.Format("{0}", Request.Form["MainContent$input_description"]);
            string price       = String.Format("{0}", Request.Form["MainContent$input_price"]);
            string phone       = String.Format("{0}", Request.Form["MainContent$resPhone"]);
            string firstName   = String.Format("{0}", Request.Form["MainContent$input_firstName"]);
            string lastName    = String.Format("{0}", Request.Form["MainContent$input_lastName"]);
            string address     = String.Format("{0}", Request.Form["MainContent$address"]);
            string email       = String.Format("{0}", Request.Form["MainContent$email"]);
            string country     = String.Format("{0}", Request.Form["MainContent$country"]);
            string region      = String.Format("{0}", Request.Form["MainContent$region"]);

            //var objPhotos = Request.Form[""];
            Rentoolo.Model.CraftsMan resume = new Model.CraftsMan();

            //if (objPhotos != null)
            //{
            //    String[] listPhotos = objPhotos.Split(',');

            //    var jsonPhotos = JsonConvert.SerializeObject(listPhotos);

            //    order.ImgUrls = jsonPhotos;
            //}
            //else
            //{
            //    order.ImgUrls = "[\"/img/a/noPhoto.png\"]";
            //}

            //try
            //{
            //    order.Category = Int32.Parse(category);
            //}
            //catch { }
            try
            {
                resume.Price = double.Parse(price);
            }
            catch { }

            //resume.CreatedUserId = User.UserId;
            resume.Сraft       = craft;
            resume.Created     = DateTime.Now;
            resume.Address     = address;
            resume.Description = description;
            resume.Phone       = phone;
            resume.FirstName   = firstName;
            resume.LastName    = lastName;
            resume.Region      = region;
            resume.Country     = country;
            CraftsManDataHelper.AddCraftsMan(resume);

            //Response.Redirect("");
        }