public IList <MDBrandEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression) { IList <MDBrandEntity> mDBrandEntityList = new List <MDBrandEntity>(); try { if (pageSize == -1) { pageSize = 1000000000; } if (String.IsNullOrEmpty(sortExpression)) { sortExpression = MDBrandEntity.FLD_NAME_BrandID + " " + SQLConstants.SORT_ORDER_DESCENDING; } startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1; mDBrandEntityList = FCCMDBrand.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression); if (mDBrandEntityList != null && mDBrandEntityList.Count > 0) { totalRowCount = mDBrandEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(mDBrandEntityList ?? new List <MDBrandEntity>()); }
private void BindPRMItemBrandMapList() { String sortExpression = SqlExpressionBuilder.PrepareSortExpression(MDBrandEntity.FLD_NAME_BrandName, SQLSortOrderType.Assending); IList <MDBrandEntity> ItemBrandList = FCCMDBrand.GetFacadeCreate().GetIL(null, null, sortExpression, String.Empty, DatabaseOperationType.LoadWithSortExpression); _CurrentItemBrandList = ItemBrandList; chbxItemBrand.DataSource = ItemBrandList; chbxItemBrand.DataTextField = "BrandName"; chbxItemBrand.DataValueField = "BrandID"; chbxItemBrand.DataBind(); }
private void SaveMDBrandEntity() { if (IsValid) { try { MDBrandEntity mDBrandEntity = BuildMDBrandEntity(); Int64 result = -1; if (mDBrandEntity.IsNew) { result = FCCMDBrand.GetFacadeCreate().Add(mDBrandEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDBrandEntity.FLD_NAME_BrandID, mDBrandEntity.BrandID.ToString(), SQLMatchType.Equal); result = FCCMDBrand.GetFacadeCreate().Update(mDBrandEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { _BrandID = 0; _MDBrandEntity = new MDBrandEntity(); PrepareInitialView(); BindMDBrandList(); if (mDBrandEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Brand Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Brand Information has been updated successfully.", false); } } else { if (mDBrandEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Brand Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Brand Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
protected void lvMDBrand_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 BrandID; Int64.TryParse(e.CommandArgument.ToString(), out BrandID); if (BrandID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _BrandID = BrandID; PrepareEditView(); cpeEditor.Collapsed = false; cpeEditor.ClientState = "false"; } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(MDBrandEntity.FLD_NAME_BrandID, BrandID.ToString(), SQLMatchType.Equal); MDBrandEntity mDBrandEntity = new MDBrandEntity(); result = FCCMDBrand.GetFacadeCreate().Delete(mDBrandEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _BrandID = 0; _MDBrandEntity = new MDBrandEntity(); PrepareInitialView(); BindMDBrandList(); MiscUtil.ShowMessage(lblMessage, "Brand has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Brand.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
public IList <MDBrandEntity> GetData() { IList <MDBrandEntity> mDBrandEntityList = new List <MDBrandEntity>(); try { mDBrandEntityList = FCCMDBrand.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load); if (mDBrandEntityList != null && mDBrandEntityList.Count > 0) { totalRowCount = mDBrandEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(mDBrandEntityList ?? new List <MDBrandEntity>()); }