public IList <CMBillRequisitionItemMapEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression) { IList <CMBillRequisitionItemMapEntity> cMBillRequisitionItemMapEntityList = new List <CMBillRequisitionItemMapEntity>(); try { if (pageSize == -1) { pageSize = 1000000000; } if (String.IsNullOrEmpty(sortExpression)) { sortExpression = CMBillRequisitionItemMapEntity.FLD_NAME_BillRequisitionItemMapID + " " + SQLConstants.SORT_ORDER_DESCENDING; } startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1; cMBillRequisitionItemMapEntityList = FCCCMBillRequisitionItemMap.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression); if (cMBillRequisitionItemMapEntityList != null && cMBillRequisitionItemMapEntityList.Count > 0) { totalRowCount = cMBillRequisitionItemMapEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(cMBillRequisitionItemMapEntityList ?? new List <CMBillRequisitionItemMapEntity>()); }
public IList <CMBillRequisitionItemMapEntity> GetData() { IList <CMBillRequisitionItemMapEntity> cMBillRequisitionItemMapEntityList = new List <CMBillRequisitionItemMapEntity>(); try { cMBillRequisitionItemMapEntityList = FCCCMBillRequisitionItemMap.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load); if (cMBillRequisitionItemMapEntityList != null && cMBillRequisitionItemMapEntityList.Count > 0) { totalRowCount = cMBillRequisitionItemMapEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(cMBillRequisitionItemMapEntityList ?? new List <CMBillRequisitionItemMapEntity>()); }
private void SaveCMBillEntity() { if (ValidationInput()) { if (IsValid) { try { CMBillEntity cMBillEntity = BuildCMBillEntity(); Int64 result = -1; if (cMBillEntity.IsNew) { result = FCCCMBill.GetFacadeCreate().Add(cMBillEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CMBillEntity.FLD_NAME_BillID, cMBillEntity.BillID.ToString(), SQLMatchType.Equal); result = FCCCMBill.GetFacadeCreate().Update(cMBillEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { #region Update WO Final Bill Status if (cMBillEntity.BillStatusID == MasterDataConstants.MDBillStatus.FINAL_BILL) { PRMWorkOrderEntity prmWorkOrderEntity = FCCPRMWorkOrder.GetFacadeCreate().GetByID(cMBillEntity.WorkOrderID); prmWorkOrderEntity.IsFinalBilled = true; String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMWorkOrderEntity.FLD_NAME_WorkOrderID, prmWorkOrderEntity.WorkOrderID.ToString(), SQLMatchType.Equal); FCCPRMWorkOrder.GetFacadeCreate().Update(prmWorkOrderEntity, fe, DatabaseOperationType.Update, TransactionRequired.No); } #endregion #region Bill Requisition Item Map CMBillRequisitionItemMapEntity cMBillRequisitionItemMapEntity = new CMBillRequisitionItemMapEntity(); try { IList <ListViewDataItem> list = lvREQRequisitionItem.Items; if (list != null && list.Count > 0) { foreach (ListViewDataItem lvdi in list) { Decimal billPriceLV; TextBox txtBillPriceLV = (TextBox)lvdi.FindControl("txtBillPriceLV"); Decimal.TryParse(txtBillPriceLV.Text.Trim(), out billPriceLV); if (billPriceLV > 0) { Label lblRequisitionIDLV = (Label)lvdi.FindControl("lblRequisitionIDLV"); Label lblRequisitionPriceLV = (Label)lvdi.FindControl("lblRequisitionPriceLV"); Label lblRequisitionItemIDLV = (Label)lvdi.FindControl("lblRequisitionItemIDLV"); cMBillRequisitionItemMapEntity.BillID = result; cMBillRequisitionItemMapEntity.RequisitionID = Int64.Parse(lblRequisitionIDLV.Text); cMBillRequisitionItemMapEntity.RequisitionItemID = Int64.Parse(lblRequisitionItemIDLV.Text); cMBillRequisitionItemMapEntity.RequisitionPrice = Decimal.Parse(lblRequisitionPriceLV.Text.Trim()); if (billPriceLV > 0) { cMBillRequisitionItemMapEntity.BillPrice = Decimal.Parse(txtBillPriceLV.Text.Trim()); } FCCCMBillRequisitionItemMap.GetFacadeCreate().Add(cMBillRequisitionItemMapEntity, DatabaseOperationType.Add, TransactionRequired.No); //else //{ // cMBillRequisitionItemMapEntity.BillPrice = null; //} } } } } catch (Exception ex) { } #endregion CMBillEntity _cMBillEntity = CurrentCMBillEntity; _BillID = 0; _CMBillEntity = new CMBillEntity(); PrepareInitialView(); BindCMBillList(); if (cMBillEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Bill Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Bill Information has been updated successfully.", false); } String NavUrl = UrlHelper.BuildSecureUrl("~/CM/CMBillUploadInfo.aspx", string.Empty, UrlConstants.OVERVIEW_CM_BILL_ID, result.ToString()).ToString(); Response.Redirect(NavUrl); } else { if (cMBillEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Bill Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Bill Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }