Exemplo n.º 1
0
        private void add_cust(object sender, RoutedEventArgs e)
        {
            MyDialog dialog = new MyDialog(typeof(CustObj), "添加客户");

            dialog.ShowDialog();
            if (dialog.DialogResult == false)
            {
                return;
            }

            ObservableCollection <CustObj> newList = dialog.getObjectList();
            List <String> errorList = new List <string>();

            foreach (var item in newList)
            {
                int operatorCode = helper.Cust_add(item.客户号.Trim(), item.姓名.Trim(), item.电话.Trim(), item.地址.Trim());
                if (operatorCode == 0)
                {
                    resetList();
                    return;
                }
                else
                {
                    errorList.Add(item.客户号 + " : " + Sql.ErrorCodeToString(operatorCode));
                }
            }
            if (errorList.Count != 0)
            {
                MessageBox.Show(MainWindow.MakeErrorString(errorList), "添加客户出错");
            }
        }
Exemplo n.º 2
0
        private void EditAction(object sender, RoutedEventArgs e)
        {
            var index = Chargo_DataGrid.SelectedIndex;

            Console.WriteLine(list[index]);
            MyDialog dialog = new MyDialog(list[index], false, "修改货物信息");

            dialog.ShowDialog();
            if (dialog.DialogResult == false)
            {
                return;
            }

            //list[index] = dialog.getObjResult() as EmpObj;
            var item = dialog.getObjResult() as CarObj;
            var key  = list[index].货物号;

            if (item.货物号 != key)
            {
                helper.Cargo_alter(key, 6, item.货物号, 0);
                key = item.货物号;
            }
            helper.Cargo_alter(key, 1, item.称, 0);
            helper.Cargo_alter(key, 2, item.进价.ToString(), 1);
            helper.Cargo_alter(key, 3, item.售价.ToString(), 1);
            helper.Cargo_alter(key, 5, item.库存量.ToString(), 1);
            resetList();
        }
Exemplo n.º 3
0
        private void AddChargo(object sender, RoutedEventArgs e)
        {
            MyDialog dialog = new MyDialog(typeof(CarObj), "添加货物信息");

            dialog.ShowDialog();
            if (dialog.DialogResult == false)
            {
                return;
            }

            ObservableCollection <CarObj> newList = dialog.getObjectList();
            List <String> errorList = new List <string>();

            foreach (var item in newList)
            {
                int operatorCode = helper.Cargo_add(item.货物号.Trim(), item.称.Trim(), item.进价.ToString(), item.售价.ToString(), item.库存量.ToString());
                if (operatorCode == 0)
                {
                    resetList();
                    return;
                }
                else
                {
                    errorList.Add(item.货物号 + " : " + Sql.ErrorCodeToString(operatorCode));
                }
            }
            if (errorList.Count != 0)
            {
                MessageBox.Show(MainWindow.MakeErrorString(errorList), "添加货物出错");
            }
        }
Exemplo n.º 4
0
        private void AddEmp(object sender, RoutedEventArgs e)
        {
            MyDialog dialog = new MyDialog(typeof(EmpObj), "添加员工信息");

            dialog.ShowDialog();
            if (dialog.DialogResult == false)
            {
                return;
            }
            ObservableCollection <EmpObj> newList = dialog.getObjectList();
            List <String> errorList = new List <string>();

            foreach (var item in newList)
            {
                int operatorCode = helper.ManEmp_add(item.工号.Trim(), item.姓名.Trim(), item.性别.ToString(), item.年龄.ToString(), item.基本工资.ToString(), md5helper.encrypt("123456"), 0);
                if (operatorCode == 0)
                {
                    resetList();
                    return;
                }
                else
                {
                    errorList.Add(item.工号 + " : " + Sql.ErrorCodeToString(operatorCode));
                }
            }
            if (errorList.Count != 0)
            {
                MessageBox.Show(MainWindow.MakeErrorString(errorList), "添加员工出错");
            }
        }
Exemplo n.º 5
0
    public void miFileOpen_Click(object sender, System.EventArgs e)
    {
        // Implementation goes here
        MyDialog dlgFileOpen = new MyDialog("File Open");

        dlgFileOpen.ShowDialog();
        if (dlgFileOpen.ChoseOpen)
        {
            // If the user has asked to OPEN a Feed, we'll add this to the list
            // Create RSSFeed container
            RSSFeed feed = new RSSFeed();
            feed.feedName = dlgFileOpen.txtRssURL.Text;
            feed.feedURL  = dlgFileOpen.txtRssURL.Text;
            // Add it to our list
            feeds.Add(feed);
            Console.WriteLine("->Added 'feed' to 'feeds' list");
            // Refresh our Subscription control
            RefreshSubscriptions();
            // Set the current channel
            if (currentChannel == null)
            {
                currentChannel = new Channel();
            }
            currentChannel.InitialiseFromURL(feed.feedURL);
            // Read the Threads associated with the current channel
            RefreshThreads(currentChannel);
            // Debug
            Console.Out.WriteLine(dlgFileOpen.txtRssURL.Text);
        }
    }
