public Boolean Update(MST_CategoryTypeENT entMST_CategoryType)
        {
            try
            {
                SqlDatabase sqlDB = new SqlDatabase(myConnectionString);
                DbCommand   dbCMD = sqlDB.GetStoredProcCommand("PR_MST_CategoryType_UpdateByPK");

                sqlDB.AddInParameter(dbCMD, "@CategoryTypeID", SqlDbType.Int, entMST_CategoryType.CategoryTypeID);
                sqlDB.AddInParameter(dbCMD, "@CategoryType", SqlDbType.VarChar, entMST_CategoryType.CategoryType);
                sqlDB.AddInParameter(dbCMD, "@ModificationDate", SqlDbType.DateTime, entMST_CategoryType.ModificationDate);

                DataBaseHelper DBH = new DataBaseHelper();
                DBH.ExecuteNonQuery(sqlDB, dbCMD);

                return(true);
            }
            catch (SqlException sqlex)
            {
                Message = SQLDataExceptionMessage(sqlex);
                if (SQLDataExceptionHandler(sqlex))
                {
                    throw;
                }
                return(false);
            }
            catch (Exception ex)
            {
                Message = ExceptionMessage(ex);
                if (ExceptionHandler(ex))
                {
                    throw;
                }
                return(false);
            }
        }
        public Boolean Update(MST_CategoryTypeENT entMST_CategoryType)
        {
            MST_CategoryTypeDAL dalMST_CategoryType = new MST_CategoryTypeDAL();

            if (dalMST_CategoryType.Update(entMST_CategoryType))
            {
                return(true);
            }
            else
            {
                this.Message = dalMST_CategoryType.Message;
                return(false);
            }
        }
Example #3
0
    private void FillControls(Int32 CategoryTypeID)
    {
        //lblPageHeader.Text = CV.PageHeaderEdit + " CategoryType";

        MST_CategoryTypeBAL balMST_CategoryType = new MST_CategoryTypeBAL();
        MST_CategoryTypeENT entMST_CategoryType = new MST_CategoryTypeENT();

        entMST_CategoryType = balMST_CategoryType.SelectPK(CategoryTypeID);

        if (!entMST_CategoryType.CategoryType.IsNull)
        {
            txtCategoryType.Text = entMST_CategoryType.CategoryType.Value.ToString();
        }
    }
        public MST_CategoryTypeENT SelectPK(SqlInt32 CategoryTypeID)
        {
            try
            {
                SqlDatabase sqlDB = new SqlDatabase(myConnectionString);
                DbCommand   dbCMD = sqlDB.GetStoredProcCommand("PR_MST_CategoryType_SelectByPK");

                sqlDB.AddInParameter(dbCMD, "@CategoryTypeID", SqlDbType.Int, CategoryTypeID);

                MST_CategoryTypeENT entMST_CategoryType = new MST_CategoryTypeENT();
                DataBaseHelper      DBH = new DataBaseHelper();
                using (IDataReader dr = DBH.ExecuteReader(sqlDB, dbCMD))
                {
                    while (dr.Read())
                    {
                        if (!dr["CategoryTypeID"].Equals(System.DBNull.Value))
                        {
                            entMST_CategoryType.CategoryTypeID = Convert.ToInt32(dr["CategoryTypeID"]);
                        }

                        if (!dr["CategoryType"].Equals(System.DBNull.Value))
                        {
                            entMST_CategoryType.CategoryType = Convert.ToString(dr["CategoryType"]);
                        }
                    }
                }
                return(entMST_CategoryType);
            }
            catch (SqlException sqlex)
            {
                Message = SQLDataExceptionMessage(sqlex);
                if (SQLDataExceptionHandler(sqlex))
                {
                    throw;
                }
                return(null);
            }
            catch (Exception ex)
            {
                Message = ExceptionMessage(ex);
                if (ExceptionHandler(ex))
                {
                    throw;
                }
                return(null);
            }
        }
Example #5
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (Request.QueryString["CategoryTypeID"] == null)
        {
            MST_CategoryTypeENT entMST_CategoryType = new MST_CategoryTypeENT();

            if (txtCategoryType.Text.ToString().Trim() != "")
            {
                entMST_CategoryType.CategoryType = txtCategoryType.Text.ToString().Trim();
            }

            entMST_CategoryType.CreationDate     = DateTime.Now;
            entMST_CategoryType.ModificationDate = DateTime.Now;
            entMST_CategoryType.UserID           = Convert.ToInt32(Session["UserID"]);

            MST_CategoryTypeBAL balMST_CategoryType = new MST_CategoryTypeBAL();
            if (balMST_CategoryType.Insert(entMST_CategoryType))
            {
                pnlAlert.Visible = true;
                lblMessage.Text  = "Data Inserted Successfully.";
                ClearControls();
            }
        }
        else
        {
            MST_CategoryTypeENT entMST_CategoryType = new MST_CategoryTypeENT();
            if (txtCategoryType.Text.ToString().Trim() != "")
            {
                entMST_CategoryType.CategoryType = txtCategoryType.Text.ToString().Trim();
            }
            entMST_CategoryType.CategoryTypeID   = Convert.ToInt32(Request.QueryString["CategoryTypeID"]);
            entMST_CategoryType.ModificationDate = DateTime.Now;
            entMST_CategoryType.UserID           = Convert.ToInt32(Session["UserID"]);
            MST_CategoryTypeBAL balMST_CategoryType = new MST_CategoryTypeBAL();
            if (balMST_CategoryType.Update(entMST_CategoryType))
            {
                Response.Redirect("~/AdminPanel/Master/MST_CategoryType/MST_CategoryTypeList.aspx");
            }
        }
    }