Exemplo n.º 1
1
        public bool Insert(Option Option, Database db, DbTransaction transaction)
        {
            DbCommand command = db.GetStoredProcCommand("usp_OptionInsert");

            db.AddInParameter(command, "Name", DbType.String, Option.Name);
            db.AddInParameter(command, "Description", DbType.String, Option.Description);
            db.AddInParameter(command, "OptionCategoryId", DbType.Int16, Option.OptionCategoryId);
            db.AddInParameter(command, "ParentOptionId", DbType.Int16, Option.ParentOptionId);
            db.AddInParameter(command, "IsDeleted", DbType.Boolean, Option.IsDeleted);
            db.AddInParameter(command, "IsMultiSelect", DbType.Boolean, Option.IsMultiSelect);
            db.AddInParameter(command, "Points", DbType.Int16, Option.Points);

            db.AddOutParameter(command, "OptionId", DbType.Int16, 3);

            if (transaction == null)
            {
                db.ExecuteNonQuery(command);
            }
            else
            {
                db.ExecuteNonQuery(command, transaction);
            }

            Option.OptionId = Convert.ToInt16(db.GetParameterValue(command, "OptionId").ToString());

            return true;
        }
Exemplo n.º 2
0
        public bool Delete(Option Option, Database db, DbTransaction transaction)
        {
            DbCommand command = db.GetStoredProcCommand("usp_OptionDelete");
            db.AddInParameter(command, "OptionId", DbType.Int16, Option.OptionId);
            db.AddInParameter(command, "IsDeleted", DbType.Boolean, Option.IsDeleted);

            if (transaction == null)
            {
                db.ExecuteNonQuery(command);
            }
            else
            {
                db.ExecuteNonQuery(command, transaction);
            }
            return true;
        }
Exemplo n.º 3
0
 public bool Update(Option Option)
 {
     Database db = DatabaseFactory.CreateDatabase(Constants.CONNECTIONSTRING);
     return this.Update(Option, db, null);
 }
Exemplo n.º 4
0
        protected void gvFeatureList_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            ASPxGridView gridView = sender as ASPxGridView;

            Option option = new Option();
            option.OptionId = Convert.ToInt16(e.Keys[gvFeatureList.KeyFieldName]); //e.NewValues["OptionId"].ToString().Trim());
            option.Name = e.NewValues["Name"].ToString().Trim();
            option.Description = e.NewValues["Description"].ToString().Trim();
            option.OptionCategoryId = Convert.ToInt16(e.NewValues["OptionCategoryId"].ToString().Trim());
            option.Points = Convert.ToInt16(e.NewValues["Points"].ToString().Trim());

               // option.IsMultiSelect = Convert.ToBoolean(e.NewValues["IsMultiSelect"]);  //Convert.ToBoolean(e.NewValues["IsMultiSelect"].ToString().Trim());
            option.CreatedBy = (Guid)Membership.GetUser().ProviderUserKey; //SessionManager.GetSession<User>(Constants.SESSION_LOGGED_USER).UserId.Value;
            option.UpdatedBy = (Guid)Membership.GetUser().ProviderUserKey; //SessionManager.GetSession<User>(Constants.SESSION_LOGGED_USER).UserId.Value;

            gridView.CancelEdit();
            e.Cancel = true;

            if (option.Save())
            {
                //Show Success message
            }
            else
            {
                //Error message
            }
            Session[Constants.SESSION_FEATURE_LIST] = new OptionDAO().SelectAllDataset();
            LoadGrid();
        }
Exemplo n.º 5
0
        protected void gvFeatureList_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            Option option = new Option();

            int i = gvFeatureList.FindVisibleIndexByKeyValue(e.Keys[gvFeatureList.KeyFieldName]);
            e.Cancel = true;

            option.OptionId = Convert.ToInt16(e.Keys[gvFeatureList.KeyFieldName]);
            option.UpdatedBy = (Guid)Membership.GetUser().ProviderUserKey;  //SessionManager.GetSession<User>(Constants.SESSION_LOGGED_USER).UserId.Value;
            option.IsDeleted = true;
            if (new OptionDAO().Delete(option))
            {
                //Show Success message
            }
            else
            {
                //Error message
            }
            Session[Constants.SESSION_FEATURE_LIST] = new OptionDAO().SelectAllDataset();
            LoadGrid();
        }