Exemplo n.º 1
0
        //查询按钮
        private void btnSql_Click(object sender, EventArgs e)
        {
            SqlForm SF = new SqlForm();

            SF.Show();
            this.Hide();
        }
Exemplo n.º 2
0
        private void btnSure_Click(object sender, EventArgs e)
        {
            string sql = "";

            if (change.Text == "取消修改")
            {
                newJCR NJ = new newJCR();
                sql += "update JCRJBXX set JCRsfz='" + deSFZ.Text + "' ";
                // sql += "update JCRJBXX set  ";

                #region 添加更新语句
                if (getJG.Checked == false && getZY.Checked == false && getBZ.Checked == false &&
                    getMZ.Checked == false && getJJZK.Checked == false && getLKDW.Checked == false && getZZMM.Checked == false && getFL.Checked == false &&
                    getLKJB.Checked == false && getBYYX.Checked == false && getHJSZD.Checked == false && getXJZD.Checked == false && getGZDW.Checked == false && getGXRY.Checked == false &&
                    getGRJL.Checked == false && getGDDH.Checked == false && getDZYJ.Checked == false && getYDDH.Checked == false && getQQ.Checked == false && getWX.Checked == false && getPhoto.Checked == false)
                {
                    MessageBox.Show("请至少选择一项", "提示");
                }
                else
                {
                    //籍贯
                    if (getJG.Checked == true)
                    {
                        sql          += ",JCRJG='" + deJG.Text.Trim() + "'";
                        deJG.ReadOnly = false;
                    }
                    //职业
                    if (getZY.Checked == true)
                    {
                        sql          += ",JCRzy='" + deZY.Text.Trim() + "'";
                        deZY.ReadOnly = false;
                    }
                    //民族
                    if (getMZ.Checked == true)
                    {
                        sql          += ",JCRnation='" + deMZ.Text.Trim() + "'";
                        deMZ.ReadOnly = false;
                    }
                    //经济状况
                    if (getJJZK.Checked == true)
                    {
                        sql            += ",JCRjjzk='" + deJJZK.Text.Trim() + "'";
                        deJJZK.ReadOnly = false;
                    }
                    //列控单位
                    if (getLKDW.Checked == true)
                    {
                        sql            += ",JCRlkdw='" + deLKDW.Text.Trim() + "'";
                        deLKDW.ReadOnly = false;
                    }

                    //政治面貌
                    if (getZZMM.Checked == true)
                    {
                        sql            += ",JCRpolity='" + deZZMM.Text.Trim() + "'";
                        deZZMM.ReadOnly = false;
                    }
                    //分类
                    if (getFL.Checked == true)
                    {
                        sql          += ",JCRfl='" + deFL.Text.Trim() + "'";
                        deFL.ReadOnly = false;
                    }
                    //列控级别
                    if (getLKJB.Checked == true)
                    {
                        sql            += ",JCRlkjb='" + deLKJB.Text.Trim() + "'";
                        deLKJB.ReadOnly = false;
                    }
                    //毕业院校
                    if (getBYYX.Checked == true)
                    {
                        sql            += ",JCRbyyx='" + deBYYX.Text.Trim() + "'";
                        deBYYX.ReadOnly = false;
                    }
                    //户籍所在地
                    if (getHJSZD.Checked == true)
                    {
                        sql += ",JCRhjszd='" + deHJSZD.Text.Trim() + "'";
                        deHJSZD.ReadOnly = false;
                    }
                    //现居住地
                    if (getXJZD.Checked == true)
                    {
                        sql            += ",JCRxjzd='" + deXJZD.Text.Trim() + "'";
                        deXJZD.ReadOnly = false;
                    }
                    //工作单位
                    if (getGZDW.Checked == true)
                    {
                        sql            += ",JCRgzdw='" + deGZDW.Text.Trim() + "'";
                        deGZDW.ReadOnly = false;
                    }
                    //关系人员
                    if (getGXRY.Checked == true)
                    {
                        sql            += ",JCRgxry='" + deGXRY.Text.Trim() + "'";
                        deGXRY.ReadOnly = false;
                    }
                    //个人简历
                    if (getGRJL.Checked == true)
                    {
                        sql            += ",JCRgrjl='" + deGRJL.Text.Trim() + "'";
                        deGRJL.ReadOnly = false;
                    }
                    // 备注
                    if (getBZ.Checked == true)
                    {
                        sql          += " ,JCRbz='" + deBZ.Text.Trim() + "'";
                        deBZ.ReadOnly = false;
                    }
                    //固定电话
                    if (getGDDH.Checked == true)
                    {
                        sql            += ",JCRgddh='" + deGDDH.Text.Trim() + "'";
                        deGDDH.ReadOnly = false;
                    }
                    //移动电话
                    if (getYDDH.Checked == true)
                    {
                        sql            += ",JCRyddh='" + deYDDH.Text.Trim() + "'";
                        deYDDH.ReadOnly = false;
                    }
                    //电子邮件
                    if (getDZYJ.Checked == true)
                    {
                        sql            += ",JCRdzyj='" + deDZYJ.Text.Trim() + "'";
                        deDZYJ.ReadOnly = false;
                    }
                    //qq
                    if (getQQ.Checked == true)
                    {
                        sql          += ",JCRqq='" + deQQ.Text.Trim() + "'";
                        deQQ.ReadOnly = false;
                    }
                    //微信
                    if (getWX.Checked == true)
                    {
                        sql          += ",JCRwx='" + deWX.Text.Trim() + "'";
                        deWX.ReadOnly = false;
                    }
                    //照片
                    #region 修改照片
                    if (getPhoto.Checked == true)
                    {
                        getAdPhoto.Enabled = true;
                        if (pathTemp != null)
                        {
                            //删除当前文件夹的照片
                            if (File.Exists(Environment.CurrentDirectory + @"\\JCRphoto" + "\\" + getInfo(photoGuidExist)))
                            {
                                File.Delete(Environment.CurrentDirectory + @"\\JCRphoto" + "\\" + getInfo(photoGuidExist));
                                movePhoto(pathTemp);
                            }
                        }
                    }


                    #endregion
                    #endregion
                    SqlForm SF = new SqlForm();
                    sql += "  where JCRsfz='" + deSFZ.Text + "'";
                    // sql += " where JCRsfz='" + SF.SFZid + "'";
                    using (OleDbConnection conn = new OleDbConnection(strcon))
                    {
                        OleDbCommand comm = new OleDbCommand(sql, conn);
                        conn.Open();
                        int result = comm.ExecuteNonQuery();
                        if (result > 0)
                        {
                            MessageBox.Show("修改成功", "提示");

                            //控件不可用处理
                            ctrlWiget();
                            change.Text = "修改";
                            #region  项清零
                            getJG.Checked   = false; getZY.Checked = false; getBZ.Checked = false;
                            getMZ.Checked   = false; getJJZK.Checked = false;  getLKDW.Checked = false; getZZMM.Checked = false; getFL.Checked = false;
                            getLKJB.Checked = false; getBYYX.Checked = false; getHJSZD.Checked = false; getXJZD.Checked = false; getGZDW.Checked = false; getGXRY.Checked = false;
                            getGRJL.Checked = false; getGDDH.Checked = false; getDZYJ.Checked = false; getYDDH.Checked = false; getQQ.Checked = false; getWX.Checked = false;
                            #endregion
                        }
                        else
                        {
                            MessageBox.Show("修改失败", "提示");
                        }
                    }
                }
            }
            else
            {
                this.Close();
            }
        }