protected void btndel_Click(object sender, EventArgs e) { string value = hfdinsid.Value; tbl_Speciality_Document_Detail obj = new tbl_Speciality_Document_Detail(); obj.Document_ID = Convert.ToInt32(value); Person_Details.Licensing_Details.DeleteDocumentSpeciality(obj.Document_ID); altbox1("Record deleted successfully."); hfdinsid.Value = "0"; }
protected void btn_upload_Click(object sender, EventArgs e) { string filename = ""; if (hfddocid.Value == "0") { if (upddocument.HasFile) { filename = upddocument.PostedFile.FileName; } tbl_Speciality_Document_Detail pdd = new tbl_Speciality_Document_Detail(); pdd.Document_ID = Convert.ToInt32(hfddocid.Value); string guid = Guid.NewGuid().ToString().Replace("-", string.Empty); guid = guid + DateTime.Now.ToShortDateString().Replace("/", string.Empty).Replace(":", string.Empty); string fext = Path.GetExtension(upddocument.PostedFile.FileName); if (upddocument.HasFile) { string url = System.Configuration.ConfigurationManager.AppSettings["lmsdoclink"].ToString() + DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/"; pdd.docpath = url + guid + fext; } pdd.Person_ID = Convert.ToInt32(hfdperid.Value); pdd.Document_Date = Convert.ToDateTime(txt_date.Text); pdd.DocType = Convert.ToInt32(ddl_doctype.SelectedValue); pdd.Description = filename; pdd.Modified_By = Convert.ToInt32(Session["UID"].ToString()); pdd.Modified_Date = Convert.ToDateTime(DateTime.Now.ToShortDateString()); int docid = Person_Details.Licensing_Details.InsertDocumentspeciality(pdd); if (upddocument.HasFile) { if (!Directory.Exists(System.Configuration.ConfigurationManager.AppSettings["docpath"].ToString() + "\\" + DateTime.Now.Year.ToString())) { Directory.CreateDirectory(System.Configuration.ConfigurationManager.AppSettings["docpath"].ToString() + "\\" + DateTime.Now.Year.ToString()); } if (!Directory.Exists(System.Configuration.ConfigurationManager.AppSettings["docpath"].ToString() + "\\" + DateTime.Now.Year.ToString() + "\\" + DateTime.Now.Month.ToString())) { Directory.CreateDirectory(System.Configuration.ConfigurationManager.AppSettings["docpath"].ToString() + "\\" + DateTime.Now.Year.ToString() + "\\" + DateTime.Now.Month.ToString()); } upddocument.SaveAs(System.Configuration.ConfigurationManager.AppSettings["docpath"].ToString() + "\\" + DateTime.Now.Year.ToString() + "\\" + DateTime.Now.Month.ToString() + "\\" + guid + fext); } altbox1("Record inserted successfully."); } }
protected void btnedit_Click(object sender, EventArgs e) { string value = hfdinsid.Value; tbl_Speciality_Document_Detail obj = Person_Details.Licensing_Details.Edit_SpecailityInspection(Convert.ToInt32(value)); hfddocid.Value = obj.Document_ID.ToString(); if (ddl_Doctypeedit.Items.FindByValue(obj.DocType.ToString()) != null) { ddl_Doctypeedit.Items.FindByValue(obj.DocType.ToString()).Selected = true; } txt_editDate.Text = Convert.ToDateTime(obj.Document_Date).ToString("MM/dd/yyyy"); string js = "Popup();"; ScriptManager.RegisterStartupScript(Page, GetType(), "scr", js, true); }