Пример #1
0
        private void GetShock()
        {
            MajorshockBLL MajorshockBLLobj = new MajorshockBLL();
            int           PAP_SHOCKID1     = 0;

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

            MajorshockBO Majorshockobj = new MajorshockBO();

            Majorshockobj = MajorshockBLLobj.GetPapShochId(PAP_SHOCKID1);

            pap_shockidTextBox.Text = Majorshockobj.PAP_SHOCKID1.ToString();

            typeofshockDropDownList.ClearSelection();
            if (typeofshockDropDownList.Items.FindByValue(Majorshockobj.SHOCKID1.ToString()) != null)
            {
                typeofshockDropDownList.Items.FindByValue(Majorshockobj.SHOCKID1.ToString()).Selected = true;
            }

            helpedDropDownList.ClearSelection();
            if (helpedDropDownList.Items.FindByValue(Majorshockobj.SUPPORTID1.ToString()) != null)
            {
                helpedDropDownList.Items.FindByValue(Majorshockobj.SUPPORTID1.ToString()).Selected = true;
            }

            copingmechDropDownList.ClearSelection();
            if (copingmechDropDownList.Items.FindByValue(Majorshockobj.COP_MECHANISMID1.ToString()) != null)
            {
                copingmechDropDownList.Items.FindByValue(Majorshockobj.COP_MECHANISMID1.ToString()).Selected = true;
            }
        }
Пример #2
0
        /// <summary>
        /// To Get Major shock
        /// </summary>
        /// <param name="householdID"></param>
        /// <returns></returns>
        public major_shockList GetMshock(int householdID)
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;

            string proc = "USP_TRN_SEL_SHOCK";

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

            cmd.Parameters.Add("HHID_", householdID);
            cmd.Parameters.Add("Sp_recordset", Oracle.DataAccess.Client.OracleDbType.RefCursor).Direction = ParameterDirection.Output;

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

            MajorshockBO    Majorshockobj      = null;
            major_shockList major_shockListobj = new major_shockList();

            while (dr.Read())
            {
                Majorshockobj = new MajorshockBO();
                Majorshockobj.PAP_SHOCKID1      = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("PAP_SHOCKID")));
                Majorshockobj.SHOCKEXPERIENCED1 = dr.GetString(dr.GetOrdinal("shockexperienced"));
                Majorshockobj.SUPPORTEDBY1      = dr.GetString(dr.GetOrdinal("supportedby"));
                Majorshockobj.COP_MECHANISM1    = dr.GetString(dr.GetOrdinal("cop_mechanism"));
                Majorshockobj.ISDELETED1        = dr.GetString(dr.GetOrdinal("ISDELETED"));
                major_shockListobj.Add(Majorshockobj);
            }

            dr.Close();

            return(major_shockListobj);
        }
Пример #3
0
        /// <summary>
        /// To Get Pap ShocK Id
        /// </summary>
        /// <param name="PAP_SHOCKID1"></param>
        /// <returns></returns>
        public MajorshockBO GetPapShochId(int PAP_SHOCKID1)
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;

            string proc = "USP_TRN_GET_SHOCK";

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

            cmd.Connection.Open();

            OracleDataReader dr                 = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            MajorshockBO     Majorshockobj      = null;
            major_shockList  major_shockListobj = new major_shockList();

            Majorshockobj = new MajorshockBO();
            while (dr.Read())
            {
                if (ColumnExists(dr, "pap_shockid") && !dr.IsDBNull(dr.GetOrdinal("pap_shockid")))
                {
                    Majorshockobj.PAP_SHOCKID1 = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("pap_shockid")));
                }
                if (ColumnExists(dr, "shockid") && !dr.IsDBNull(dr.GetOrdinal("shockid")))
                {
                    Majorshockobj.SHOCKID1 = dr.GetInt32(dr.GetOrdinal("shockid"));
                }
                if (ColumnExists(dr, "cop_mechanismid") && !dr.IsDBNull(dr.GetOrdinal("cop_mechanismid")))
                {
                    Majorshockobj.COP_MECHANISMID1 = dr.GetInt32(dr.GetOrdinal("cop_mechanismid"));
                }
                if (ColumnExists(dr, "supportid") && !dr.IsDBNull(dr.GetOrdinal("supportid")))
                {
                    Majorshockobj.SUPPORTID1 = dr.GetInt32(dr.GetOrdinal("supportid"));
                }
            }
            dr.Close();


            return(Majorshockobj);
        }
