Exemplo n.º 1
0
        private void deleting(object sender, EventArgs e)
        {
            DialogResult dr = ((Form)sender).DialogResult;

            if (dr == DialogResult.Yes)
            {
                //删除数据库中的机构记录
                string cmd  = string.Format("DELETE FROM tjigou WHERE id = {0}", trV.SelectedNode.Name);
                int    rows = ClsMSSQL.ExecuteCmd(cmd, ClsDBCon.ConStrKj);
                if (rows != 1)
                {
                    string s = string.Format("删除机构表命令影响的记录行数{0}不为1。", rows);
                    ClsMsgBox.Cw(s);
                }
                else
                {
                    //删除机构树中的结点
                    TreeNode tn = trV.SelectedNode;
                    TreeNode tm = tn.NextNode != null ? tn.NextNode :
                                  tn.PrevNode != null ? tn.PrevNode : tn.Parent;
                    trV.SelectedNode = tm;
                    if (tn.Level == 0)
                    {
                        trV.Nodes.Remove(tn);
                    }
                    else
                    {
                        tn.Parent.Nodes.Remove(tn);
                    }
                }
            }
        }
Exemplo n.º 2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     #region 空值判断
     ClsD.TextBoxTrim(this);
     if (string.IsNullOrEmpty(txtDm.Text))
     {
         ClsMsgBox.Jg("代码不可为空!");
         return;
     }
     if (!ClsReg.AlphaNumeric.IsMatch(txtDm.Text))
     {
         ClsMsgBox.Jg("代码包含非字母数字字符!");
         return;
     }
     if (string.IsNullOrEmpty(txtMc.Text))
     {
         ClsMsgBox.Jg("名称不可为空!");
         return;
     }
     #endregion
     try
     {
         bds.EndEdit();
         toptionlbTableAdapter1.Update(dsJckja1.toptionlb);
         if (NED == EnumNED.NEW)
         {
             ClsD.TurnDgvToBdsCurrRec(dgv);
         }
         this.DialogResult = DialogResult.OK;
     }
     catch (Exception ex)
     {
         ClsMsgBox.Cw("保存选项项目时遇到了错误:", ex);
     }
 }
Exemplo n.º 3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     bds.EndEdit();
     ClsD.TextBoxTrim(grpMain);
     if (string.IsNullOrEmpty(txtMC.Text))
     {
         ClsMsgBox.Jg("序号不可为空!");
         txtMC.Focus();
         return;
     }
     try
     {
         tjigouTableAdapter1.Update(dSjckja1.tjigou);
         trV.SelectedNode.Name = lblld.Text;
         trV.SelectedNode.Text = txtJc.Text;
         if (!trV.Enabled)
         {
             trV.Enabled = true;
         }
     }
     catch (Exception ex)
     {
         ClsMsgBox.Cw("保存机构信息时遇到了如下错误:", ex);
     }
 }
Exemplo n.º 4
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     #region 空值判断及数据验证
     ClsD.TextBoxTrim(this);
     if (string.IsNullOrEmpty(txtXm.Text))
     {
         ClsMsgBox.Jg("姓名不可为空!");
         return;
     }
     if (string.IsNullOrEmpty(txtLoginName.Text))
     {
         ClsMsgBox.Jg("账户不可为空!");
         return;
     }
     if (string.IsNullOrEmpty(txtPassword.Text))
     {
         ClsMsgBox.Jg("口令不可为空!");
         return;
     }
     if (txtPassword.Text.Length < minPwLen)
     {
         ClsMsgBox.Jg(string.Format("口令长度小于{0}!", minPwLen));
         return;
     }
     if (cmbRole.SelectedValue == null)
     {
         ClsMsgBox.Jg("角色不能为空!");
         return;
     }
     if (cmbJgTree.SelectedValue == null)
     {
         ClsMsgBox.Jg("下拉列表不能为空");
         return;
     }
     #endregion
     try
     {
         bds.EndEdit();
         tygTableAdapter1.Update(dsJckja1.tyg);
         if (NED == EnumNED.NEW)
         {
             ClsD.TurnDgvToBdsCurrRec(dgv);
         }
         this.DialogResult = DialogResult.OK;
     }
     catch (Exception ex)
     {
         ClsMsgBox.Cw("保存员工时遇到了错误:", ex);
     }
 }
Exemplo n.º 5
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     #region 空值判断及数据验证
     ClsD.TextBoxTrim(this);
     if (!ClsReg.Naturalnum.IsMatch(txtXh.Text))
     {
         ClsMsgBox.Jg("序号必须为整数!");
     }
     if (string.IsNullOrEmpty(txtPm.Text))
     {
         ClsMsgBox.Jg("品名不可为空!");
         return;
     }
     if (string.IsNullOrEmpty(txtBm.Text))
     {
         ClsMsgBox.Jg("编码不可为空!");
         return;
     }
     if (string.IsNullOrEmpty(txtDw.Text))
     {
         ClsMsgBox.Jg("单位不可为空!");
         return;
     }
     if (!ClsReg.RMB.IsMatch(txtDj.Text))
     {
         ClsMsgBox.Jg("单价数据不正确!");
         return;
     }
     if (!ClsReg.Naturalnum.IsMatch(txtSl.Text))
     {
         ClsMsgBox.Jg("数量必须为整数!");
         return;
     }
     #endregion
     try
     {
         bds.EndEdit();
         if (NED == EnumNED.NEW)
         {
             ClsD.TurnDgvToBdsCurrRec(dgv);
         }
         this.DialogResult = DialogResult.OK;
     }
     catch (Exception ex)
     {
         ClsMsgBox.Cw("保存进货明细时遇到了错误:", ex);
     }
 }
