示例#1
0
    protected string PhotoUpload()
    {
        string PhotoName;
        string PhotoPath = this.Config(COM.ADM.EnumUtil.Config.AdminRoot) + this.Config(COM.ADM.EnumUtil.Config.PathUserImg);

        PhotoPath = PhotoPath.Replace("/", "\\");

        int MaxKBSize = int.Parse(this.Config(COM.ADM.EnumUtil.Config.MaxKBUser));

        if ((fuPhoto.PostedFile != null) && (PhotoPath != String.Empty) && (MaxKBSize > 0))
        {
            int FileSize = fuPhoto.PostedFile.ContentLength;

            if ((FileSize <= 0) || (FileSize > MaxKBSize))
            {
                return(this.smPhoto);
            }

            string FileName = fuPhoto.PostedFile.FileName;
            try
            {
                PhotoName = COM.Util.genUserPicName(this.smUserID, COM.Enum.PhotoSizes.Original) + LIB.Util.GetExtension(FileName);
                fuPhoto.PostedFile.SaveAs(COM.Util.genPhotoUrl(PhotoPath, PhotoName));

                ImageHelper ImgHelper = new ImageHelper();

                string PhotoSource = COM.Util.genPhotoUrl(PhotoPath, PhotoName);
                string SavePath    = PhotoPath + COM.Util.genUserPicName(this.smUserID, COM.Enum.PhotoSizes.Big200) + LIB.Util.GetExtension(PhotoSource);
                ImgHelper.Resize(PhotoSource, SavePath, (int)COM.Enum.PhotoSizesW.Big200);

                PhotoSource = SavePath;
                string PhotoDefault = COM.Util.genUserPicName(this.smUserID, COM.Enum.PhotoSizes.Default100) + LIB.Util.GetExtension(PhotoSource);
                SavePath = PhotoPath + PhotoDefault;
                ImgHelper.Resize(PhotoSource, SavePath, (int)COM.Enum.PhotoSizesW.Default100);

                PhotoSource = SavePath;
                SavePath    = PhotoPath + COM.Util.genUserPicName(this.smUserID, COM.Enum.PhotoSizes.Small50) + LIB.Util.GetExtension(PhotoSource);;
                ImgHelper.Resize(PhotoSource, SavePath, (int)COM.Enum.PhotoSizesW.Small50);

                PhotoSource = SavePath;
                SavePath    = PhotoPath + COM.Util.genUserPicName(this.smUserID, COM.Enum.PhotoSizes.Square50) + LIB.Util.GetExtension(PhotoSource);
                ImgHelper.Crop(PhotoSource, SavePath, 0, 0, (int)COM.Enum.PhotoSizesW.Square50, (int)COM.Enum.PhotoSizesW.Square50);

                this.smPhoto      = PhotoDefault;
                this.smPhotoSmall = COM.Util.genPhotoNameOfSize(this.smPhoto, COM.Enum.PhotoSizes.Small50);
                this.smPhotoBig   = COM.Util.genPhotoNameOfSize(this.smPhoto, COM.Enum.PhotoSizes.Big200);

                UserImage1.SetPhotoSession(COM.Enum.FacebookPhotoSizes.small);

                return(this.smPhoto);
            }
            catch (Exception)
            {
                return(this.smPhoto);
            }
        }
        return("");
    }
示例#2
0
 protected void lnkDeleteImage_Click(object sender, EventArgs e)
 {
     if (BUS.Users.UserPhotoDel(this.smUserID))
     {
         SuccessDeleteImage.Visible = true;
         this.smPhoto = "";
         UserImage1.SetPhotoSession(COM.Enum.FacebookPhotoSizes.small);
     }
 }
示例#3
0
 private void SetPersonalInfo()
 {
     lnkDeleteImage.Visible = !(this.smPhoto == "");
     UserImage1.SetPhotoSession(COM.Enum.FacebookPhotoSizes.small, this.smPhoto);
     txtFirstName.Text = this.dtUserDetail.Rows[0]["FirstName"].ToString();
     txtSurname.Text   = this.dtUserDetail.Rows[0]["Surname"].ToString();
     txtGsm.Text       = (this.dtUserDetail.Rows[0]["Gsm"] == DBNull.Value) ? "" : this.dtUserDetail.Rows[0]["Gsm"].ToString();
     txtBirthDate.Text = (this.dtUserDetail.Rows[0]["BirthDate"] == DBNull.Value) ? "" : Convert.ToDateTime(this.dtUserDetail.Rows[0]["BirthDate"]).Date.ToShortDateString();
     if (this.dtUserDetail.Rows[0]["IsFemale"] != DBNull.Value)
     {
         rdFemale.Checked = (Convert.ToBoolean(this.dtUserDetail.Rows[0]["IsFemale"]));
         rdMale.Checked   = !rdFemale.Checked;
     }
     ddlLocationID.SelectedValue = (this.dtUserDetail.Rows[0]["LocationID"].ToString() == "") ? "0" : this.dtUserDetail.Rows[0]["LocationID"].ToString();
 }