Exemple #1
0
        /// <summary>
        /// To get details
        /// </summary>
        /// <param name="districtname"></param>
        /// <returns></returns>
        public DistrictList SearchDistrict(string districtname)
        {
            proc = "USP_MST_SEARCH_ALLDISTRICTS";
            DistrictBO   objDisBO   = null;
            DistrictList objDislist = new DistrictList();

            using (cnn = new OracleConnection(connStr))
            {
                using (cmd = new OracleCommand(proc, cnn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;

                    if (districtname != "")
                    {
                        cmd.Parameters.Add("DistrictName_", districtname);
                    }
                    else
                    {
                        cmd.Parameters.Add("DistrictName_", DBNull.Value);
                    }


                    cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

                    try
                    {
                        cmd.Connection.Open();
                        OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);

                        while (dr.Read())
                        {
                            objDisBO = new DistrictBO();

                            if (!dr.IsDBNull(dr.GetOrdinal("DISTRICTID")))
                            {
                                objDisBO.DistrictID = dr.GetInt32(dr.GetOrdinal("DISTRICTID"));
                            }
                            if (!dr.IsDBNull(dr.GetOrdinal("DISTRICTNAME")))
                            {
                                objDisBO.DistrictName = dr.GetString(dr.GetOrdinal("DISTRICTNAME"));
                            }
                            if (!dr.IsDBNull(dr.GetOrdinal("ISDELETED")))
                            {
                                objDisBO.IsDeleted = dr.GetString(dr.GetOrdinal("ISDELETED"));
                            }

                            objDislist.Add(objDisBO);
                        }

                        dr.Close();
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }

            return(objDislist);
        }
        public District Update(District obj)
        {
            DistrictBO districtBO = new DistrictBO(obj);

            districtDao.Update(districtBO);
            return(obj);
        }
Exemple #3
0
        /// <summary>
        /// To fetch details from database
        /// </summary>
        /// <returns></returns>
        public DistrictList GetDistrict()
        {
            cnn = new OracleConnection(connStr);

            string proc = "USP_MST_GET_DISTRICT";

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;


            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
            cmd.Connection.Open();
            OracleDataReader dr         = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            DistrictBO       objDisBO   = null;
            DistrictList     objDislist = new DistrictList();

            while (dr.Read())
            {
                objDisBO = new DistrictBO();
                if (!dr.IsDBNull(dr.GetOrdinal("DISTRICTID")))
                {
                    objDisBO.DistrictID = dr.GetInt32(dr.GetOrdinal("DISTRICTID"));
                }
                //  objDisBO.DistrictID = (Convert.ToInt32(dr.GetValue(dr.GetOrdinal("DISTRICTID"))));
                if (!dr.IsDBNull(dr.GetOrdinal("DISTRICTNAME")))
                {
                    objDisBO.DistrictName = dr.GetValue(dr.GetOrdinal("DISTRICTNAME")).ToString();
                }
                objDislist.Add(objDisBO);
            }

            dr.Close();
            return(objDislist);
        }
Exemple #4
0
        /// <summary>
        /// To update data to database
        /// </summary>
        /// <param name="objDistrictBO"></param>
        /// <returns></returns>
        public string UpdateDistrict(DistrictBO objDistrictBO)
        {
            string result = "";

            using (cnn = new OracleConnection(connStr))
            {
                using (cmd = new OracleCommand("USP_MST_UPD_DISTRICT", cnn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Connection.Open();

                    cmd.Parameters.Add("DISTRICTID_", objDistrictBO.DistrictID);
                    cmd.Parameters.Add("DISTRICTNAME_", objDistrictBO.DistrictName);
                    cmd.Parameters.Add("UPDATEDBY_", objDistrictBO.UpdatedBy);
                    cmd.Parameters.Add("ERRORMESSAGE_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output;
                    cmd.ExecuteNonQuery();

                    if (cmd.Parameters["ERRORMESSAGE_"].Value != null)
                    {
                        result = cmd.Parameters["ERRORMESSAGE_"].Value.ToString();
                    }

                    cmd.Connection.Close();
                }
            }

            return(result);
        }
Exemple #5
0
        /// <summary>
        /// Set edit mode for edit comand
        /// Delete data from the database for delete comand
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grdDistrict_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string message = string.Empty;

            if (e.CommandName == "EditRow")
            {
                ShowHideSections(true, false);
                ViewState["District_ID"] = e.CommandArgument;
                DistrictBLL objDistrictBLL = new DistrictBLL();
                DistrictBO  objDistrict    = objDistrictBLL.GetDistrictById(Convert.ToInt32(ViewState["District_ID"]));

                txtDistrict.Text = objDistrict.DistrictName;
                btnSave.Text     = "Update";
                btnClear.Text    = "Cancel";
            }
            else if (e.CommandName == "DeleteRow")
            {
                // ViewState["CDAPBUDGETID"] = e.CommandArgument;
                DistrictBLL DistrictBLLobj = new DistrictBLL();
                message = DistrictBLLobj.DeleteDistrict(Convert.ToInt32(e.CommandArgument));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data deleted successfully";
                }
                SetUpdateMode(false);
                BindGrid();
                ClearData();
            }
            if (message != "")
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
            }
        }
Exemple #6
0
        //protected void ChangePage(object sender, GridViewPageEventArgs e)
        //{
        //    grdDistrict.PageIndex = e.NewPageIndex;
        //    BindGrid();
        //}
        /// <summary>
        /// to get details to textbox
        /// </summary>
        /// <returns></returns>
        private void GetDistrictById()
        {
            DistrictBLL DistrictBLLobj = new DistrictBLL();

            DistrictBO DistrictBOobj = DistrictBLLobj.GetDistrictById(Convert.ToInt32(ViewState["DISTRICTID"]));

            if (DistrictBOobj != null)
            {
                txtDistrict.Text = DistrictBOobj.DistrictName;
            }

            DistrictBOobj  = null;
            DistrictBLLobj = null;
        }
Exemple #7
0
        /// <summary>
        /// To update details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UpdateBudgetItem()
        {
            DistrictBLL DistrictBLLobj = new DistrictBLL();
            DistrictBO  DistrictBOobj  = new DistrictBO();
            string      message        = "";

            try
            {
                if (ViewState["District_ID"] != null)
                {
                    DistrictBOobj.DistrictID = Convert.ToInt32(ViewState["District_ID"].ToString());
                }

                string uID = string.Empty;
                uID = Session["USER_ID"].ToString();

                DistrictBOobj.DistrictName = txtDistrict.Text.Trim();
                DistrictBOobj.UpdatedBy    = Convert.ToInt32(uID);

                message = DistrictBLLobj.UpdateDistrict(DistrictBOobj);

                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                }

                ClearData();
                SetUpdateMode(false);
                BindGrid();

                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Updated", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                DistrictBLLobj = null;
            }
        }
