Пример #1
0
        private void 修改_Click(object sender, EventArgs e)
        {
            DataTable tb = (DataTable)dataGridView1.DataSource;

            if (tb.Rows.Count == 0)
            {
                return;
            }
            if (dataGridView1.CurrentCell == null)
            {
                return;
            }
            string sDate = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase).ToString();
            int    nrow  = dataGridView1.CurrentCell.RowIndex;
            string ssql  = "";

            long id   = Convert.ToInt64(tb.Rows[nrow]["id"]);
            long jcid = Convert.ToInt64(tb.Rows[nrow]["jcid"]);

            ssql = "select *,dbo.fun_getdeptname(ksdm)  科室,dbo.fun_getempname(ysdm) 医生 from jc_ypkhbl where id=" + jcid + "";
            DataTable tbjc = InstanceForm.BDatabase.GetDataTable(ssql);

            if (tbjc.Rows.Count == 0)
            {
                return;
            }

            Frmaddbl frm = new Frmaddbl();

            frm.lblks.Text   = tbjc.Rows[0]["科室"].ToString();
            frm.lblys.Text   = tbjc.Rows[0]["医生"].ToString();
            frm.dtprq1.Value = Convert.ToDateTime(tb.Rows[nrow]["开放起日期"]);
            frm.dtprq2.Value = Convert.ToDateTime(tb.Rows[nrow]["开放止日期"]);
            frm.ShowDialog();

            if (frm.bok == false)
            {
                return;
            }

            DateTime rq1   = frm.dtprq1.Value;
            DateTime rq2   = frm.dtprq2.Value;
            int      nf    = Convert.ToInt32(tb.Rows[0]["年份"]);
            int      yf    = Convert.ToInt32(tb.Rows[0]["月份"]);
            int      bqybz = frm.chkqybz.Checked == true ? 1 : 0;


            ssql = "update YP_YPKHBL_ZJ set kssj='" + rq1.ToShortDateString() + "', jssj='" + rq2.ToShortDateString() + "',bqybz=" + bqybz + " where id=" + id + "";
            InstanceForm.BDatabase.DoCommand(ssql);

            MessageBox.Show("修改成功");

            Select_zj(jcid, nf, yf);
        }
Пример #2
0
        private void 延长权限_Click(object sender, EventArgs e)
        {
            DataTable tb = (DataTable)dgvContent.DataSource;

            if (tb.Rows.Count == 0)
            {
                return;
            }
            if (dgvContent.CurrentCell == null)
            {
                return;
            }
            string sDate = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase).ToString();
            int    nrow  = dgvContent.CurrentCell.RowIndex;


            long     jcid = Convert.ToInt64(tb.Rows[nrow]["jcid"]);
            Frmaddbl frm  = new Frmaddbl();

            frm.lblks.Text = tb.Rows[nrow]["科室"].ToString();
            frm.lblys.Text = tb.Rows[nrow]["医生"].ToString();
            frm.ShowDialog();

            if (frm.bok == false)
            {
                return;
            }

            DateTime rq1   = frm.dtprq1.Value;
            DateTime rq2   = frm.dtprq2.Value;
            int      nf    = Convert.ToInt32(tb.Rows[nrow]["年份"]);
            int      yf    = Convert.ToInt32(tb.Rows[nrow]["月份"]);
            int      bqybz = frm.chkqybz.Checked == true?1:0;

            string ssql = "";

            ssql = " insert into YP_YPKHBL_ZJ(jcid,nf,yf,kssj,jssj,djsj,djy,bqybz)values(" + jcid + "," + nf + "," + yf + ",'" + rq1.ToShortDateString() + "','" + rq2.ToShortDateString() + "','" + sDate + "'," + InstanceForm.BCurrentUser.EmployeeId + "," + bqybz + ")";
            InstanceForm.BDatabase.DoCommand(ssql);

            MessageBox.Show("保存成功");

            Select_zj(jcid, nf, yf);
        }