public ActionResult UpdateRecord(setup_StaffRepo staffRepo) { var mTitle = staffRepo.Staff_Id; if (mTitle == string.Empty) { X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = "Please select a staff to update.", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Width = 350 }); return(this.Direct()); } staffRepo.SaveRecord(staffRepo); X.Msg.Show(new MessageBoxConfig { Title = "Success", Message = "Staff Successfully updated.", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); Store store = X.GetCmp <Store>("staffStore"); store.Reload(); return(this.Direct()); }
public ActionResult SaveRecord(setup_StaffRepo staffRepo) { try { if (ModelState.IsValid) { staffRepo.Staff_Status = "HIRED"; } { this.staffRepo.SaveRecord(staffRepo); X.Msg.Show(new MessageBoxConfig { Title = "Success", Message = "Saved Successfully.", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); Store store = X.GetCmp <Store>("staffStore"); store.Reload(); var reset = X.GetCmp <FormPanel>("frmAddSatff"); reset.Reset(); return(this.Direct()); } string messages = string.Join(Environment.NewLine, ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage).FirstOrDefault()); X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = messages, // " Insufficient data. Operation Aborted", Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.ERROR, Width = 350 }); return(this.Direct()); } catch (System.Exception ex) { string ora_code = ex.Message.Substring(0, 9); if (ora_code == "ORA-20000") { ora_code = "Record already exist. Process aborted.."; } else if (ora_code == "ORA-20100") { ora_code = "Record is uniquely defined in the system. Process aborted.."; } else { ora_code = ex.ToString(); } X.Msg.Show(new MessageBoxConfig { Title = "Error", Message = ora_code, Buttons = MessageBox.Button.OK, Icon = MessageBox.Icon.INFO, Width = 350 }); return(this.Direct()); } }