Exemplo n.º 1
0
        public void Insert(REF_Client oREF_Client, DB_Handle oDB_Handle)
        {
            //**
            DL_Client oDL_Client = new DL_Client();

            try
            {
                bool newDBHandle = false;

                if (oDB_Handle == null)
                {
                    oDB_Handle = new DB_Handle();
                    oDB_Handle.OpenConnection();
                    oDB_Handle.BeginTransaction();
                    newDBHandle = true;
                }

                //**
                oDL_Client.Insert(oREF_Client, oDB_Handle);

                if (newDBHandle)
                {
                    oDB_Handle.CommitTransaction();
                    oDB_Handle.CloseConnection();
                }
            }
            catch (Exception ex)
            {
                oDB_Handle.RollbackTransaction();
                oDB_Handle.CloseConnection();
                throw ex;
            }
        }
Exemplo n.º 2
0
        public void Insert(REF_Client oREF_Client, DB_Handle oDB_Handle)
        {
            string     sqlQuery;
            SqlCommand oSqlCommand;

            try
            {
                sqlQuery    = "SP_ADD_APPOINTMENT";
                oSqlCommand = new SqlCommand();

                oSqlCommand.Parameters.AddWithValue("@appointment_id", oREF_Client.APPOINTMENT_ID);
                oSqlCommand.Parameters.AddWithValue("@appointment_name", oREF_Client.APPOINTMENT_NAME);
                oSqlCommand.Parameters.AddWithValue("@parent", oREF_Client.PARENT);
                oSqlCommand.Parameters.AddWithValue("@limit_month", oREF_Client.LIMIT_MONTH);
                oSqlCommand.Parameters.AddWithValue("@limit_year", oREF_Client.LIMIT_YEAR);
                oSqlCommand.Parameters.AddWithValue("@status", oREF_Client.STATUS);
                oSqlCommand.Parameters.AddWithValue("@created_by", oREF_Client.CREATED_BY);
                oSqlCommand.Parameters.AddWithValue("@created_date", oREF_Client.CREATED_DATE);
                oSqlCommand.Parameters.AddWithValue("@modified_by", oREF_Client.MODIFIED_BY);
                oSqlCommand.Parameters.AddWithValue("@modified_date", oREF_Client.MODIFIED_DATE);

                oSqlCommand.CommandType = CommandType.StoredProcedure;
                oSqlCommand.CommandText = sqlQuery;
                oSqlCommand.Connection  = oDB_Handle.GetConnection();
                oSqlCommand.Transaction = oDB_Handle.GetTransaction();
                oSqlCommand.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        public void Insert(REF_Client oREF_Client, DB_Handle oDB_Handle)
        {
            string     sqlQuery;
            SqlCommand oSqlCommand;

            try
            {
                sqlQuery    = "SP_ADD_Client";
                oSqlCommand = new SqlCommand();
                oSqlCommand.Parameters.AddWithValue("@CLIENT_ID", oREF_Client.CLIENT_ID);
                oSqlCommand.Parameters.AddWithValue("@CLIENT_NAME", oREF_Client.CLIENT_NAME);
                oSqlCommand.Parameters.AddWithValue("@CAR_NAME", oREF_Client.CAR_NAME);
                oSqlCommand.Parameters.AddWithValue("@DATE", oREF_Client.DATE);

                oSqlCommand.CommandType = CommandType.StoredProcedure;
                oSqlCommand.CommandText = sqlQuery;
                oSqlCommand.Connection  = oDB_Handle.GetConnection();
                oSqlCommand.Transaction = oDB_Handle.GetTransaction();
                oSqlCommand.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 4
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                REF_Client oREF_Client = new REF_Client();

                oREF_Client.APPOINTMENT_ID   = _temp;
                oREF_Client.APPOINTMENT_NAME = TextBox1.Text;
                oREF_Client.PARENT           = DropDownList1.SelectedItem.Text;
                oREF_Client.LIMIT_MONTH      = Convert.ToInt32(TextBox2.Text);
                oREF_Client.LIMIT_YEAR       = Convert.ToInt32(TextBox2.Text);
                oREF_Client.STATUS           = 1;
                oREF_Client.CREATED_BY       = 1;
                oREF_Client.CREATED_DATE     = DateTime.Now.ToString();
                oREF_Client.MODIFIED_BY      = 1;
                oREF_Client.MODIFIED_DATE    = DateTime.Now.ToString();

                Label5.Text = Convert.ToString(oREF_Client.APPOINTMENT_ID);

                BL_Client oBL_Client = new BL_Client();

                oBL_Client.Insert(oREF_Client, null);

                //saved
                LoadTable();
                GetAppToDropdwn();
                Clear();
            }
            catch (Exception ex)
            {
                //pls try again
                Label5.Text = ex.Message.ToString();
            }
        }
Exemplo n.º 5
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                REF_Client oREF_Client = new REF_Client();

                oREF_Client.CLIENT_ID   = Convert.ToInt32(TextBox1.Text);
                oREF_Client.CLIENT_NAME = TextBox2.Text;
                oREF_Client.CAR_NAME    = DropDownList1.SelectedValue.ToString();
                oREF_Client.DATE        = Date1.Value;

                BL_Client oBL_Client = new BL_Client();

                oBL_Client.Insert(oREF_Client, null);

                //saved
                LoadTable();
            }
            catch (Exception ex)
            {
                //pls try again
                Label1.Text = ex.Message.ToString();
            }
        }