public ActionResult Create(SOP sop) { try { if (ModelState.IsValid) { ViewBag.TestList = new SelectList(TestService.GetAll(), "TestID", "TestName"); sop.Formula = Convert.ToString(TempData["formula"]); if (string.IsNullOrEmpty(sop.Formula)) { ModelState.AddModelError("", "Please insert formula"); return(View(sop)); } if (SOPService.FindBy(s => s.SOPName.Trim() == sop.SOPName.Trim()).Count() > 0) { ModelState.AddModelError("", "SOP alreary exists with same name"); return(View(sop)); } sop.FileName = this.FileName; sop.Formula = Convert.ToString(TempData["formula"]); SOPService.Create(sop); ViewBag.ResultMessage = "Record inserted successfully !"; } } catch { ViewBag.ResultMessage = "Error occured"; } ResetModel(sop); return(View()); }
private static List <SOP> GetSOPList() { List <SOP> _lstSOP = new List <SOP>(); string connectString = ConfigurationManager.AppSettings["SQliteConnectionString"].ToString(); SQLiteConnection conn; SQLiteCommand cmd; conn = new SQLiteConnection(connectString); cmd = new SQLiteCommand(); cmd.CommandText = @"SELECT * from sop where isActive=1 order by sortorder"; cmd.Connection = conn; conn.Open(); SQLiteDataReader r = cmd.ExecuteReader(); while (r.Read()) { SOP _sop = new SOP(); _sop.name = r["name"].ToString(); _sop.filename = r["id"].ToString(); _lstSOP.Add(_sop); } conn.Close(); return(_lstSOP); }
public ActionResult Create(SOP sop) { try { if (ModelState.IsValid) { ViewBag.TestList = new SelectList(TestService.GetAll(), "TestID", "TestName"); sop.Formula = Convert.ToString(TempData["formula"]); if (string.IsNullOrEmpty(sop.Formula)) { ModelState.AddModelError("", "Please insert formula"); return View(sop); } if (SOPService.FindBy(s => s.SOPName.Trim() == sop.SOPName.Trim()).Count() > 0) { ModelState.AddModelError("", "SOP alreary exists with same name"); return View(sop); } sop.FileName = Convert.ToString(TempData.Peek("fileName")); sop.Formula = Convert.ToString(TempData["formula"]); SOPService.Create(sop); ViewBag.ResultMessage = "Record inserted successfully !"; } } catch { ViewBag.ResultMessage = "Error occured"; } ResetModel(sop); return View(); }
public ActionResult DeleteConfirmed(int id) { SOP sop = db.SOPs.Single(s => s.SOPID == id); db.SOPs.DeleteObject(sop); db.SaveChanges(); return(RedirectToAction("Index")); }
// // GET: /SOP/Details/5 public ActionResult Details(int id = 0) { SOP sop = db.SOPs.Single(s => s.SOPID == id); if (sop == null) { return(HttpNotFound()); } return(View(sop)); }
/// <summary> /// Reset Model Data /// </summary> /// <param name="product"></param> private void ResetModel(SOP sop) { sop.SID = string.Empty; sop.SOPDescription = string.Empty; sop.SOPHtml = string.Empty; sop.SOPName = string.Empty; sop.TestID = 0; sop.FileName = string.Empty; sop.Formula = string.Empty; this.ModelState.Clear(); }
// // GET: /SOP/Edit/5 public ActionResult Edit(int id = 0) { SOP sop = db.SOPs.Single(s => s.SOPID == id); if (sop == null) { return(HttpNotFound()); } ViewBag.BureauID = new SelectList(db.Office_Bureau, "BureauID", "Name", sop.BureauID); return(View(sop)); }
public ActionResult Create(SOP sop) { if (ModelState.IsValid) { db.SOPs.AddObject(sop); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BureauID = new SelectList(db.Office_Bureau, "BureauID", "Name", sop.BureauID); return(View(sop)); }
public ActionResult Edit(SOP sop) { if (ModelState.IsValid) { db.SOPs.Attach(sop); db.ObjectStateManager.ChangeObjectState(sop, EntityState.Modified); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BureauID = new SelectList(db.Office_Bureau, "BureauID", "Name", sop.BureauID); return(View(sop)); }
public void AddUserSOP(SOP objUserSOP) { try { AdminDAL objAdminDAL = new AdminDAL(); objAdminDAL.AddUserSOP(objUserSOP); } catch (Exception es) { throw es; } }
public void UpdateSOPData(SOP objSOPData) { try { AdminDAL objAdminDAL = new AdminDAL(); objAdminDAL.UpdateSOPData(objSOPData); } catch (Exception ex) { throw ex; } }
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); } }
private static List <SOP> GetSOPListFromDB() { try { List <SOP> _lstSOP = new List <SOP>(); string connectString = ConfigurationManager.AppSettings["SQliteConnectionString"].ToString(); // SQLiteConnection conn; SQLiteCommand cmd; SQLiteConnection.ClearAllPools(); using (SQLiteConnection conn = new SQLiteConnection(connectString)) { //conn = new SQLiteConnection(conn); cmd = new SQLiteCommand(); cmd.CommandText = @"SELECT * from sop order by sortorder"; cmd.Connection = conn; conn.Open(); SQLiteDataReader r = cmd.ExecuteReader(); while (r.Read()) { SOP _sop = new SOP(); _sop.name = r["name"].ToString(); _sop.filename = r["filename"].ToString(); _sop.status = r["isActive"].ToString(); _sop.sortOrder = r["sortorder"].ToString(); _sop.id = Convert.ToInt32(r["id"]); _lstSOP.Add(_sop); } } // conn.Close(); return(_lstSOP); } catch (Exception ex) { Utility.Utility.StoreError("SOP_GetSOPListFromDB", ex.Message); return(null); } }
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); } }
public ActionResult Edit(SOP sop) { try { if (ModelState.IsValid) { sop.Formula = Convert.ToString(TempData["formula"]); sop.FileName = Convert.ToString(TempData.Peek("fileName")); SOPService.Update(sop); ViewBag.ResultMessage = "Record updated successfully !"; } } catch { ViewBag.ResultMessage = "Error occured"; } ViewBag.TestList = new SelectList(TestService.GetAll(), "TestID", "TestName"); return View(sop); }
// load / initialize all the variables public DebrisFlowMapViewModel(MainMap map, DebrisFlowRecord debrisFlowRecord, DebrisFlowCollection debrisFlowCollection) { this.debrisFlowRecord = debrisFlowRecord; this.debrisFlowCollection = debrisFlowCollection; this.dialogCoordinator = new DialogCoordinator(); //set up map controller mapController = new MapController(map); mapController.LocationChanged += OnLocationChanged; //Set up SOP var debrisflowsop = new DebrisFlowSOP(); this.sop = debrisflowsop.GetSOP(); this.sopDisplay = new SOPDisplay(); AddSOPTypes(debrisflowsop); SetUpSOPLocation(sop); }
public ActionResult UploadFiles(FormCollection collection, SOP puser) { alert = new Alert(); try { if (Session["fName"] == null) { return(RedirectToAction("Index", "Login")); } string _imgname = string.Empty; //if (System.Web.HttpContext.Current.Request.Files.AllKeys.Any()) //{ var userPicName = collection["Name"]; var isActive = collection["IsActive"]; var sortOrder = collection["SortOrder"]; int flag = 0; if (isActive == "Yes") { flag = 1; } var pic = System.Web.HttpContext.Current.Request.Files["MyImages"]; if (pic.ContentLength > 0) { var fileName = Path.GetFileName(pic.FileName); var _ext = Path.GetExtension(pic.FileName); if (_ext.ToLower() == ".jpg" || _ext.ToLower() == ".jpeg") { string picname = ""; //conn = new SQLiteConnection(connectString); using (SQLiteConnection conn = new SQLiteConnection(connectString)) { cmd = new SQLiteCommand(); cmd.CommandText = @" select max(id) from sop where name = '" + userPicName.ToLower() + "'"; cmd.Connection = conn; conn.Open(); picname = cmd.ExecuteScalar().ToString(); // conn.Close(); } if (picname == null || picname == "") { using (SQLiteConnection conn = new SQLiteConnection(connectString)) { cmd = new SQLiteCommand(); cmd.CommandText = @"insert into sop (name,filename,sortorder,isActive) VALUES('" + userPicName.ToLower() + "','" + fileName.ToLower() + "' ,'" + sortOrder + "', '" + flag + "')"; cmd.Connection = conn; conn.Open(); cmd.ExecuteNonQuery(); //conn.Close(); } using (SQLiteConnection conn = new SQLiteConnection(connectString)) { cmd = new SQLiteCommand(); cmd.CommandText = @"select max(id) from sop where name ='" + userPicName.ToLower() + "'"; cmd.Connection = conn; conn.Open(); _imgname = cmd.ExecuteScalar().ToString(); //conn.Close(); } //_imgname = picname; var _comPath = Server.MapPath("/assets/images/SOP/") + _imgname + _ext; ViewBag.Msg = _comPath; var path = _comPath; // Saving Image in Original Mode pic.SaveAs(path); alert.status = true; alert.message = "SOP Saved !"; return(Json(alert, JsonRequestBehavior.AllowGet)); } else { alert.status = false; alert.message = "SOP already exist !"; return(Json(alert, JsonRequestBehavior.AllowGet)); } } else { alert.status = false; alert.message = "Formate not supported !"; return(Json(alert, JsonRequestBehavior.AllowGet)); } } else { alert.status = false; alert.message = "Please choose file to upload !"; return(Json(alert, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { Utility.Utility.StoreError("SOP_UploadFiles", ex.Message); alert.status = false; alert.message = "Request not processed !"; return(Json(alert, JsonRequestBehavior.AllowGet)); } }
// Set up SOP Locations on the map void SetUpSOPLocation(SOP sop) { if (mapController != null) { var locationSOP = sop.GetLocationSOP(); // takes the defined locations from SOP and add pushpins onto map foreach (SOP s in locationSOP) { mapController.AddPushPinWithCircle(s.Location, s.SOPTask); } } }
private int LoadScan(Dictionary <string, string> ScanDecodeDictionary, ObjectChangedEventArgs e) { bool addCount = false; string pstring; ScanDecodeDictionary.TryGetValue("01", out pstring); string pItemnumber = pstring; ScanDecodeDictionary.TryGetValue("17", out pstring); string pExpDt = pstring; ScanDecodeDictionary.TryGetValue("10", out pstring); string pLot = pstring; ScanDecodeDictionary.TryGetValue("21", out pstring); string pSerialNumber = pstring; int cc = 0; cc = cc++; IObjectSpace objectSpace = Application.CreateObjectSpace(); SOHeader SOH = objectSpace.CreateObject <SOHeader>(); SOH = objectSpace.GetObject <SOHeader>((SOHeader)View.CurrentObject); SOItemDistibution SID = new SOItemDistibution(SOH.Session); // lets see if the serial number exists in so CriteriaOperator SerialCriteria = CriteriaOperator.Parse("[ItemNumber] = ? and [SerialNumber] = ?", pItemnumber, pSerialNumber); SOPackingSerialNo SOPSN = (SOPackingSerialNo)objectSpace.FindObject(typeof(SOPackingSerialNo), SerialCriteria); if (SOPSN != null) { return(-1); } else // Lets add the serial number in the serial packing list { SOPSN = new SOPackingSerialNo(SOH.Session); SOPSN.SalesOrder = SOH; SOPSN.ItemNumber = pItemnumber.Substring(3); SOPSN.ShipQty = 1; SOPSN.Lot = pLot; SOPSN.ShipQty = 1; SOPSN.SerialNumber = pSerialNumber; SOPSN.Lot = pLot; SOPSN.DateEntered = System.DateTime.Today; SOPSN.UserName = SecuritySystem.CurrentUserName; SOPSN.ExpirationDate = DateTime.ParseExact(pExpDt, "yyMMdd", CultureInfo.CurrentCulture); SOPSN.Save(); SOH.Session.CommitTransaction(); addCount = true; } // lets see if item exists on the SO Packing table CriteriaOperator ItemCriteria = CriteriaOperator.Parse("[ItemNumber] = ? ", pItemnumber); SOPacking SOP = (SOPacking)objectSpace.FindObject(typeof(SOPacking), ItemCriteria); if (addCount) { if (SOP != null) { SOP.ItemQty = SOP.ItemQty++; } else { SOP = new SOPacking(SOH.Session); SOP.ItemNumber = pItemnumber; SOP.SalesOrder = SOH; SOP.ItemQty = 1; } SOP.Save(); } SOH.Save(); SOH.Session.CommitTransaction(); SOH.Reload(); SOH.SOPacking.Reload(); SOH.SoPackingSerialNumbers.Reload(); SOH.Scan = null; return(0); }
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); } }