Пример #1
0
        /// <summary>
        /// to fetch details
        /// </summary>
        /// <param name="FixedCostCentre"></param>
        /// <returns></returns>
        public FixedCostCentreList GetAllFixedCostCentre(string FixedCostCentre)
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;
            string           proc = "USP_MST_GET_ALL_FIXEDCOSTS";

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            if (FixedCostCentre.ToString() == "")
            {
                cmd.Parameters.Add("@FixedCostCentreIN", DBNull.Value);
            }
            else
            {
                cmd.Parameters.Add("@FixedCostCentreIN", FixedCostCentre.ToString());
            }
            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
            cmd.Connection.Open();
            OracleDataReader    dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            FixedCostCentreBO   objFixedCostCentre = null;
            FixedCostCentreList FixedCostCentres   = new FixedCostCentreList();

            while (dr.Read())
            {
                objFixedCostCentre = new FixedCostCentreBO();
                objFixedCostCentre.FixedCostCentreID          = dr.GetInt16(dr.GetOrdinal("FixedCostCentreId"));
                objFixedCostCentre.FixedCostCentre            = dr.GetString(dr.GetOrdinal("FixedCostCentre"));
                objFixedCostCentre.FixedCostCentreDescription = dr.GetString(dr.GetOrdinal("DESCRIPTION"));
                objFixedCostCentre.IsDeleted = dr.GetString(dr.GetOrdinal("ISDELETED"));
                FixedCostCentres.Add(objFixedCostCentre);
            }
            dr.Close();
            return(FixedCostCentres);
        }
Пример #2
0
        /// <summary>
        /// to fetch details by ID
        /// </summary>
        /// <param name="roleID"></param>
        /// <returns></returns>
        public FixedCostCentreBO GetFixedCostCentreByFixedCostCentreID(int roleID)
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;

            string proc = "USP_MST_GETFCCBYID";

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@FixedCostCentreIdIN", roleID);
            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
            cmd.Connection.Open();
            OracleDataReader  dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            FixedCostCentreBO obFixedCostCentre = null;

            while (dr.Read())
            {
                obFixedCostCentre = new FixedCostCentreBO();
                obFixedCostCentre.FixedCostCentreID          = dr.GetInt16(dr.GetOrdinal("FixedCostCentreId"));
                obFixedCostCentre.FixedCostCentre            = dr.GetString(dr.GetOrdinal("FixedCostCentre"));
                obFixedCostCentre.FixedCostCentreDescription = dr.GetString(dr.GetOrdinal("DESCRIPTION"));
            }
            dr.Close();
            return(obFixedCostCentre);
        }
Пример #3
0
        /// <summary>
        /// To save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            FixedCostCentreBO  objFixedCostCentre = new FixedCostCentreBO();
            FixedCostCentreBLL objroleBLL         = new FixedCostCentreBLL();

            objFixedCostCentre.FixedCostCentreID          = Convert.ToInt32(ViewState["FCCID"]);
            objFixedCostCentre.FixedCostCentre            = txtFixedCostCentre.Text.Trim();
            objFixedCostCentre.FixedCostCentreDescription = txtDescription.Text.Trim();

            if (objFixedCostCentre.FixedCostCentreDescription.Length >= 500)
            {
                objFixedCostCentre.FixedCostCentreDescription = objFixedCostCentre.FixedCostCentreDescription.Substring(0, 499);
            }

            string AlertMessage = string.Empty;
            string message      = string.Empty;

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

            if (objFixedCostCentre.FixedCostCentreID == 0)
            {
                objFixedCostCentre.CreatedBy = Convert.ToInt32(Session["USER_ID"]);
                message = objroleBLL.AddFixedCostCentre(objFixedCostCentre);
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data saved successfully";
                    ClearDetails();
                }
            }
            else
            {
                objFixedCostCentre.UpdatedBy = Convert.ToInt32(Session["USER_ID"]);
                message = objroleBLL.UpdateFixedCostCentre(objFixedCostCentre);
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                    ClearDetails();
                    SetUpdateMode(false);
                }
            }

            BindGrid(true, false);

            AlertMessage = "alert('" + message + "');";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
        }