Пример #4
0
        /// <summary>
        /// To Insert into DB
        /// </summary>
        /// <param name="Majorshockobj"></param>
        /// <returns></returns>
        public string Insert(MajorshockBO Majorshockobj)
        {
            string           resultMessage = string.Empty;
            OracleConnection cnn           = new OracleConnection(AppConfiguration.ConnectionString);

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

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

            try
            {
                dcmd.Parameters.Add("HHID_", Majorshockobj.HHID1);
                dcmd.Parameters.Add("SHOCKID_", Majorshockobj.SHOCKID1);
                dcmd.Parameters.Add("COP_MECHANISMID_", Majorshockobj.COP_MECHANISMID1);
                dcmd.Parameters.Add("SUPPORTID_", Majorshockobj.SUPPORTID1);
                dcmd.Parameters.Add("CREATEDBY_", Majorshockobj.CREATEDBY1);
                dcmd.Parameters.Add("errorMessage_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output;

                dcmd.ExecuteNonQuery();

                if (dcmd.Parameters["errorMessage_"].Value != null)
                {
                    resultMessage = dcmd.Parameters["errorMessage_"].Value.ToString();
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                dcmd.Dispose();
                cnn.Close();
                cnn.Dispose();
            }
            return(resultMessage);
        }
Пример #5
0
        /// <summary>
        /// to save the data to the database
        /// and clear the data fields by calling clearfields() method
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string message = string.Empty;

            ChangeRequestStatusMajorSchock();

            MajorshockBLL MajorshockBLLobj = new MajorshockBLL();

            if (pap_shockidTextBox.Text == string.Empty)
            {
                try
                {
                    string       uID           = Session["USER_ID"].ToString();
                    string       hhid          = Session["HH_ID"].ToString();
                    MajorshockBO Majorshockobj = new MajorshockBO();

                    Majorshockobj.COP_MECHANISMID1 = Convert.ToInt32(copingmechDropDownList.SelectedValue.ToString());
                    Majorshockobj.SHOCKID1         = Convert.ToInt32(typeofshockDropDownList.SelectedValue.ToString());
                    Majorshockobj.SUPPORTID1       = Convert.ToInt32(helpedDropDownList.SelectedValue.ToString());
                    Majorshockobj.CREATEDBY1       = Convert.ToInt32(Session["USER_ID"]);
                    Majorshockobj.HHID1            = Convert.ToInt32(hhid);
                    MajorshockBLL BLLobj = new MajorshockBLL();
                    message = BLLobj.Insert(Majorshockobj);
                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data saved successfully";
                    }
                    //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Data saved successfully');", true);
                    BindGrid();
                    clearfields();
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                finally
                {
                    MajorshockBLLobj = null;
                }
            }

            //edit the data  existing in the Grid
            else
            {
                MajorshockBLL BLLobj = new MajorshockBLL();

                try
                {
                    string       uID           = Session["USER_ID"].ToString();
                    MajorshockBO Majorshockobj = new MajorshockBO();
                    Majorshockobj.PAP_SHOCKID1     = Convert.ToInt32(pap_shockidTextBox.Text);
                    Majorshockobj.SHOCKID1         = Convert.ToInt32(typeofshockDropDownList.SelectedValue);
                    Majorshockobj.COP_MECHANISMID1 = Convert.ToInt32(copingmechDropDownList.SelectedValue);
                    Majorshockobj.SUPPORTID1       = Convert.ToInt32(helpedDropDownList.SelectedValue);
                    Majorshockobj.CREATEDBY1       = Convert.ToInt32(Session["USER_ID"]);

                    message = BLLobj.EDITMshock(Majorshockobj);
                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data updated successfully";
                    }
                    BindGrid();
                    clearfields();
                    SetUpdateMode(false);
                    //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Data updated successfully');", true);
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                finally
                {
                    MajorshockBLLobj = null;
                }
            }
            string AlertMessage = "alert('" + message + "');";

            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
            projectFrozen(); //Added BY Ramu
        }
Пример #6
0
        /// <summary>
        /// To Insert into Database
        /// </summary>
        /// <param name="Majorshockobj"></param>
        /// <returns></returns>
        public string Insert(MajorshockBO Majorshockobj)
        {
            MajorshockDAL MajorshockDALobj = new MajorshockDAL(); //Data pass -to Database Layer

            return(MajorshockDALobj.Insert(Majorshockobj));
        }
Пример #7
0
        /// <summary>
        /// To EDIT Major shock
        /// </summary>
        /// <param name="Majorshockobj"></param>
        /// <returns></returns>
        public string EDITMshock(MajorshockBO Majorshockobj)
        {
            MajorshockDAL MajorshockDALobj = new MajorshockDAL(); //Data pass -to Database Layer

            return(MajorshockDALobj.EDITMshock(Majorshockobj));
        }