Exemple #1
0
        protected void btninsert_Click(object sender, EventArgs e)
        {
            SqlDataReader dr;
            SqlCommand    cmd = new SqlCommand();
            string        rid;

            dr = db.SqlDataReaderConnection("select max([intYear_ID]) from YearMaster", " YearMaster");

            if (dr.HasRows == false)
            {
                rid           = "SID" + 1;
                txtstkid.Text = rid;
                txtstknm.Text = "";
            }
            else
            {
                cmd = db.SqlCommandConnection("select [intStock_Type_ID] from StockTypeMaster", " StockTypeMaster");
                rid = cmd.ExecuteScalar().ToString();
                rid = rid.Substring(3);
                rid = "SID" + (int.Parse(rid) + 1).ToString();
            }
            txtstkid.Text     = rid;
            txtstknm.Text     = "";
            btnsave.Enabled   = true;
            btninsert.Enabled = false;
        }
Exemple #2
0
        protected void btninsert_Click(object sender, EventArgs e)
        {
            SqlDataReader dr;
            SqlCommand    cmd = new SqlCommand();
            string        rid;

            dr = db.SqlDataReaderConnection("select [intAuthor_ID] from AuthorMaster", "AuthorMaster");

            if (dr.HasRows == false)
            {
                rid = "AID" + 1;
                txtauthorid.Text = rid;
                txtauthornm.Text = "";
            }
            else
            {
                cmd = db.SqlCommandConnection("select count([intAuthor_ID]) from AuthorMaster", "AuthorMaster");
                rid = cmd.ExecuteScalar().ToString();
                //rid = rid.Substring(3);
                rid = "AID" + (int.Parse(rid) + 1).ToString();
            }
            txtauthorid.Text  = rid;
            txtauthornm.Text  = "";
            btnsave.Enabled   = true;
            btninsert.Enabled = false;
        }
        protected void btninsert_Click(object sender, EventArgs e)
        {
            SqlDataReader dr;
            SqlCommand    cmd = new SqlCommand();
            string        rid;

            dr = db.SqlDataReaderConnection("select [intBill_ID] from BillDetailMaster", "BillDetailMaster");

            if (dr.HasRows == false)
            {
                rid           = "BID" + 1;
                txtbid.Text   = rid;
                txtbrno.Text  = "";
                txtdscnt.Text = "";
                txtamt.Text   = "";
            }
            else
            {
                cmd = db.SqlCommandConnection("select max([intBill_ID]) from BillDetailMaster", "BillDetailMaster");
                rid = cmd.ExecuteScalar().ToString();
                rid = rid.Substring(3);
                rid = "BID" + (int.Parse(rid) + 1).ToString();
            }
            txtbid.Text   = rid;
            txtbrno.Text  = "";
            txtdscnt.Text = "";
            txtamt.Text   = "";

            btnsave.Enabled   = true;
            btninsert.Enabled = false;
        }