Exemplo n.º 6
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     bds.EndEdit();
     ClsD.TextBoxTrim(grpMain);
     if (string.IsNullOrEmpty(txtXh.Text))
     {
         ClsMsgBox.Jg("序号不可为空!");
         txtXh.Focus();
         return;
     }
     if (!ClsReg.Naturalnum.IsMatch(txtXh.Text))
     {
         ClsMsgBox.Jg("序号必须为数字!");
         txtXh.Focus();
         return;
     }
     if (string.IsNullOrEmpty(txtMc.Text))
     {
         ClsMsgBox.Jg("名称不可为空!");
         txtMc.Focus();
         return;
     }
     if (string.IsNullOrEmpty(txtBm.Text))
     {
         ClsMsgBox.Jg("编码不可为空!");
         txtBm.Focus();
         return;
     }
     try
     {
         tfuncsTableAdapter1.Update(dSjckja1.tfuncs);
         trV.SelectedNode.Name = lblld.Text;
         trV.SelectedNode.Text = txtMc.Text;
         trV.SelectedNode.Tag  = txtBm.Text;
         if (!trV.Enabled)
         {
             trV.Enabled = true;
         }
     }
     catch (Exception ex)
     {
         ClsMsgBox.Cw("保存模块信息时遇到了如下错误:", ex);
     }
 }
Exemplo n.º 7
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     #region 空值判断及数据验证
     ClsD.TextBoxTrim(this);
     if (string.IsNullOrEmpty(txtJhdh.Text))
     {
         ClsMsgBox.Jg("进货单不可为空!");
         return;
     }
     if (string.IsNullOrEmpty(txtGhsh.Text))
     {
         ClsMsgBox.Jg("供货单不可为空!");
         return;
     }
     #endregion
     try
     {
         bds.EndEdit();
         tableAdapterManager1.UpdateAll(dsJxc1);
         DataTable dt = dsJxc.Tables["vjhmxhj"];
         DataRow[] r  = dt.Select(string.Format("jhdId={0}", lblId.Text));
         if (r.Length > 0)
         {
             r[0]["hj"] = string.IsNullOrEmpty(lblHj.Text) ? "0" : lblHj.Text;
         }
         if (NED == EnumNED.NEW)
         {
             ClsD.TurnDgvToBdsCurrRec(dgvMaster);
         }
         this.DialogResult = DialogResult.OK;
     }
     catch (Exception ex)
     {
         ClsMsgBox.Cw("保存进货单时遇到了错误:", ex);
     }
 }
Exemplo n.º 8
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     #region 空值判断
     ClsD.TextBoxTrim(this);
     if (string.IsNullOrEmpty(txtfax.Text))
     {
         ClsMsgBox.Jg("传真不可为空!");
         return;
     }
     if (string.IsNullOrEmpty(txtmetl.Text))
     {
         ClsMsgBox.Jg("号码不可为空!");
         return;
     }
     if (string.IsNullOrEmpty(txtQQ.Text))
     {
         ClsMsgBox.Jg("QQ不可为空!");
         return;
     }
     if (string.IsNullOrEmpty(txtwx.Text))
     {
         ClsMsgBox.Jg("微信不可为空!");
         return;
     }
     if (string.IsNullOrEmpty(txtxm.Text))
     {
         ClsMsgBox.Jg("姓名不可为空!");
     }
     if (!ClsReg.AlphaNumeric.IsMatch(txtfax.Text))
     {
         ClsMsgBox.Jg("代码包含非字母数字字符!");
         return;
     }
     if (string.IsNullOrEmpty(txtxh.Text))
     {
         ClsMsgBox.Jg("序号不可为空!");
         return;
     }
     if (string.IsNullOrEmpty(txtemail.Text))
     {
         ClsMsgBox.Jg("邮箱不可为空!");
         return;
     }
     if (!ClsReg.Naturalnum.IsMatch(txtemail.Text))
     {
         ClsMsgBox.Jg("权限包含非字母数字字符!");
         return;
     }
     #endregion
     try
     {
         bds.EndEdit();
         tygTableAdapter1.Update(dsJckja1.tyg);
         if (NED == EnumNED.NEW)
         {
             ClsD.TurnDgvToBdsCurrRec(dgv);
         }
         this.DialogResult = DialogResult.OK;
     }
     catch (Exception ex)
     {
         ClsMsgBox.Cw("保存员工时遇到了错误:", ex);
     }
 }