protected void ImgUpload_Click(object sender, EventArgs e) { try { // Dm.IEmpId = EmpId.Text.ToString(); Dm.IEmpId = EmployeeId.SelectedItem.Value.ToString(); if (ImageFileUpload1.HasFile) { extn = System.IO.Path.GetExtension(ImageFileUpload1.FileName); // path = Server.MapPath("\\PIMS\\UI\\Image\\"); path = Server.MapPath("..\\UI\\Image\\"); ImageName = ImageFileUpload1.FileName; ImageFileUpload1.SaveAs(path + ImageName); etn = ImageName; //Label1.Text = path; } else { etn = "No File"; } Dm.EmpImg = etn.ToString(); Dm.EmpImgUpload(Dm); } catch (Exception e1) { } }
public void clear() { EmployeeIdTextBox.Text = ""; EmployeeTextBox.Text = ""; DepartmentTextBox.Text = ""; DesignationTextBox.Text = ""; AfterTextBox.Text = ""; BeforeTextBox.Text = ""; SubjectTextBox.Text = ""; BenefitsTextBox.Text = ""; CategoryCheckBoxList.ClearSelection(); ImageFileUpload1.Dispose(); ImageFileUpload2.Dispose(); ImageFileUpload3.Dispose(); }
public void Insert() { DataSet Ds = new DataSet(); try { NSM.IdeaId = SIdeaId.ToString().Trim(); NSM.IDepID = SIDepID.ToString(); NSM.IDesID = SIDesID.ToString(); NSM.IEmpId = EmployeeIdTextBox.Text.ToString().TrimStart().TrimEnd(); NSM.Date = System.DateTime.Now.ToString("yyyy-MM-dd").ToString().Trim(); NSM.Subject = SubjectTextBox.Text.ToString().TrimStart().TrimEnd(); NSM.Benefits = BenefitsTextBox.Text.ToString().TrimStart().TrimEnd(); for (int i = 0; i < CategoryCheckBoxList.Items.Count; i++) { if (CategoryCheckBoxList.Items[i].Selected) { k = k + CategoryCheckBoxList.Items[i].Text + ", "; } } NSM.Category = k.ToString().TrimStart().TrimEnd(); NSM.Before = BeforeTextBox.Text.ToString().TrimStart().TrimEnd(); NSM.After = AfterTextBox.Text.ToString().TrimStart().TrimEnd(); if (ImageFileUpload1.HasFile) { extn = System.IO.Path.GetExtension(ImageFileUpload1.FileName); //path = Server.MapPath("\\PIMS\\UI\\Image\\"); path = Server.MapPath("..\\UI\\Image\\"); ImageName = ImageFileUpload1.FileName; ImageFileUpload1.SaveAs(path + ImageName); etn = ImageName; //Label1.Text = path; } else { etn = "No File"; } NSM.FileUpload1 = etn.ToString(); if (ImageFileUpload2.HasFile) { extn = System.IO.Path.GetExtension(ImageFileUpload2.FileName); // path = Server.MapPath("\\PIMS\\UI\\Image\\"); path = Server.MapPath("..\\UI\\Image\\"); ImageName = ImageFileUpload2.FileName; ImageFileUpload2.SaveAs(path + ImageName); etn = ImageName; //Label1.Text = path; } else { etn = "No File"; } NSM.FileUpload2 = etn.ToString(); if (ImageFileUpload3.HasFile) { extn = System.IO.Path.GetExtension(ImageFileUpload3.FileName); // path = Server.MapPath("\\PIMS\\UI\\Image\\"); path = Server.MapPath("..\\UI\\Image\\"); ImageName = ImageFileUpload3.FileName; ImageFileUpload3.SaveAs(path + ImageName); etn = ImageName; //Label1.Text = path; } else { etn = "No File"; } NSM.FileUpload3 = etn.ToString(); NSM.Status = status.ToString().TrimStart().TrimEnd(); NSM.Approved = Approved.ToString().Trim(); NSM.Remark2 = "UnRead"; NSM.Remark2 = Remark2.ToString().Trim(); NSM.Remark3 = Remark3.ToString().Trim(); NSM.Remark4 = Remark4.ToString().Trim(); NSM.SuggestionInsert(NSM); ClientScript.RegisterStartupScript(this.GetType(), "randomtext", "alertme('Your Suggestion Posted')", true); //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Your Suggestion Posted')", true); i = 1; Response.Redirect("Default.aspx?value=" + NSM.IEmpId, false); } catch (Exception) { //throw new Exception("Error Initializing Data Class." + Environment.NewLine + ex.Message); } }