protected void btnAddSOP_Click(object sender, EventArgs e) { AddNewSOPRequest objAddSOP = new AddNewSOPRequest(); SOP ObjSOP = new SOP(); log4net.ILog logger = log4net.LogManager.GetLogger("File"); try { if (txtSOPtitle.Text != "") { ObjSOP.SOP_Title = txtSOPtitle.Text; } else { lblerror.Visible = true; lblerror.Text = "Please fill the Tittle ..!"; } ObjSOP.Date_From = DateTime.Now; ObjSOP.Location = getLocationIDByName1(searchid.Text); ObjSOP.SOP_Subject = txtSOPsubject.Text.Trim(); if (txtImagePath.HasFile) { string path = Server.MapPath("~/Images/"); txtImagePath.PostedFile.SaveAs(path + txtImagePath.FileName); ObjSOP.ImagePathName = txtImagePath.FileName; } else { ObjSOP.ImagePathName = ""; } AdminBLL ws = new AdminBLL(); ws.AddUserSOP(ObjSOP); lblerror.Visible = true; lblerror.Text = "Insert Successfully ..!"; BindGridWithFilter(); } catch (Exception ex) { logger.Info(ex.Message); } }
protected void btnSave_Click(object sender, EventArgs e) { log4net.ILog logger = log4net.LogManager.GetLogger("File"); try { AddNewSOPRequest objAddSOP = new AddNewSOPRequest(); SOP objSOP_Data = new SOP(); string imagepathname = hdnBTID.Value; AdminBLL ws = new AdminBLL(); if (txtImagePath.FileName != null) { if (txtImagePath.HasFile) { string path = Server.MapPath("../FileUpload/"); txtImagePath.PostedFile.SaveAs(path + txtImagePath.FileName); //HttpContext.Current.Session["ImagePath"] = Convert.ToString(path + txtImagePath.FileName); HttpContext.Current.Session["ImagePath"] = Convert.ToString(txtImagePath.FileName); } } objSOP_Data.ImagePathName = HttpContext.Current.Session["ImagePath"].ToString(); objSOP_Data.SOP_ID = txtUpdateSOPNo.Text; objSOP_Data.SOP_Title = txtUpdateSOPTitle.Text; objSOP_Data.SOP_Subject = txtUpdateSOPSubject.Text; string location_name = ddllocation.SelectedValue.ToString(); objSOP_Data.Location = getLocationById(location_name); //objSOP_Data.ImagePathName = HttpContext.Current.Session["ImagePath"].ToString(); ws.UpdateSOPData(objSOP_Data); HttpContext.Current.Items.Add(ContextKeys.CTX_COMPLETE, "UPDATE"); Server.Transfer("AlertUpdateComplete.aspx"); } catch (Exception ex) { logger.Info(ex.Message); } }
protected void btnAddSOP_Click(object sender, EventArgs e) { log4net.ILog logger = log4net.LogManager.GetLogger("File"); try { //String ZipRegex = "^[a-z A-Z 0-9]+$"; //if (Regex.IsMatch(txtSOPID.Text, ZipRegex)) //{ AddNewSOPRequest objAddSOP = new AddNewSOPRequest(); SOP ObjSOP = new SOP(); //String q = txtSOPID.Text; //DataSet ds = dal.getdataset("select SOP_ID from SOP_Master "); //int count = ds.Tables[0].Rows.Count; //if (count > 0) //{ // for (i = 0; i < count; i++) // { // String z = ds.Tables[0].Rows[i].ItemArray[0].ToString(); // if (string.Equals(q, z, StringComparison.CurrentCultureIgnoreCase)) // { // lblerror.Visible = true; // lblerror.Text = "SOP No. Already Exist ..!"; // lblerr1.Visible = true; // throw new Exception(); // } // } //} //Boolean verify = true; //String q1 = txtgenerate.Text; //DataSet ds5 = dal.getdataset("select NRICno from UserInformation"); //int count1 = ds5.Tables[0].Rows.Count; //for (i = 0; i < count1; i++) //{ // String z1 = ds5.Tables[0].Rows[i].ItemArray[0].ToString(); // if (string.Equals(q1, z1, StringComparison.CurrentCultureIgnoreCase)) // { // getLocationIDByName(ddllocation.Text.Trim()); // ObjSOP.SOP_ID = txtSOPID.Text; ObjSOP.SOP_Title = txtSOPtitle.Text; // ObjSOP.SOP_Subject = txtSOPsubject.Text; ObjSOP.Date_From = DateTime.Now; // ObjSOP.Created_By = txtgenerate.Text; ObjSOP.Location = getLocationIDByName1(searchid.Text); if (txtImagePath.HasFile) { string path = Server.MapPath("~/FileUpload/"); txtImagePath.PostedFile.SaveAs(path + txtImagePath.FileName); ObjSOP.ImagePathName = txtImagePath.FileName; } AdminBLL ws = new AdminBLL(); ws.AddUserSOP(ObjSOP); // verify = false; lblerror.Visible = true; lblerror.Text = "Insert Successfully ..!"; // clearall(); // BindGridWithFilter(); // // HttpContext.Current.Items.Add("COMPLETE", "INSERT"); // // Server.Transfer("AlertUpdateComplete.aspx"); // } //} //if(verify) // { // lblerror.Visible = true; // lblerror.Text = "Invalid NRIC/FIN No. ..!"; // lblerr2.Visible = true; // } //} //else //{ // lblerror.Visible = true; // lblerror.Text = "Invalid SOP No. ..!"; // lblerr1.Visible = true; //} } catch (Exception ex) { logger.Info(ex.Message); } }
protected void btnAddSOP_Click(object sender, EventArgs e) { SpaMaster MyMasterPage = (SpaMaster)Page.Master; AddNewSOPRequest objAddSOP = new AddNewSOPRequest(); SOP ObjSOP = new SOP(); log4net.ILog logger = log4net.LogManager.GetLogger("File"); UploadedFile f = null; try { if (txtSOPtitle.Text != "") { ObjSOP.SOP_Title = txtSOPtitle.Text; } else { MyMasterPage.ShowErrorMessage("Please fill the Tittle ..!"); return; //lblerror.Visible = true; //lblerror.Text = "Please fill the Tittle ..!"; } ObjSOP.Date_From = DateTime.Now; ObjSOP.Location = getLocationIDByName1(searchid.Text); ObjSOP.SOP_Subject = txtSOPsubject.Text.Trim(); if (txtImagePathAdd.UploadedFiles.Count > 0) { f = txtImagePathAdd.UploadedFiles[0]; } if (f != null) { if (f.FileName.Length > 0) { string path = Server.MapPath("~/Images/"); // txtImagePathAdd.PostedFile.SaveAs(path + f.FileName); f.SaveAs(path + f.FileName); ObjSOP.ImagePathName = f.FileName; } } else { ObjSOP.ImagePathName = ""; } AdminBLL ws = new AdminBLL(); ws.AddUserSOP(ObjSOP); MyMasterPage.ShowErrorMessage("Record Inserted Successfully..!"); //lblerror.Visible = true; //lblerror.Text = "Insert Successfully ..!"; clearall(); BindGrid(); } catch (Exception ex) { logger.Info(ex.Message); } }