Ejemplo n.º 1
0
        /// <summary>
        /// To Get Vaccination By Id
        /// </summary>
        /// <param name="VaccinationID"></param>
        /// <returns></returns>
        public VaccinationBO GetVaccinationById(int VaccinationID)
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;

            string proc = "USP_MST_GET_VACCIN";

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("V_VACCINATIONID", VaccinationID);
            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

            cmd.Connection.Open();

            OracleDataReader dr                 = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            VaccinationBO    Vaccinationobj     = null;
            VaccinationList  VaccinationListobj = new VaccinationList();

            Vaccinationobj = new VaccinationBO();
            while (dr.Read())
            {
                if (ColumnExists(dr, "VACCINATIONNAME") && !dr.IsDBNull(dr.GetOrdinal("VACCINATIONNAME")))
                {
                    Vaccinationobj.VACCINATIONNAME = dr.GetString(dr.GetOrdinal("VACCINATIONNAME"));
                }
                if (ColumnExists(dr, "VACCINATIONID") && !dr.IsDBNull(dr.GetOrdinal("VACCINATIONID")))
                {
                    Vaccinationobj.VACCINATIONID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("VACCINATIONID")));
                }
            }
            dr.Close();


            return(Vaccinationobj);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// To Get Vaccination
        /// </summary>
        /// <returns></returns>
        public VaccinationList GetVaccination()
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;

            string proc = "USP_MST_SEL_VACCINATION";

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("Sp_recordset", Oracle.DataAccess.Client.OracleDbType.RefCursor).Direction = ParameterDirection.Output;

            cmd.Connection.Open();
            OracleDataReader dr                 = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            VaccinationBO    Vaccinationobj     = null;
            VaccinationList  VaccinationListobj = new VaccinationList();

            while (dr.Read())
            {
                Vaccinationobj = new VaccinationBO();
                Vaccinationobj.VACCINATIONID   = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("vaccinationid")));
                Vaccinationobj.VACCINATIONNAME = dr.GetString(dr.GetOrdinal("vaccinationname"));
                // Vaccinationobj.ISDELETED = dr.GetString(dr.GetOrdinal("isdeleted"));

                VaccinationListobj.Add(Vaccinationobj);
            }

            dr.Close();

            return(VaccinationListobj);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Get the details.
        /// </summary>
        private void GetVaccinationDetails()
        {
            VaccinationBLL VaccinationBLLobj = new VaccinationBLL();
            int            VaccinationID     = 0;

            if (ViewState["VACCINATIONID"] != null)
            {
                VaccinationID = Convert.ToInt32(ViewState["VACCINATIONID"]);
            }

            VaccinationBO Vaccinationobj = new VaccinationBO();

            Vaccinationobj = VaccinationBLLobj.GetVaccinationById(VaccinationID);

            VaccinationTextBox.Text   = Vaccinationobj.VACCINATIONNAME;
            VACCINATIONIDTextBox.Text = Vaccinationobj.VACCINATIONID.ToString();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// To Edit Vaccination
        /// </summary>
        /// <param name="Vaccinationobj"></param>
        /// <returns></returns>
        public string EditVaccination(VaccinationBO Vaccinationobj)
        {
            VaccinationDAL VaccinationDALobj = new VaccinationDAL(); //Data pass -to Database Layer

            try
            {
                return(VaccinationDALobj.EditVaccination(Vaccinationobj));
            }
            catch
            {
                throw;
            }
            finally
            {
                VaccinationDALobj = null;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// To Edit Vaccination
        /// </summary>
        /// <param name="Vaccinationobj"></param>
        /// <returns></returns>
        public string EditVaccination(VaccinationBO Vaccinationobj)
        {
            string           returnResult = string.Empty;
            OracleConnection cnn          = new OracleConnection(AppConfiguration.ConnectionString);

            cnn.Open();
            OracleCommand dcmd = new OracleCommand("USP_MST_UPD_VACCINATION", cnn);

            dcmd.CommandType = CommandType.StoredProcedure;
            int count = Convert.ToInt32(dcmd.CommandType);

            try
            {
                dcmd.Parameters.Add("V_VACCINATIONNAME", Vaccinationobj.VACCINATIONNAME);
                dcmd.Parameters.Add("V_VACCINATIONID", Vaccinationobj.VACCINATIONID);
                dcmd.Parameters.Add("V_UPDATEDBY", Vaccinationobj.Createdby);
                //return dcmd.ExecuteNonQuery();
                dcmd.Parameters.Add("errorMessage_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output;

                dcmd.ExecuteNonQuery();

                if (dcmd.Parameters["errorMessage_"].Value != null)
                {
                    returnResult = dcmd.Parameters["errorMessage_"].Value.ToString();
                }
                else
                {
                    returnResult = string.Empty;
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                dcmd.Dispose();
                cnn.Close();
                cnn.Dispose();
            }
            return(returnResult);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Save the data into database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            string AlertMessage = string.Empty;
            string message      = string.Empty;

            if (VACCINATIONIDTextBox.Text.ToString().Trim() == string.Empty)
            {
                VaccinationBLL VaccinationBLLobj = new VaccinationBLL();

                try
                {
                    string        uID            = Session["USER_ID"].ToString();
                    VaccinationBO Vaccinationobj = new VaccinationBO();
                    Vaccinationobj.VACCINATIONNAME = VaccinationTextBox.Text.ToString().Trim();
                    Vaccinationobj.Createdby       = Convert.ToInt32(uID);

                    VaccinationBLL BLLobj = new VaccinationBLL();
                    message = BLLobj.Insert(Vaccinationobj);

                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data saved successfully";
                        ClearAll();
                        BindGrid(true, true);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                finally
                {
                    VaccinationBLLobj = null;
                }
            }
            //edit the data in the textbox exiting in the Grid
            else if (VACCINATIONIDTextBox.Text.ToString().Trim() != string.Empty)
            {
                VaccinationBLL VaccinationBLLobj = new VaccinationBLL();

                try
                {
                    string        uID            = Session["USER_ID"].ToString();
                    VaccinationBO Vaccinationobj = new VaccinationBO();
                    Vaccinationobj.VACCINATIONNAME = VaccinationTextBox.Text.ToString().Trim();
                    Vaccinationobj.VACCINATIONID   = Convert.ToInt32(VACCINATIONIDTextBox.Text.ToString().Trim());
                    Vaccinationobj.Createdby       = Convert.ToInt32(uID);

                    VaccinationBLL BLLobj = new VaccinationBLL();
                    message = BLLobj.EditVaccination(Vaccinationobj);

                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data updated successfully";
                        ClearAll();
                        BindGrid(true, true);
                        SetUpdateMode(false);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    VaccinationBLLobj = null;
                }
            }
            AlertMessage = "alert('" + message + "');";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
        }