Exemplo n.º 6
0
        private void OnMonthInterventions()
        {
            var dialog = new MyDialog();

            if (dialog.ShowDialog() == true)
            {
                ExcelParser.Instance.SetFileName(@Path);
                ExcelParser.Instance.GetPatientsValues(dialog.ResponseText);
            }
        }
 private void button1_Click(object sender, EventArgs e)
 {
     if (theDialog.Visible)
     {
         theDialog.BringToFront();
     }
     else
     {
         theDialog.ShowDialog();
     }
 }
 private void BtnPesquisar_Click(object sender, EventArgs e)
 {
     MyDialog.Filter = "(xlsx) | *.xlsx";
     if (MyDialog.ShowDialog() == DialogResult.OK)
     {
         B.Iniciar(MyDialog.FileName, User, Pass, RTxtMensagem.Text, MyDialog, CbPicture);
     }
     else
     {
         MessageBox.Show("Este arquivo não é do tipo .xlsx", "ERRO!",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 9
0
        private void btnChangeUser_Click(object sender, RoutedEventArgs e)
        {
            var dialogUserName = new MyDialog("Enter username:"******"Enter password:", true);

            if (dialogPassword.ShowDialog() == true)
            {
                Properties.Settings.Default.PASSWORD = dialogPassword.ResponseText;
            }
            Properties.Settings.Default.Save();
        }
Exemplo n.º 10
0
    void OnOpen(object sender, EventArgs e)
    {
        // create the dialog
        MyDialog dlg = new MyDialog();

        // initialize the input box with a sample string
        dlg.UserFile = "Math.dll";

        if (dlg.ShowDialog(this) == DialogResult.OK)
        {
            // If the dialog was dismissed with the OK button,
            // extract the user input and open the .dll file
            dllFileName = dlg.UserFile;
            dllLoaded   = true; // set the flag to change the form

            #region Reflection Stuff
            Assembly a    = Assembly.LoadFrom(dllFileName);
            Type     type = a.GetType(dllFileName);
            Console.WriteLine(a);
            Console.WriteLine(type);

            foreach (Type className in a.GetExportedTypes())
            {
                // we use a dynamic object to get the classes inside the .dll
                dynamic c = Activator.CreateInstance(className);
                Console.WriteLine(c);
                classCount++;
                classList[classCount] = c.ToString();

                // we're looking for these exact methods
                // maybe later on, look into dynamically listing all methods
                Console.WriteLine(className.GetMethod("addition"));
                Console.WriteLine(className.GetMethod("subtraction"));
                Console.WriteLine(className.GetMethod("multiplication"));
                Console.WriteLine(className.GetMethod("division"));
                //Console.WriteLine(myMethodInfo);
            }
            #endregion

            Invalidate();
            CalcForm calc = new CalcForm();
            //Invalidate();
        }
    }
Exemplo n.º 11
0
    // miFileOpen_Click - Event for the user requesting that a feed is opened
    //
    public void miFileOpen_Click(object sender, System.EventArgs e)
    {
        // Show the Dialog box to get the URL for the RSS Feed
        MyDialog dlgFileOpen = new MyDialog("Open Feed");

        dlgFileOpen.ShowDialog();
        if (dlgFileOpen.ChoseOpen)
        {
            // Whether we found the feed subscription or not, clear the list of channel subscriptions
            ClearSubscriptions();

            // Check that the feed hasn't already been added, no point in having two
            int     feedIndex = FindFeed(dlgFileOpen.txtRssURL.Text);
            RSSFeed feed      = new RSSFeed();
            // Feed found, display a message saying as much
            if (feedIndex != -1)
            {
                // Show a message dialog box ...
                MessageBox.Show("You have already opened this feed and so it will not be opened twice");
                // ...and point the current feed at the feed found
                feed = (RSSFeed)feeds[feedIndex];
            }
            // Feed not found, add it
            if (feedIndex == -1)
            {
                // If the user has asked to OPEN a Feed, we'll add this to the list
                // Create RSSFeed container
                feed.feedName = dlgFileOpen.txtRssURL.Text;
                feed.feedURL  = dlgFileOpen.txtRssURL.Text;
                // Add it to our list
                feedIndex = feeds.Add(feed);
                // Refresh our Subscription control
                RefreshSubscriptions();
            }
            // Initialise the current channel
            InitialiseCurrentChannel(feed.feedURL);
            // Read the Threads associated with the current channel
            RefreshThreads(currentChannel);
            lstSubscriptions.SelectedIndex = feedIndex; // Ensure the last opened or selected is highlighted
        }
    }
Exemplo n.º 12
0
        private void EditAction(object sender, RoutedEventArgs e)
        {
            var index = Emp_DataGrid.SelectedIndex;

            Console.WriteLine(list[index]);
            MyDialog dialog = new MyDialog(list[index], false, "修改员工信息");

            dialog.ShowDialog();
            if (dialog.DialogResult == false)
            {
                return;
            }
            Console.WriteLine(dialog.DialogResult);
            if (dialog.DialogResult == true)
            {
                //list[index] = dialog.getObjResult() as EmpObj;
                var item = dialog.getObjResult() as EmpObj;
                var key  = list[index].工号;
                int operatorCode;
                if (item.工号 != key)
                {
                    operatorCode = helper.ManEmp_alter(key, 8, item.工号, 0);
                    if (operatorCode != 0)
                    {
                        return;
                    }
                    key = item.工号;
                }
                helper.ManEmp_alter(key, 1, item.姓名, 0);
                helper.ManEmp_alter(key, 2, item.性别.ToString(), 0);
                helper.ManEmp_alter(key, 3, item.年龄.ToString(), 1);
                helper.ManEmp_alter(key, 5, item.基本工资.ToString(), 1);
                helper.ManEmp_alter(key, 7, ((int)item.用户类型).ToString(), 1);
                resetList();
            }
        }
Exemplo n.º 13
0
        private void OpenNewDBConnectionWindow(object sender, SelectionChangedEventArgs e)
        {
            if ((comboBoxDatabase.SelectedValue as ListBoxItem).Content.ToString().Contains("Create new connection"))
            {

                var dialog = new MyDialog();
                if (dialog.ShowDialog() == true)
                {
                    string newHostname = dialog.txtBoxNewDBHostname.Text;
                    string newSID = dialog.txtBoxNewDBSID.Text;
                    string newUsername = dialog.txtBoxNewDBUsername.Text;
                    string newPassword = dialog.txtBoxNewDBPassword.Text;

                    // Shoud save to xml file containing all connections. Later!!!
                }
            }
        }
Exemplo n.º 14
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Controls.Button button = sender as System.Windows.Controls.Button;
            Appointment user = button.DataContext as Appointment;

            if (System.Windows.MessageBox.Show("Are you sure you want to cancel this appointment" + " " + " ?", "Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                var dialog = new MyDialog();
                if (dialog.ShowDialog() == true)
                {
                   
                    if (dialog.notify == true)
                    {
                        Messenger.Send(App.amApp, "Your appointment with" + _practitionerList.First(x => x.Id == user.Practitioner).Practice + "  on:" + user.Dated + " During:" + user.StartTime + ": " + user.EndTime + "has been cancelled because " + dialog.ResponseText, _patientList.First(x => x.Id == user.Patient.ToString()).Phone);
                    }
                    user.Delete(user.Id.ToString());
                    Refresh();
                }


            }
            else
            {

                return;
            }
        }
Exemplo n.º 15
0
 private void button1_Click(object sender, EventArgs e)
 {
     theDialog.ShowDialog();
 }
Exemplo n.º 16
0
    void OnOpen(object sender, EventArgs e)
    {
        // create the dialog
        MyDialog dlg = new MyDialog();

        // initialize the input box with a sample string
        dlg.UserFile = "Math.dll";

        if (dlg.ShowDialog(this) == DialogResult.OK)
        {
            // If the dialog was dismissed with the OK button,
            // extract the user input and open the .dll file
            dllFileName = dlg.UserFile;
            dllLoaded = true; // set the flag to change the form

            #region Reflection Stuff
            Assembly a = Assembly.LoadFrom(dllFileName);
            Type type = a.GetType(dllFileName);
            Console.WriteLine(a);
            Console.WriteLine(type);

            foreach(Type className in a.GetExportedTypes())
            {
                // we use a dynamic object to get the classes inside the .dll
                dynamic c = Activator.CreateInstance(className);
                Console.WriteLine(c);
                classCount++;
                classList[classCount] = c.ToString();

                // we're looking for these exact methods
                // maybe later on, look into dynamically listing all methods
                Console.WriteLine(className.GetMethod("addition"));
                Console.WriteLine(className.GetMethod("subtraction"));
                Console.WriteLine(className.GetMethod("multiplication"));
                Console.WriteLine(className.GetMethod("division"));
                //Console.WriteLine(myMethodInfo);
            }
            #endregion

            Invalidate();
            CalcForm calc = new CalcForm();
            //Invalidate();
        }
    }