Exemple #1
0
        public List <AdjutancyType> SearchLike(AdjutancyType adjutancyType)
        {
            List <AdjutancyType> listAdjutancyType = new List <AdjutancyType>();


            SqlParameter[] parametersAdjutancyType = new SqlParameter[]
            {
                new SqlParameter("@AdjutancyTypeID", adjutancyType.AdjutancyTypeID),
                new SqlParameter("@AdjutantFullName", adjutancyType.AdjutantFullName),
                new SqlParameter("@AdjutantNationalCode", adjutancyType.AdjutantNationalCode),
                new SqlParameter("@Title", adjutancyType.Title),
            };
            using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("AdjutancyType_SearchLike", CommandType.StoredProcedure, parametersAdjutancyType))
            {
                if (table.Rows.Count > 0)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        AdjutancyType tmpAdjutancyType = new AdjutancyType();
                        tmpAdjutancyType.AdjutancyTypeID      = (row["AdjutancyTypeID"] != DBNull.Value) ? Convert.ToInt32(row["AdjutancyTypeID"]) : 0;
                        tmpAdjutancyType.AdjutantFullName     = row["AdjutantFullName"].ToString();
                        tmpAdjutancyType.AdjutantNationalCode = (row["AdjutantNationalCode"] != DBNull.Value) ? Convert.ToInt64(row["AdjutantNationalCode"]) : 0;
                        tmpAdjutancyType.Title = row["Title"].ToString();

                        listAdjutancyType.Add(tmpAdjutancyType);
                    }
                }
            }

            return(listAdjutancyType);
        }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string adjutancyTypeID = Request.QueryString["adjutancyTypeID"] as string;

        if (adjutancyTypeID == null)
        {
            Response.Redirect("Z_AdjutancyTypeDefault.aspx");
        }

        try
        {
            adjutancyTypeAdjutancyTypeID = Convert.ToInt32(adjutancyTypeID.Trim());
            adjutancyTypeHandler         = new AdjutancyTypeHandler();

            AdjutancyType adjutancyType = adjutancyTypeHandler.GetDetails(adjutancyTypeAdjutancyTypeID);

            lblAdjutancyTypeID.Text      = adjutancyType.AdjutancyTypeID.ToString();
            lblAdjutantFullName.Text     = adjutancyType.AdjutantFullName.ToString();
            lblAdjutantNationalCode.Text = adjutancyType.AdjutantNationalCode.ToString();
            lblTitle.Text = adjutancyType.Title.ToString();
        }
        catch (Exception)
        {
            Response.Redirect("Z_AdjutancyTypeDefault.aspx");
        }
    }
Exemple #3
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Label   lblAdjutancyTypeID      = GridView1.Rows[e.RowIndex].FindControl("lblAdjutancyTypeID") as Label;
        Label   lblAdjutantFullName     = GridView1.Rows[e.RowIndex].FindControl("lblAdjutantFullName") as Label;
        TextBox txtAdjutantNationalCode = GridView1.Rows[e.RowIndex].FindControl("txtAdjutantNationalCode") as TextBox;
        TextBox txtTitle = GridView1.Rows[e.RowIndex].FindControl("txtTitle") as TextBox;


        if (lblAdjutancyTypeID != null && lblAdjutantFullName != null && txtAdjutantNationalCode != null && txtTitle != null)
        {
            AdjutancyType adjutancyType = new AdjutancyType();

            adjutancyType.AdjutancyTypeID      = Convert.ToInt32(lblAdjutancyTypeID.Text.Trim());
            adjutancyType.AdjutantFullName     = lblAdjutantFullName.Text;
            adjutancyType.AdjutantNationalCode = Convert.ToInt64(txtAdjutantNationalCode.Text.Trim());
            adjutancyType.Title = txtTitle.Text;

            //Let us now update the database
            if (adjutancyTypeHandler.Update(adjutancyType) == true)
            {
                lblResult.Text = "Record Updated Successfully";
            }
            else
            {
                lblResult.Text = "Failed to Update record";
            }

            //end the editing and bind with updated records.
            GridView1.EditIndex = -1;
            BindData();
        }
    }
Exemple #4
0
 public bool Exists(AdjutancyType adjutancyType)
 {
     SqlParameter[] parametersAdjutancyType = new SqlParameter[]
     {
         new SqlParameter("@AdjutancyTypeID", adjutancyType.AdjutancyTypeID)
     };
     return(SqlDBHelper.ExecuteScalar("AdjutancyType_Exists", CommandType.StoredProcedure, parametersAdjutancyType) > 0);
 }