Exemple #8
0
        /// <summary>
        /// To save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveBudgetItem()
        {
            DistrictBLL DistrictBLLobj = new DistrictBLL();
            DistrictBO  DistrictBOobj  = new DistrictBO();

            string message = "";


            string uID = string.Empty;

            uID = Session["USER_ID"].ToString();

            DistrictBOobj.DistrictName = txtDistrict.Text.Trim();
            DistrictBOobj.CreatedBy    = Convert.ToInt32(uID);

            try
            {
                message = DistrictBLLobj.AddDistrict(DistrictBOobj);

                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data saved successfully";
                }

                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }

                ClearData();
                BindGrid();
            }
            catch (Exception ee)
            {
                throw ee;
            }
            finally
            {
                DistrictBLLobj = null;
            }
        }
Exemple #9
0
        public DistrictList LoadDistrictData()
        {
            cnn = new OracleConnection(AppConfiguration.ConnectionString);
            string proc = "USP_MST_GET_DISTRICT";

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
            cmd.Connection.Open();
            OracleDataReader dr       = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            DistrictBO       obMaster = null;
            DistrictList     Master   = new DistrictList();

            while (dr.Read())
            {
                obMaster              = new DistrictBO();
                obMaster.DistrictID   = dr.GetInt32(dr.GetOrdinal("DISTRICTID"));
                obMaster.DistrictName = dr.GetString(dr.GetOrdinal("DISTRICTNAME"));
                Master.Add(obMaster);
            }
            dr.Close();
            return(Master);
        }
Exemple #10
0
        /// <summary>
        /// to get data based on ID
        /// </summary>
        /// <param name="DistrictId"></param>
        /// <returns></returns>
        public DistrictBO GetDistrictById(int DistrictId)
        {
            proc = "USP_MST_GET_DISTRICTBYID";

            cnn = new OracleConnection(connStr);
            DistrictBO DistrictBOobj = null;

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("DISTRICTID_", DistrictId);
            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
            try
            {
                cmd.Connection.Open();
                OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                while (dr.Read())
                {
                    DistrictBOobj = new DistrictBO();

                    if (!dr.IsDBNull(dr.GetOrdinal("DISTRICTID")))
                    {
                        DistrictBOobj.DistrictID = dr.GetInt32(dr.GetOrdinal("DISTRICTID"));
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("DISTRICTNAME")))
                    {
                        DistrictBOobj.DistrictName = dr.GetString(dr.GetOrdinal("DISTRICTNAME"));
                    }
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(DistrictBOobj);
        }
        public int Insert(District obj)
        {
            DistrictBO districtBO = new DistrictBO(obj);

            return(districtDao.Insert(districtBO));
        }
Exemple #12
0
 /// <summary>
 /// To Update District
 /// </summary>
 /// <param name="objDistrictBO"></param>
 /// <returns></returns>
 public string UpdateDistrict(DistrictBO objDistrictBO)
 {
     return((new DistrictDAL()).UpdateDistrict(objDistrictBO));
 }
Exemple #13
0
 /// <summary>
 /// To Add District
 /// </summary>
 /// <param name="objDistrictBO"></param>
 /// <returns></returns>
 public string AddDistrict(DistrictBO objDistrictBO)
 {
     return((new DistrictDAL()).AddDistrict(objDistrictBO));
 }