コード例 #1
0
 /// <summary>
 /// 新增按钮跳转
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAddJSY_Click(object sender, EventArgs e)
 {
     if (UserTbale == "StaffInfo")
     {
         StaffInfoForm sff = new StaffInfoForm();
         sff.Show();
     }
     else if (UserTbale == "CustomerInfo")
     {
         CustomerInfoForm form = new CustomerInfoForm();
         form.Show();
     }
     else
     {
     }
 }
コード例 #2
0
        /// <summary>
        /// 点击确定按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                //查询驾驶员姓名
                if (UserTbale == "StaffInfo")
                {
                    if (listboxStaff_Names.Visible)
                    {
                        //调用事件
                        listboxStaff_Name_DoubleClick(sender, e);
                        this.Visible = false;
                        listboxStaff_Names.DataSource = null;
                        chkListBoxs.Visible           = false;
                        return;
                    }
                    chkListBoxs.SendToBack();
                    if (chkListBoxs.SelectedItems.Count > 0)
                    {
                        string stafnames = "";//驾驶员名称
                        ListstaffInfo = new List <string>();
                        foreach (var item in chkListBoxs.CheckedItems)
                        {
                            ListstaffInfo.Add(item.ToString());      //驾驶员名称集合
                            staffInfo_Name += item.ToString() + ","; //驾驶员名称
                            stafnames      += "'" + item.ToString() + "',";
                        }
                        if (staffInfo_Name != null)
                        {
                            //当用户选择驾驶员名称后显示同名的ID
                            listboxStaff_Names.Visible = true;
                        }
                        if (ListstaffInfo.Count() > 0)
                        {
                            //staffInfo_Id = "";
                            foreach (var item in ListstaffInfo)
                            {
                                string  sql = "Select * from " + UserTbale + " where " + UserWhere + " and " + Field + "='" + item + "'";
                                DataSet ds  = LinQBaseDao.Query(sql);
                                if (UserTbale == "StaffInfo")
                                {
                                    if (ds.Tables[0].Rows.Count <= 0)
                                    {
                                        DialogResult digresult = MessageBox.Show("不存在该驾驶员,是否进行登记?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                                        if (DialogResult.OK == digresult)
                                        {
                                            StaffInfoForm sff = new StaffInfoForm();
                                            sff.Show();
                                        }
                                        else
                                        {
                                            staffInfo_Name = "";
                                            return;
                                        }
                                    }
                                }
                                else
                                {
                                }

                                if (!string.IsNullOrEmpty(StaffInfo_identitys))
                                {
                                    if (ds.Tables[0].Rows.Count > 1)//如存在相同名称的驾驶员,则显示驾驶员身份证,根据身份证确定驾驶员信息
                                    {
                                        groupBox1.Visible                = true;
                                        listboxStaff_Names.Visible       = true;
                                        listboxStaff_Names.DataSource    = ds.Tables[0];
                                        listboxStaff_Names.ValueMember   = Fields;
                                        listboxStaff_Names.DisplayMember = StaffInfo_identitys;
                                        listboxStaff_Names.BringToFront();
                                    }
                                    else
                                    {
                                        staffInfo_Id += ds.Tables[0].Rows[0][0] + ",";
                                        this.Visible  = false;
                                    }
                                }
                            }
                        }
                    }
                }
                else if (UserTbale == "CustomerInfo")
                {
                    /////////////////查询公司名///////////////////////////////
                    CustomerInfo_GName = "";
                    if (listboxStaff_Names.Visible)
                    {
                        //调用事件
                        listboxStaff_Name_DoubleClick(sender, e);
                        this.Visible = false;
                        listboxStaff_Names.DataSource = null;
                        return;
                    }
                    chkListBoxs.SendToBack();
                    if (chkListBoxs.SelectedItems.Count > 0)
                    {
                        string stafnames = "";//变量名称
                        ListstaffInfo = new List <string>();
                        foreach (var item in chkListBoxs.CheckedItems)
                        {
                            ListstaffInfo.Add(item.ToString());      //公司名称集合
                            staffInfo_Name += item.ToString() + ","; //公司名称
                            stafnames      += "'" + item.ToString() + "',";
                        }
                        if (staffInfo_Name != null)
                        {
                            //当用户选择驾驶员名称后显示同名的ID
                            listboxStaff_Names.Visible = true;
                        }
                        if (ListstaffInfo.Count() > 0)
                        {
                            //staffInfo_Id = "";
                            foreach (var item in ListstaffInfo)
                            {
                                string  sql = "Select * from " + UserTbale + " where " + UserWhere + " and " + Field + "='" + item + "'";
                                DataSet ds  = LinQBaseDao.Query(sql);
                                if (ds.Tables[0].Rows.Count <= 0)
                                {
                                    DialogResult digresult = MessageBox.Show("不存在该驾驶员,是否进行登记?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                                    if (DialogResult.OK == digresult)
                                    {
                                        StaffInfoForm sff = new StaffInfoForm();
                                        sff.Show();
                                    }
                                    else
                                    {
                                        staffInfo_Name = "";
                                        return;
                                    }
                                }
                                else
                                {
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
            }
        }
コード例 #3
0
        /// <summary>
        /// 单击新增按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddJSY_Click(object sender, EventArgs e)
        {
            StaffInfoForm form = new StaffInfoForm();

            form.Show();
        }