Пример #1
0
        private void CmdDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (!vOpenMode)
                {
                    return;
                }

                DialogResult dMsg = MessageBox.Show("Are you Sure To Delete!!!", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dMsg == DialogResult.No)
                {
                    return;
                }


                if (!string.IsNullOrEmpty(TxtID.Tag.ToString()))
                {
                    var AccDAL = new DAL.ChartOfAccounts();
                    AccDAL.connectionstring = objDAL.connectionstring;


                    DAL.Parties obj = new DAL.Parties();
                    obj.connectionstring = objDAL.connectionstring;
                    obj.DeleteRecord(Int32.Parse(TxtID.Tag.ToString()));
                }


                MessageBox.Show("Record Deleted Successfully.", "Task Completed", MessageBoxButtons.OK, MessageBoxIcon.Information);

                LoadGrid();
                CmdClear_Click(sender, e);
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
Пример #2
0
        private void TxtCustomerID_TextChanged(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(TxtCustomerID.Text))
            {
                TxtCustomerName.Text = string.Empty;
            }
            else
            {
                string vWhere = string.Empty;
                vWhere = "AND Parties.PartyID = " + TxtCustomerID.Text;
                DAL.Parties obj = new DAL.Parties();

                obj.connectionstring = objDAL.connectionstring; //System.Configuration.ConfigurationSettings.GetConfig(string).ConnectionStrings["MyString"].ConnectionString;
                //DataTable dt = obj.getParties(vWhere);
                DataTable dt = obj.getRecord(vWhere);

                if (dt.Rows.Count > 0)
                {
                    TxtCustomerID.Text   = dt.Rows[0]["PartyID"].ToString();   // vForm.MyID;
                    TxtCustomerName.Text = dt.Rows[0]["PartyName"].ToString(); // vForm.MyName;
                }
            }
        }