Пример #4
0
        /// <summary>
        /// to update data
        /// </summary>
        /// <param name="objFixedCostCentre"></param>
        /// <returns></returns>
        public string UpdateFixedCostCentre(FixedCostCentreBO objFixedCostCentre)
        {
            string result = string.Empty;

            {
                OracleConnection myConnection;
                OracleCommand    myCommand;
                myConnection          = new OracleConnection(AppConfiguration.ConnectionString);
                myCommand             = new OracleCommand("USP_MST_UPDATEFCC", myConnection);
                myCommand.Connection  = myConnection;
                myCommand.CommandType = CommandType.StoredProcedure;
                myCommand.Parameters.Add("@FixedCostCentreIDIN", objFixedCostCentre.FixedCostCentreID);
                myCommand.Parameters.Add("@FixedCostCentreIN", objFixedCostCentre.FixedCostCentre);
                if (string.IsNullOrEmpty(objFixedCostCentre.FixedCostCentreDescription) == true)
                {
                    myCommand.Parameters.Add("@FixedCostCentreDescription", " ");
                }
                else
                {
                    myCommand.Parameters.Add("@FixedCostCentreDescription", objFixedCostCentre.FixedCostCentreDescription);
                }
                myCommand.Parameters.Add("@ISDELETEDIN", "False");
                myCommand.Parameters.Add("@USERIDIN", objFixedCostCentre.UpdatedBy);
                myCommand.Parameters.Add("errorMessage_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output;
                myConnection.Open();

                myCommand.ExecuteNonQuery();

                if (myCommand.Parameters["errorMessage_"].Value != null)
                {
                    result = myCommand.Parameters["errorMessage_"].Value.ToString();
                }
                else
                {
                    result = string.Empty;
                }

                myConnection.Close();
            }
            return(result);
        }
Пример #5
0
        /// <summary>
        /// to link to other page on click of link  in grid
        /// </summary>
        /// <returns></returns>
        protected void grdFixedCostCentre_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string message = string.Empty;

            try
            {
                if (e.CommandName == "EditRow")
                {
                    ViewState["FCCID"] = e.CommandArgument;
                    FixedCostCentreBLL objroleBLL         = new FixedCostCentreBLL();
                    FixedCostCentreBO  objFixedCostCentre = objroleBLL.GetFixedCostCentreByFixedCostCentreID(Convert.ToInt32(ViewState["FCCID"]));
                    txtFixedCostCentre.Text = objFixedCostCentre.FixedCostCentre;
                    txtDescription.Text     = objFixedCostCentre.FixedCostCentreDescription;
                    SetUpdateMode(true);
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Added", "setDirty();", true);
                }

                else if (e.CommandName == "DeleteRow")
                {
                    FixedCostCentreBLL objroleBLL = new FixedCostCentreBLL();
                    message = objroleBLL.DeleteFixedCostCentre(Convert.ToInt32(e.CommandArgument));
                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data Deleted successfully";
                    }
                    SetUpdateMode(false);
                    BindGrid(false, true);
                    ClearDetails();
                }

                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #6
0
        /// <summary>
        /// To Update Fixed Cost Centre
        /// </summary>
        /// <param name="objFixedCostCentre"></param>
        /// <returns></returns>
        public string UpdateFixedCostCentre(FixedCostCentreBO objFixedCostCentre)
        {
            FixedCostCentreDAL objFixedCostCentreDAL = new FixedCostCentreDAL();

            return(objFixedCostCentreDAL.UpdateFixedCostCentre(objFixedCostCentre));
        }
Пример #7
0
        /// <summary>
        /// To Add Fixed Cost Centre
        /// </summary>
        /// <param name="objFixedCostCentre"></param>
        /// <returns></returns>
        public string AddFixedCostCentre(FixedCostCentreBO objFixedCostCentre)
        {
            FixedCostCentreDAL objFixedCostCentreDAL = new FixedCostCentreDAL();

            return(objFixedCostCentreDAL.AddFixedCostCentre(objFixedCostCentre));
        }