Example #1
0
        private void add_order(object sender, RoutedEventArgs e)
        {
            MyDialog dialog = new MyDialog(typeof(OrderObj), "添加订单信息");

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

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

            foreach (var item in newList)
            {
                int operatorCode = helper.Order_add(item.订单号.Trim(), item.销售日期.ToString().Trim(), item.货物编号.Trim(), item.客户编号.Trim(), item.员工编号.Trim(), item.货物数量.ToString().Trim());
                if (operatorCode == 0)
                {
                    resetList();
                    return;
                }
                else
                {
                    errorList.Add(item.订单号 + " : " + Sql.ErrorCodeToString(operatorCode));
                }
            }
            if (errorList.Count != 0)
            {
                MessageBox.Show(MainWindow.MakeErrorString(errorList), "订单添加出错");
            }
        }
Example #2
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), "添加货物出错");
            }
        }
Example #3
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), "添加客户出错");
            }
        }
Example #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), "添加员工出错");
            }
        }