Exemple #5
0
 public Int64 Insert(AdjutancyType adjutancyType)
 {
     SqlParameter[] parametersAdjutancyType = new SqlParameter[]
     {
         new SqlParameter("@AdjutantNationalCode", (adjutancyType.AdjutantNationalCode != null) ? adjutancyType.AdjutantNationalCode : (object)DBNull.Value),
         new SqlParameter("@Title", (adjutancyType.Title != null) ? adjutancyType.Title : (object)DBNull.Value)
     };
     adjutancyType.AdjutancyTypeID = Convert.ToInt32(SqlDBHelper.ExecuteScalar("AdjutancyType_Insert", CommandType.StoredProcedure, parametersAdjutancyType));
     return(adjutancyType.AdjutancyTypeID);
 }
Exemple #6
0
 public bool Update(AdjutancyType adjutancyType)
 {
     SqlParameter[] parametersAdjutancyType = new SqlParameter[]
     {
         new SqlParameter("@AdjutancyTypeID", adjutancyType.AdjutancyTypeID),
         new SqlParameter("@AdjutantNationalCode", (adjutancyType.AdjutantNationalCode != null) ? adjutancyType.AdjutantNationalCode : (object)DBNull.Value),
         new SqlParameter("@Title", (adjutancyType.Title != null) ? adjutancyType.Title : (object)DBNull.Value)
     };
     return(SqlDBHelper.ExecuteNonQuery("AdjutancyType_Update", CommandType.StoredProcedure, parametersAdjutancyType));
 }
Exemple #7
0
    protected void btnYES_Click(object sender, EventArgs e)
    {
        AdjutancyType adjutancyType = new AdjutancyType();

        adjutancyType.AdjutantNationalCode = Convert.ToInt64(txtAdjutantNationalCode.Text);
        adjutancyType.Title = txtTitle.Text;

        AdjutancyTypeHandler adjutancyTypeHandler = new AdjutancyTypeHandler();

        if (adjutancyTypeHandler.Insert(adjutancyType) > 0)
        {
            Response.Redirect("Z_AdjutancyTypeDefault.aspx");
        }
    }
Exemple #8
0
        public AdjutancyType GetDetails(int adjutancyTypeID)
        {
            AdjutancyType adjutancyType = new AdjutancyType();

            SqlParameter[] parametersAdjutancyType = new SqlParameter[]
            {
                new SqlParameter("@AdjutancyTypeID", adjutancyTypeID)
            };
            using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("AdjutancyType_GetDetails", CommandType.StoredProcedure, parametersAdjutancyType))
            {
                if (table.Rows.Count == 1)
                {
                    DataRow row = table.Rows[0];

                    adjutancyType.AdjutancyTypeID      = (row["AdjutancyTypeID"] != DBNull.Value) ? Convert.ToInt32(row["AdjutancyTypeID"]) : 0;
                    adjutancyType.AdjutantFullName     = row["AdjutantFullName"].ToString();
                    adjutancyType.AdjutantNationalCode = (row["AdjutantNationalCode"] != DBNull.Value) ? Convert.ToInt64(row["AdjutantNationalCode"]) : 0;
                    adjutancyType.Title = row["Title"].ToString();
                }
            }

            return(adjutancyType);
        }
Exemple #9
0
        public List <AdjutancyType> GetListAll()
        {
            List <AdjutancyType> listAdjutancyType = null;

            using (DataTable table = SqlDBHelper.ExecuteSelectCommand("AdjutancyType_GetListAll", CommandType.StoredProcedure))
            {
                if (table.Rows.Count > 0)
                {
                    listAdjutancyType = new List <AdjutancyType>();

                    foreach (DataRow row in table.Rows)
                    {
                        AdjutancyType adjutancyType = new AdjutancyType();
                        adjutancyType.AdjutancyTypeID      = (row["AdjutancyTypeID"] != DBNull.Value) ? Convert.ToInt32(row["AdjutancyTypeID"]) : 0;
                        adjutancyType.AdjutantFullName     = row["AdjutantFullName"].ToString();
                        adjutancyType.AdjutantNationalCode = (row["AdjutantNationalCode"] != DBNull.Value) ? Convert.ToInt64(row["AdjutantNationalCode"]) : 0;
                        adjutancyType.Title = row["Title"].ToString();
                        listAdjutancyType.Add(adjutancyType);
                    }
                }
            }

            return(listAdjutancyType);
        }