Exemple #1
0
        /// <summary>
        /// To save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private string Insert()
        {
            string AlertMessage = string.Empty;
            string message      = string.Empty;

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

            GOUAllowanceBOobj = new GOUAllowanceBO();
            GOUAllowanceBOobj.GOUAllowanceCategory = txtGOUAllowanceCat.Text.ToString();
            GOUAllowanceBOobj.GOUAllowanceValue    = Convert.ToDecimal(txtGOUAllowanceVal.Text);
            GOUAllowanceBOobj.Createddate          = System.DateTime.Now;
            GOUAllowanceBOobj.Isdeleted            = false;
            GOUAllowanceBOobj.Createdby            = Convert.ToInt32(uID);
            GOUAllowanceBLL GOUAllowanceBLLObj = new GOUAllowanceBLL();

            try
            {
                message = GOUAllowanceBLLObj.Insert(GOUAllowanceBOobj);
            }
            catch (Exception ex)
            {
                string errorMsg = ex.Message.ToString();
                Response.Write(errorMsg);
            }
            finally
            {
                GOUAllowanceBLLObj = null;
            }
            return(message);
        }
Exemple #2
0
        /// <summary>
        /// To fetch details
        /// </summary>
        private void GetGouAllowanceDetails()
        {
            GOUAllowanceBLL GOUAllowanceBLLObj     = new GOUAllowanceBLL();
            int             GOUALLOWANCECATEGORYID = 0;

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

            GOUAllowanceBOobj       = new GOUAllowanceBO();
            GOUAllowanceBOobj       = GOUAllowanceBLLObj.GetGouAllowancebyID(GOUALLOWANCECATEGORYID);
            txtGOUAllowanceCat.Text = GOUAllowanceBOobj.GOUAllowanceCategory;
            txtGOUAllowanceVal.Text = GOUAllowanceBOobj.GOUAllowanceValue.ToString();
        }
Exemple #3
0
        /// <summary>
        /// calls method save details to the database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string AlertMessage = string.Empty;
            string message      = string.Empty;

            try
            {
                if (ViewState["GOUALLOWANCECATEGORYID"].ToString() == "0")
                {
                    message = Insert();


                    AlertMessage = "alert('" + message + "');";

                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data saved successfully";
                        cleardetails();
                    }
                }
                else
                {
                    string uID      = Session["USER_ID"].ToString();
                    int    reasonid = Convert.ToInt32(ViewState["GOUALLOWANCECATEGORYID"]);
                    GOUAllowanceBOobj = new GOUAllowanceBO();
                    GOUAllowanceBOobj.GOUAllowanceCategory = txtGOUAllowanceCat.Text.ToString();
                    GOUAllowanceBOobj.GOUAllowanceValue    = Convert.ToDecimal(txtGOUAllowanceVal.Text);
                    GOUAllowanceBOobj.Createdby            = Convert.ToInt32(uID);;
                    GOUAllowanceBLL GOUAllowanceBLLObj = new GOUAllowanceBLL();
                    message = GOUAllowanceBLLObj.Update(GOUAllowanceBOobj, reasonid);

                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data updated successfully";
                        cleardetails();
                        SetUpdateMode(false);
                    }
                }
                BindGrid();
            }
            catch (Exception ex)
            {
                string errorMsg = ex.Message.ToString();
                Response.Write(errorMsg);
            }
            AlertMessage = "alert('" + message + "');";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
        }
Exemple #4
0
        /// <summary>
        /// To Update
        /// </summary>
        /// <param name="GOUAllowanceBOobj"></param>
        /// <param name="reasonid"></param>
        /// <returns></returns>
        public string Update(GOUAllowanceBO GOUAllowanceBOobj, int reasonid)
        {
            GOUAllowanceDAL GOUAllowanceDALobj = new GOUAllowanceDAL();

            try
            {
                return(GOUAllowanceDALobj.Update(GOUAllowanceBOobj, reasonid));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                GOUAllowanceDALobj = null;
            }
        }
Exemple #5
0
        /// <summary>
        /// To Insert into Databse
        /// </summary>
        /// <param name="GOUAllowanceBOobj"></param>
        /// <returns></returns>
        public string Insert(GOUAllowanceBO GOUAllowanceBOobj)
        {
            GOUAllowanceDAL GOUAllowanceDALobj = new GOUAllowanceDAL(); //Data pass -to Database Layer

            try
            {
                return(GOUAllowanceDALobj.Insert(GOUAllowanceBOobj));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                GOUAllowanceDALobj = null;
            }
        }
