示例#1
0
 void CtlGrid_btnDeleteClicked(int rowID)
 {
     try
     {
         varID = Convert.ToInt32(objScriptCollection[rowID].ID);
         MessageBoxResult r = System.Windows.MessageBox.Show("Do You Really Want To Delete This Record ?", "Delete Script", MessageBoxButton.YesNo, MessageBoxImage.Question);
         if (r == MessageBoxResult.Yes)
         {
             ClsScript.Delete(varID);
             System.Windows.MessageBox.Show("Record Deleted!!", "Group Script", MessageBoxButton.OK, MessageBoxImage.Information);
             funSetGrid();
         }
     }
     catch (Exception ex)
     {
         VMuktiHelper.ExceptionHandler(ex, "CtlGrid_btnDeleteClicked", "CtlScript.xaml.cs");
     }
 }
示例#2
0
        void btnSave_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            try
            {
                ClsScript d = new ClsScript();

                if (txtName.Text.Trim() == "" || txtName.Text.Length > 100)
                {
                    System.Windows.MessageBox.Show("Script Name Can't Be Left Blank or Script name can not more than 100 characters.", "-> Script Name", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    txtName.Focus();
                    txtName.Text = txtName.Text.Trim();
                    return;
                }

                if (cmbScriptType.Text.Trim() == "")
                {
                    System.Windows.MessageBox.Show("Select A Script Type", "-> Script Type", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    cmbScriptType.Focus();
                    return;
                }

                if (varState == 0)
                {
                    d.ID = -1;
                }
                else
                {
                    d.ID = varID;
                }
                string   strZipFile = txtScriptURL.Text;
                string[] str        = strZipFile.Split('\\');

                d.ScriptName = txtName.Text;
                d.ScriptURL  = txtScriptURL.Text;
                d.IsActive   = (bool)chkIsActive.IsChecked;
                ComboBoxItem l = new ComboBoxItem();
                l = (ComboBoxItem)cmbScriptType.SelectedItem;

                d.ScriptTypeID = Convert.ToInt32(l.Tag);
                d.CreatedBy    = VMuktiAPI.VMuktiInfo.CurrentPeer.ID;

                int gID = d.Save();

                if (gID == 0)
                {
                    MessageBox.Show("Duplicate Entry For Script Name Is Not Allowed !!", "-> Script ", MessageBoxButton.OK, MessageBoxImage.Information);
                }

                else
                {
                    System.Windows.MessageBox.Show("Record Saved Successfully!!");
                    funSetGrid();
                    varState = 0;
                    FncClearAll();
                }
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "btnSave_Click", "CtlScript.xaml.cs");
            }
        }
        void btnSave_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            try
            {
                ClsScript d = new ClsScript();

                if (txtName.Text.Trim() == "" || txtName.Text.Length > 100)
                {
                    System.Windows.MessageBox.Show("Script Name Can't Be Left Blank or Script name can not more than 100 characters.", "-> Script Name", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    txtName.Focus();
                    txtName.Text = txtName.Text.Trim();
                    return;
                }

                if (cmbScriptType.Text.Trim() == "")
                {
                    System.Windows.MessageBox.Show("Select A Script Type", "-> Script Type", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    cmbScriptType.Focus();
                    return;
                }

                if (varState == 0)
                {
                    d.ID = -1;
                }
                else
                {
                    d.ID = varID;
                }
                string strZipFile = txtScriptURL.Text;
                string[] str = strZipFile.Split('\\');

                d.ScriptName = txtName.Text;
                d.ScriptURL = txtScriptURL.Text;
                d.IsActive = (bool)chkIsActive.IsChecked;
                ComboBoxItem l = new ComboBoxItem();
                l = (ComboBoxItem)cmbScriptType.SelectedItem;

                d.ScriptTypeID = Convert.ToInt32(l.Tag);
                d.CreatedBy = VMuktiAPI.VMuktiInfo.CurrentPeer.ID;

                int gID = d.Save();

                if (gID == 0)
                {
                    MessageBox.Show("Duplicate Entry For Script Name Is Not Allowed !!", "-> Script ", MessageBoxButton.OK, MessageBoxImage.Information);
                }

                else
                {
                    System.Windows.MessageBox.Show("Record Saved Successfully!!");
                    funSetGrid();
                    varState = 0;
                    FncClearAll();
                }


            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "btnSave_Click", "CtlScript.xaml.cs");
            }

        }