public bool Update(OptionItem OptionItem, Database db, DbTransaction transaction) { DbCommand command = db.GetStoredProcCommand("usp_OptionItemUpdate"); db.AddInParameter(command, "OptionItemId", DbType.String, OptionItem.OptionItemId); db.AddInParameter(command, "Name", DbType.String, OptionItem.Name); db.AddInParameter(command, "Description", DbType.String, OptionItem.Description); db.AddInParameter(command, "IsDeleted", DbType.Boolean, OptionItem.IsDeleted); db.AddInParameter(command, "OptionId", DbType.Int16, OptionItem.OptionId); db.AddInParameter(command, "UpdatedBy", DbType.Guid, OptionItem.UpdatedBy); db.AddOutParameter(command, "UpdatedDate", DbType.DateTime, 30); if (transaction == null) { db.ExecuteNonQuery(command); } else { db.ExecuteNonQuery(command, transaction); } OptionItem.UpdatedDate = Convert.ToDateTime(db.GetParameterValue(command, "UpdatedDate").ToString()); return true; }
public bool Update(OptionItem OptionItem, Database db, DbTransaction transaction) { DbCommand command = db.GetStoredProcCommand("usp_OptionItemUpdate"); db.AddInParameter(command, "OptionItemId", DbType.String, OptionItem.OptionItemId); db.AddInParameter(command, "Name", DbType.String, OptionItem.Name); db.AddInParameter(command, "Description", DbType.String, OptionItem.Description); db.AddInParameter(command, "IsDeleted", DbType.Boolean, OptionItem.IsDeleted); db.AddInParameter(command, "OptionId", DbType.Int16, OptionItem.OptionId); db.AddInParameter(command, "UpdatedBy", DbType.Guid, OptionItem.UpdatedBy); db.AddOutParameter(command, "UpdatedDate", DbType.DateTime, 30); if (transaction == null) { db.ExecuteNonQuery(command); } else { db.ExecuteNonQuery(command, transaction); } OptionItem.UpdatedDate = Convert.ToDateTime(db.GetParameterValue(command, "UpdatedDate").ToString()); return(true); }
public bool Delete(OptionItem OptionItem, Database db, DbTransaction transaction) { DbCommand command = db.GetStoredProcCommand("usp_OptionItemDelete"); db.AddInParameter(command, "OptionItemId", DbType.Guid, OptionItem.OptionItemId); db.AddInParameter(command, "IsDeleted", DbType.Guid, OptionItem.IsDeleted); db.ExecuteNonQuery(command, transaction); return true; }
public bool Delete(OptionItem OptionItem, Database db, DbTransaction transaction) { DbCommand command = db.GetStoredProcCommand("usp_OptionItemDelete"); db.AddInParameter(command, "OptionItemId", DbType.Guid, OptionItem.OptionItemId); db.AddInParameter(command, "IsDeleted", DbType.Guid, OptionItem.IsDeleted); db.ExecuteNonQuery(command, transaction); return(true); }
public bool Update(OptionItem OptionItem) { Database db = DatabaseFactory.CreateDatabase(Constants.CONNECTIONSTRING); return this.Update(OptionItem, db, null); }
public bool Delete(OptionItem OptionItem) { Database db = DatabaseFactory.CreateDatabase(Constants.CONNECTIONSTRING); return(this.Delete(OptionItem, db, null)); }
protected void gvFeatureItemList_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { OptionItem optionItem = new OptionItem(); int i = gvFeatureItemList.FindVisibleIndexByKeyValue(e.Keys[gvFeatureItemList.KeyFieldName]); e.Cancel = true; optionItem.OptionItemId = Convert.ToInt16(e.Keys[gvFeatureItemList.KeyFieldName]); if (new OptionItemDAO().Delete(optionItem)) { //Show Success message } else { //Error message } Session[Constants.SESSION_FEATURE_ITEMS_LIST] = new OptionItemDAO().SelectAllDataset(); LoadGrid(); }
protected void gvFeatureItemList_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { ASPxGridView gridView = sender as ASPxGridView; OptionItem optionItem = new OptionItem(); optionItem.OptionItemId = Convert.ToInt16(e.Keys[gvFeatureItemList.KeyFieldName]); //Convert.ToInt16(e.NewValues["OptionItemId"].ToString().Trim()); optionItem.Name = e.NewValues["Name"].ToString().Trim(); optionItem.Description = e.NewValues["Description"].ToString().Trim(); //optionItem.IsDeleted = Convert.ToBoolean(e.NewValues["IsDeleted"].ToString().Trim()); optionItem.OptionId = Convert.ToInt16(e.NewValues["OptionId"].ToString().Trim()); optionItem.CreatedBy = (Guid)Membership.GetUser().ProviderUserKey; optionItem.UpdatedBy = (Guid)Membership.GetUser().ProviderUserKey; gridView.CancelEdit(); e.Cancel = true; if (optionItem.Save()) { //Show Success message } else { //Error message } Session[Constants.SESSION_FEATURE_ITEMS_LIST] = new OptionItemDAO().SelectAllDataset(); LoadGrid(); }