コード例 #1
0
        public ActionResult UpdateRecord(setup_TitleRepo titleRepo)
        {
            var mTitle = titleRepo.Title_ID;

            if (mTitle == string.Empty)
            {
                X.Msg.Show(new MessageBoxConfig
                {
                    Title   = "Error",
                    Message = "Please select a title to update.",
                    Buttons = MessageBox.Button.OK,
                    Icon    = MessageBox.Icon.ERROR,
                    Width   = 350
                });
                return(this.Direct());
            }

            titleRepo.updateRecord(titleRepo);
            X.Msg.Show(new MessageBoxConfig
            {
                Title   = "Success",
                Message = "Title Successfully updated.",
                Buttons = MessageBox.Button.OK,
                Icon    = MessageBox.Icon.INFO,
                Width   = 350
            });

            Store store = X.GetCmp <Store>("titleStore");

            store.Reload();

            return(this.Direct());
        }
コード例 #2
0
        public ActionResult SaveRecord(setup_TitleRepo titleRepo)
        {
            try
            {
                if (ModelState.IsValid)

                {
                    this.titleRepo.SaveRecord(titleRepo);

                    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>("titleStore");
                    store.Reload();
                    var reset = X.GetCmp <FormPanel>("title");
                    reset.Reset();

                    return(this.Direct());
                }
                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
                });
                logger.WriteLog(ex.Message);

                return(this.Direct());
            }
        }