protected string SaveImageFile()
        {
            var PhotoPath = "";

            try
            {
                if (ClientPhoto != null)
                {
                    //Save the photo in Folder
                    var    fileExt  = Path.GetExtension(ClientPhoto.FileName);
                    string fileName = Guid.NewGuid() + fileExt;
                    var    subPath  = Server.MapPath("~/uploadfiles");

                    //Check SubPath Exist or Not
                    if (!Directory.Exists(subPath))
                    {
                        Directory.CreateDirectory(subPath);
                    }
                    //End : Check SubPath Exist or Not

                    var path = Path.Combine(subPath, fileName);
                    ClientPhoto.SaveAs(path);

                    PhotoPath = clsobj.GetURL() + "/uploadfiles/" + fileName;
                }
            }
            catch
            {
            }
            return(PhotoPath);
        }
Example #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            ClientPhoto clientPhoto = db.ClientPhotoes.Find(id);

            db.ClientPhotoes.Remove(clientPhoto);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #3
0
 public ActionResult Edit([Bind(Include = "ClientPhotoID,ClientID,PhotoFileName")] ClientPhoto clientPhoto)
 {
     if (ModelState.IsValid)
     {
         db.Entry(clientPhoto).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ClientID = new SelectList(db.Clients, "ClientID", "UserName", clientPhoto.ClientID);
     return(View(clientPhoto));
 }
Example #4
0
        public ActionResult Create([Bind(Include = "ClientPhotoID,ClientID,PhotoFileName")] ClientPhoto clientPhoto)
        {
            if (ModelState.IsValid)
            {
                db.ClientPhotoes.Add(clientPhoto);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ClientID = new SelectList(db.Clients, "ClientID", "UserName", clientPhoto.ClientID);
            return(View(clientPhoto));
        }
Example #5
0
        // GET: ClientPhotoes/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ClientPhoto clientPhoto = db.ClientPhotoes.Find(id);

            if (clientPhoto == null)
            {
                return(HttpNotFound());
            }
            return(View(clientPhoto));
        }
Example #6
0
        // GET: ClientPhotoes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ClientPhoto clientPhoto = db.ClientPhotoes.Find(id);

            if (clientPhoto == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ClientID = new SelectList(db.Clients, "ClientID", "UserName", clientPhoto.ClientID);
            return(View(clientPhoto));
        }
Example #7
0
        //protected void GrdBlogList_RowCommand(object sender, GridViewCommandEventArgs e)
        //{
        //    int id = 0;
        //    if (e.CommandName == "Deleterec")
        //    {
        //        id = Convert.ToInt32(e.CommandArgument);
        //        int result = clsobj.DeleteDreamHouse(id);
        //        //FillGridData();
        //    }
        //    else if (e.CommandName == "Editrec")
        //    {
        //        id = Convert.ToInt32(e.CommandArgument);
        //        DataTable dt = new DataTable();
        //        dt = clsobj.GetDreamHousebyID(id);
        //        txtName.Text = dt.Rows[0]["Title"].ToString();


        //    }
        //    else
        //    {

        //    }
        //}

        #endregion PageListGrid Events & Method

        #region Button Click
        protected void btnUploadImage_Click(object sender, EventArgs e)
        {
            try
            {
                var photopath = "";

                if (ClientPhoto.PostedFile != null && ClientPhoto.PostedFile.FileName != "")
                {
                    //Save the photo in Folder
                    var    fileExt  = Path.GetExtension(ClientPhoto.FileName);
                    string fileName = Guid.NewGuid() + fileExt;
                    var    subPath  = Server.MapPath("~/uploadfiles");

                    //Check SubPath Exist or Not
                    if (!Directory.Exists(subPath))
                    {
                        Directory.CreateDirectory(subPath);
                    }
                    //End : Check SubPath Exist or Not

                    var path = Path.Combine(subPath, fileName);
                    ClientPhoto.SaveAs(path);

                    photopath = clsobj.GetURL() + "/uploadfiles/" + fileName;
                }

                var Status = rblList.SelectedValue;
                var gender = Gender.SelectedValue;
                var source = Source.SelectedValue;


                int AdminClientId = clsobj.InsertAdminClient(txtName.Text, txtDob.Text, txtEmail.Text, txtPhoneNo.Text, txtAddress.Text, source, Status, gender, photopath, Remarks.Text);

                txtName.Text    = "";
                txtPhoneNo.Text = "";
                txtDob.Text     = "";
                txtEmail.Text   = "";
                txtAddress.Text = "";

                Response.Redirect("~/Admin/AdminClientList.aspx", false);
            }

            catch (Exception ex)
            {
                // ErrorLogging.WriteLog(ex.ToString());
            }
        }
Example #8
0
        public JsonResult PhotoRenderProgress(string taskId)
        {
            CloudBlobContainer container = this.BlobClient.GetContainerReference(ComicConfigSectionGroup.Blob.TaskContainer);
            CloudBlobDirectory directory = container.GetDirectoryReference(ComicConfigSectionGroup.Blob.PhotoTaskDirectory);
            CloudBlob          blob      = directory.GetBlobReference(taskId);

            XmlSerializer serializer = new XmlSerializer(typeof(PhotoTask));

            using (MemoryStream stream = new MemoryStream())
            {
                blob.DownloadToStream(stream);
                stream.Seek(0, SeekOrigin.Begin);
                PhotoTask task = (PhotoTask)serializer.Deserialize(stream);

                if (task.OwnerUid != this.ActiveUser.Uid)
                {
                    throw new Exception("Unknown task");
                }

                ClientPhoto clientPhoto = null;
                if (task.PhotoId.HasValue)
                {
                    // Load photo from database
                    Photo photo = this.EntityContext.TryGetPhoto(task.PhotoId.Value);
                    if (photo != null)
                    {
                        clientPhoto = new ClientPhoto(photo);
                    }
                }

                ClientPhotoTask clientTask = new ClientPhotoTask(task, clientPhoto);
                return(this.Json(clientTask, JsonRequestBehavior.AllowGet));
            }

            throw new Exception("Unknown task");
        }