コード例 #1
0
ファイル: CreatRepory.cs プロジェクト: Ask-Pillar/Deliever
        private void btn_creatreporty_Click(object sender, EventArgs e)
        {
            int renum = Convert.ToInt32(DBHelper.GetTable(DBHelper.retan(text_reportyname.Text)).Rows[0][0].ToString());
            int num   = Convert.ToInt32(DBHelper.GetTable(DBHelper.tan(text_reportyname.Text)).Rows[0][0].ToString());

            try
            {
                linqtosqlDataClasses1DataContext linq;
                linq = new linqtosqlDataClasses1DataContext(SysConfig.constring);
                TransReporatory transreporatory = new TransReporatory();
                RealReportary   realreportary   = new RealReportary();
                transreporatory.TransReporatoryCode = text_reportycode.Text;
                transreporatory.TransReporatoryName = text_reportyname.Text;
                transreporatory.TransReporatoryCity = text_city.Text;
                realreportary.RealReportaryCode     = text_reportycode.Text;
                realreportary.RealReportaryName     = text_reportyname.Text;
                realreportary.RealReportaryCity     = text_city.Text;

                if (Tool.TextBoxExpression1(text_city) && Tool.TextBoxExpression1(text_reportycode) && Tool.TextBoxExpression1(text_reportyname) && renum == 0 && num == 0)
                {
                    linq.TransReporatory.InsertOnSubmit(transreporatory);
                    linq.RealReportary.InsertOnSubmit(realreportary);
                    linq.SubmitChanges();
                    MessageBox.Show("添加成功");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("添加失败");
            }
        }
コード例 #2
0
ファイル: empoly.cs プロジェクト: Ask-Pillar/Deliever
        private void button2_Click(object sender, EventArgs e)
        {
            linqtosqlDataClasses1DataContext linq = new linqtosqlDataClasses1DataContext();
            Employee employee = new Employee();

            employee.EmployeeNumber = textBox5.Text;
            employee.EmployeeRole   = 1;
            employee.EmployeeName   = textBox3.Text;
            employee.EmployeeStatus = 1;
            employee.EmployeePhone  = textBox1.Text;
            DataTable code = DBHelper.GetTable(DBHelper.employeeNumber(textBox5.Text));
            int       num  = Convert.ToInt32(code.Rows[0][0].ToString());
            bool      s    = Tool.regularPhone(textBox1, @"^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$");
            bool      t    = Tool.regularnumber(textBox5, @"/^\d{8}$/");

            if (Tool.TextBoxExpression1(textBox3) && Tool.TextBoxExpression1(textBox1) && Tool.TextBoxExpression1(textBox5) && s && t && num == 0)
            {
                linq.Employee.InsertOnSubmit(employee);
                linq.SubmitChanges();
                MessageBox.Show(textBox3.Text + "数据添加成功");
                textBox3.Clear();
                textBox1.Clear();
                textBox5.Clear();
            }
        }
コード例 #3
0
ファイル: GoodsNameAdd.cs プロジェクト: Ask-Pillar/Deliever
        private void button1_Click(object sender, EventArgs e)
        {
            linqtosqlDataClasses1DataContext linq;

            linq = new linqtosqlDataClasses1DataContext(SysConfig.constring);
            Goods good = new Goods();

            good.GoodsName = textBox1.Text + '*' + textBox2.Text;
            good.GoodsCode = textBox3.Text;
            int num = Convert.ToInt32(DBHelper.GetTable(DBHelper.goodsName(textBox1.Text + textBox2.Text)).Rows[0][0].ToString());

            if (num == 0 && Tool.TextBoxExpression1(textBox1) && Tool.TextBoxExpression1(textBox2) && Tool.TextBoxExpression1(textBox3))//添加的语句是否已经有
            {
                linq.Goods.InsertOnSubmit(good);
                linq.SubmitChanges();
                MessageBox.Show(textBox1.Text + '*' + textBox2.Text + "添加成功");
                textBox1.Clear();
                textBox2.Clear();
                textBox3.Clear();
            }
            else
            {
                MessageBox.Show("该货物已有,添加失败");
                textBox1.Clear();
                textBox2.Clear();
                textBox3.Clear();
            }
        }