Exemplo n.º 1
0
        /// <summary>
        /// To Save the data to the database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSaveService_Click(object sender, EventArgs e)
        {
            PAPServicesList PAPServices    = new PAPServicesList();
            PAPServiceBO    objPAPService  = null;
            CheckBox        chkServiceType = null;
            TextBox         txtServiceType = null;

            foreach (DataListItem lstItem in lstServices.Items)
            {
                if (lstItem.ItemType == ListItemType.Item || lstItem.ItemType == ListItemType.AlternatingItem)
                {
                    chkServiceType = (CheckBox)lstItem.FindControl("chkServiceType");
                    txtServiceType = (TextBox)lstItem.FindControl("txtServiceType");

                    objPAPService             = new PAPServiceBO();
                    objPAPService.HouseholdID = Convert.ToInt32(Session["HH_ID"]);
                    objPAPService.ServiceID   = Convert.ToInt32(((Literal)lstItem.FindControl("litServiceID")).Text);

                    if (txtServiceType.Visible)
                    {
                        objPAPService.FieldValue = txtServiceType.Text;
                    }
                    else if (chkServiceType.Visible)
                    {
                        if (chkServiceType.Checked)
                        {
                            objPAPService.FieldValue = "TRUE";
                        }
                        else
                        {
                            objPAPService.FieldValue = "FALSE";
                        }
                    }
                    else
                    {
                        objPAPService.FieldValue = "";
                    }

                    objPAPService.UpdatedBy = Convert.ToInt32(Session["USER_ID"]);

                    PAPServices.Add(objPAPService);
                }
            }

            (new PAP_RelationBLL()).AddPAPService(PAPServices);
            ChangeRequestStatusServes();
            projectFrozen();//if project Frozen
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ServiceAdded", "alert('Data saved successfully');", true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// To Get PAP Services
        /// </summary>
        /// <param name="householdID"></param>
        /// <returns></returns>
        public PAPServicesList GetPAPServices(int householdID)
        {
            proc = "USP_TRN_GET_PAPSERVICES";
            cnn  = new OracleConnection(con);
            PAPServiceBO objPAPService = null;

            PAPServicesList Services = new PAPServicesList();

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

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

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

                while (dr.Read())
                {
                    objPAPService = new PAPServiceBO();

                    if (!dr.IsDBNull(dr.GetOrdinal("HHID")))
                    {
                        objPAPService.HouseholdID = dr.GetInt32(dr.GetOrdinal("HHID"));
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("SERVICEID")))
                    {
                        objPAPService.ServiceID = dr.GetInt32(dr.GetOrdinal("SERVICEID"));
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("FIELDVALUE")))
                    {
                        objPAPService.FieldValue = dr.GetString(dr.GetOrdinal("FIELDVALUE"));
                    }

                    Services.Add(objPAPService);
                }

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

            return(Services);
        }