Ejemplo n.º 1
0
    protected void btn_upload_FILE_Click1(object sender, EventArgs e)
    {
        ViewState["url"] = FilePhoto.FileBytes;
        string fpath = Server.MapPath("~\\SchoolAdmin\\EmployeePhoto\\");

        if (!Directory.Exists(fpath))
        {
            var dir = new DirectoryInfo("~\\SchoolAdmin\\");
            dir.CreateSubdirectory("EmployeePhoto");
        }
        else
        {
            string schoolName   = AppSessions.SchoolName;
            string UserName     = txtAddFirstName.Text + "_" + txtAddLastName.Text;
            string FileName     = schoolName + "_" + UserName;
            string FilePathName = FilePhoto.FileName;
            string Extension    = Path.GetExtension(FilePathName);
            string FileNewName  = FileName + Extension;
            string FileLocation;
            FileLocation = fpath + FilePathName;
            if (File.Exists(FileLocation))
            {
                string UserName1     = txtAddFirstName.Text + "_" + txtAddMiddleName.Text + "_" + txtAddLastName.Text;
                string FileName1     = schoolName + "_" + UserName1;
                string FilePathName1 = FilePhoto.FileName;
                string Extension1    = Path.GetExtension(FilePathName1);
                string FileNewName1  = FileName1 + Extension1;
                string FileLocation1 = fpath + FilePathName1;
                FilePhoto.SaveAs(FileLocation1);

                imgPhoto.ImageUrl = "~\\SchoolAdmin\\EmployeePhoto\\" + FilePathName;
            }
            else
            {
                FilePhoto.SaveAs(FileLocation);
                imgPhoto.ImageUrl = "~\\SchoolAdmin\\EmployeePhoto\\" + FilePathName;
            }
            pnlEdit.CssClass   = "InVisible";
            pnlSearch.CssClass = "InVisible";
            pnlAdd.CssClass    = "Visible";
        }
    }
Ejemplo n.º 2
0
    protected void btn_Insert_Click(object sender, EventArgs e)
    {
        string prodID = Session["foo"].ToString();

        int    result   = 0;
        string image    = "";
        string category = "";

        decimal budget = decimal.Parse(budgetID.Text);

        if (FilePhoto.HasFile == true)
        {
            image = "Images\\" + FilePhoto.FileName;
        }



        Listings prod = new Listings(); //tb_ProductCat can change to ddl_ProdCat

        result = updateListing(prodID, listingTitleID.Text, descID.Text, (FilePhoto.FileName).ToString(), budget);

        if (result > 0)
        {
            string saveimg = Server.MapPath("") + "\\" + image;
            FilePhoto.SaveAs(saveimg);

            //loadProductInfo();
            //loadProduct();
            //clear1();

            Response.Write("<script> alert('Update successful');</script>");
            Session.Remove("foo");

            Response.Redirect("listing.aspx?listID=" + prodID);
        }
        else
        {
            Response.Write("<script> alert('Update NOT  succesful');</script>");
        }
    }
Ejemplo n.º 3
0
 private void BrowBtn1_Click(object sender, EventArgs e)
 {
     try
     {
         if (FilePhoto.ShowDialog() == DialogResult.OK)
         {
             filepath          = FilePhoto.FileName;
             filepathTxt1.Text = filepath;
             int count = 0;
             foreach (string temp in LastList1.Items)
             {
                 if (temp == filepath)
                 {
                     count++;
                 }
             }
             if (count == 0)
             {
                 LastList1.Items.Add(filepath);
                 List <string> temp1 = new List <string>();
                 foreach (string temp in LastList1.Items)
                 {
                     temp1.Add(temp);
                 }
                 File.WriteAllLines(FolderPath + @"\config\lastphoto.lst", temp1);
             }
             type = 2;
         }
     }
     catch (Exception ex)
     {
         Error error = new Error();
         error.ShowError(ex);
         error.ShowDialog();
         error.Dispose();
     }
 }
Ejemplo n.º 4
0
    protected void btn_Insert_Click(object sender, EventArgs e)
    {
        int    result   = 0;
        string image    = "";
        string category = "";

        decimal budget = decimal.Parse(budgetID.Text);

        if (FilePhoto.HasFile == true)
        {
            image = "Images\\" + FilePhoto.FileName;
        }


        string custEmail = Session["user"].ToString();

        Listings prod = new Listings(); //tb_ProductCat can change to ddl_ProdCat

        result = prod.ListingInsert(listingTitleID.Text, descID.Text, (FilePhoto.FileName).ToString(), budget, custEmail);

        if (result > 0)
        {
            string saveimg = Server.MapPath("") + "\\" + image;
            FilePhoto.SaveAs(saveimg);

            //loadProductInfo();
            //loadProduct();
            //clear1();

            Response.Write("<script> alert('Insert successful');</script>");
        }
        else
        {
            Response.Write("<script> alert('Insert NOT  succesful');</script>");
        }
    }