Exemple #6
0
        /// <summary>
        /// to fetch details
        /// </summary>
        /// <returns></returns>
        public GOUAllowanceList GetAllSchoolGOUAllowance()
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;

            string proc = "USP_MST_GETALL_GOUALLOWANC";

            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);
            GOUAllowanceBO   objUser    = null;
            GOUAllowanceList ReasonList = new GOUAllowanceList();

            while (dr.Read())
            {
                objUser = new GOUAllowanceBO();
                if (!dr.IsDBNull(dr.GetOrdinal("GOUALLOWANCECATEGORYID")))
                {
                    objUser.GOUALLOWANCECATEGORYID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("GOUALLOWANCECATEGORYID")));
                }
                if (!dr.IsDBNull(dr.GetOrdinal("GOUALLOWANCECATEGORY")))
                {
                    objUser.GOUAllowanceCategory = dr.GetString(dr.GetOrdinal("GOUALLOWANCECATEGORY"));
                }
                if (!dr.IsDBNull(dr.GetOrdinal("GOUALLOWANCEVALUE")))
                {
                    objUser.GOUAllowanceValue = Convert.ToDecimal(dr.GetValue(dr.GetOrdinal("GOUALLOWANCEVALUE")));
                }
                if (!dr.IsDBNull(dr.GetOrdinal("ISDELETED")))
                {
                    objUser.Isdeleted = Convert.ToBoolean(dr.GetValue(dr.GetOrdinal("ISDELETED")));
                }

                ReasonList.Add(objUser);
            }

            dr.Close();

            return(ReasonList);
        }
Exemple #7
0
        /// <summary>
        /// to update data
        /// </summary>
        /// <param name="GOUAllowanceBOobj"></param>
        /// <param name="reasonid"></param>
        /// <returns></returns>
        public string Update(GOUAllowanceBO GOUAllowanceBOobj, int reasonid)
        {
            string           returnResult = string.Empty;
            OracleConnection conn         = new OracleConnection(AppConfiguration.ConnectionString);

            conn.Open();
            OracleCommand dCmd = new OracleCommand("USP_MST_UPD_GOUALLOWANC", conn);

            dCmd.CommandType = CommandType.StoredProcedure;
            try
            {
                dCmd.Parameters.Add("p_GOUALLOWANCECATEGORYID", reasonid);
                dCmd.Parameters.Add("p_GOUALLOWANCECATEGORY", GOUAllowanceBOobj.GOUAllowanceCategory);
                dCmd.Parameters.Add("p_GOUALLOWANCEVALUE", GOUAllowanceBOobj.GOUAllowanceValue);
                dCmd.Parameters.Add("p_CREATEDBY", GOUAllowanceBOobj.Createdby);
                dCmd.Parameters.Add("errorMessage_", OracleDbType.Varchar2, 100).Direction = ParameterDirection.Output;
                //return dCmd.ExecuteNonQuery();

                dCmd.ExecuteNonQuery();

                if (dCmd.Parameters["errorMessage_"].Value != null)
                {
                    returnResult = dCmd.Parameters["errorMessage_"].Value.ToString();
                }
                else
                {
                    returnResult = string.Empty;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dCmd.Dispose();
                conn.Close();
                conn.Dispose();
            }
            return(returnResult);
        }
Exemple #8
0
        /// <summary>
        /// to fetch details by ID
        /// </summary>
        /// <param name="GouAllowanceID"></param>
        /// <returns></returns>
        public GOUAllowanceBO GetGOUAllowancebyID(int GouAllowanceID)
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;

            string proc = "USP_MST_GET_GOUALLOWANCEBYID";

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

            cmd.Connection.Open();

            OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            GOUAllowanceBO   GOUAllowanceBOobj = null;
            GOUAllowanceList Users             = new GOUAllowanceList();

            GOUAllowanceBOobj = new GOUAllowanceBO();
            while (dr.Read())
            {
                if (ColumnExists(dr, "GOUALLOWANCECATEGORY") && !dr.IsDBNull(dr.GetOrdinal("GOUALLOWANCECATEGORY")))
                {
                    GOUAllowanceBOobj.GOUAllowanceCategory = dr.GetString(dr.GetOrdinal("GOUALLOWANCECATEGORY"));
                }
                if (ColumnExists(dr, "GOUALLOWANCEVALUE") && !dr.IsDBNull(dr.GetOrdinal("GOUALLOWANCEVALUE")))
                {
                    GOUAllowanceBOobj.GOUAllowanceValue = Convert.ToDecimal(dr.GetValue(dr.GetOrdinal("GOUALLOWANCEVALUE")));
                }
                if (ColumnExists(dr, "GOUALLOWANCECATEGORYID") && !dr.IsDBNull(dr.GetOrdinal("GOUALLOWANCECATEGORYID")))
                {
                    GOUAllowanceBOobj.GOUALLOWANCECATEGORYID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("GOUALLOWANCECATEGORYID")));
                }
            }
            dr.Close();


            return(GOUAllowanceBOobj);
        }