Esempio n. 1
0
        public IList <CMContractorEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <CMContractorEntity> cMContractorEntityList = new List <CMContractorEntity>();

            try
            {
                if (pageSize == -1)
                {
                    pageSize = 1000000000;
                }

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = CMContractorEntity.FLD_NAME_ContractorID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

                startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1;

                cMContractorEntityList = FCCCMContractor.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

                if (cMContractorEntityList != null && cMContractorEntityList.Count > 0)
                {
                    totalRowCount = cMContractorEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(cMContractorEntityList ?? new List <CMContractorEntity>());
        }
        private void SaveCMContractorEntity()
        {
            if (IsValid)
            {
                try
                {
                    CMContractorEntity cMContractorEntity = BuildCMContractorEntity();

                    Int64 result = -1;

                    if (cMContractorEntity.IsNew)
                    {
                        result = FCCCMContractor.GetFacadeCreate().Add(cMContractorEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CMContractorEntity.FLD_NAME_ContractorID, cMContractorEntity.ContractorID.ToString(), SQLMatchType.Equal);
                        result = FCCCMContractor.GetFacadeCreate().Update(cMContractorEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _ContractorID       = 0;
                        _CMContractorEntity = new CMContractorEntity();
                        PrepareInitialView();

                        if (cMContractorEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Contractor Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Contractor Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (cMContractorEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add C MContractor Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update C MContractor Information.", false);
                        }
                    }
                    PrepareEditView();
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Esempio n. 3
0
        public IList <CMContractorEntity> GetData()
        {
            IList <CMContractorEntity> cMContractorEntityList = new List <CMContractorEntity>();

            try
            {
                cMContractorEntityList = FCCCMContractor.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

                if (cMContractorEntityList != null && cMContractorEntityList.Count > 0)
                {
                    totalRowCount = cMContractorEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(cMContractorEntityList ?? new List <CMContractorEntity>());
        }
Esempio n. 4
0
        protected void lvCMContractor_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 ContractorID;

            Int64.TryParse(e.CommandArgument.ToString(), out ContractorID);

            if (ContractorID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _ContractorID = ContractorID;
                    _MemberID     = CurrentCMContractorEntity.MemberID;

                    PrepareEditView();

                    cpeEditor.Collapsed   = false;
                    cpeEditor.ClientState = "false";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        CMContractorEntity tempContractor = FCCCMContractor.GetFacadeCreate().GetByID(ContractorID);

                        #region Resource Delete

                        Int64 resultOne = -1;

                        String fe1_re = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ReferenceID, ContractorID.ToString(), SQLMatchType.Equal);
                        String fe2_re = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ResourceCategoryID, MasterDataConstants.ResourceCategory.CONTRACTOR.ToString(), SQLMatchType.Equal);
                        String fe_re  = SqlExpressionBuilder.PrepareFilterExpression(fe1_re, SQLJoinType.AND, fe2_re);

                        IList <ResourceEntity> resourceList = FCCResource.GetFacadeCreate().GetIL(null, null, String.Empty, fe_re, DatabaseOperationType.LoadWithFilterExpression);

                        foreach (ResourceEntity ent in resourceList)
                        {
                            String fe_re_delete = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ResourceID, ent.ResourceID.ToString(), SQLMatchType.Equal);

                            resultOne = FCCResource.GetFacadeCreate().Delete(ent, fe_re_delete, DatabaseOperationType.Delete, TransactionRequired.No);
                        }

                        #endregion

                        #region Contractor Delete

                        Int64 resultTwo = -1;

                        if (resultOne == 0)
                        {
                            String fe_con_delete = SqlExpressionBuilder.PrepareFilterExpression(CMContractorEntity.FLD_NAME_ContractorID, ContractorID.ToString(), SQLMatchType.Equal);

                            CMContractorEntity cMContractorEntity = new CMContractorEntity();

                            resultTwo = FCCCMContractor.GetFacadeCreate().Delete(cMContractorEntity, fe_con_delete, DatabaseOperationType.Delete, TransactionRequired.No);
                        }

                        #endregion

                        #region Member Delete

                        Int64 resultThree = -1;

                        if (resultTwo == 0)
                        {
                            String fe_mem_delete = SqlExpressionBuilder.PrepareFilterExpression(HRMemberEntity.FLD_NAME_MemberID, tempContractor.MemberID.ToString(), SQLMatchType.Equal);

                            HRMemberEntity hRMemberEntity = new HRMemberEntity();

                            resultThree = FCCHRMember.GetFacadeCreate().Delete(hRMemberEntity, fe_mem_delete, DatabaseOperationType.Delete, TransactionRequired.No);
                        }

                        #endregion

                        if (resultOne == 0 && resultTwo == 0 && resultThree == 0)
                        {
                            _ContractorID       = 0;
                            _CMContractorEntity = new CMContractorEntity();
                            _MemberID           = 0;
                            _HRMemberEntity     = new HRMemberEntity();

                            PrepareInitialView();
                            BindCMContractorList();

                            MiscUtil.ShowMessage(lblMessage, "Contractor has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Contractor.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Esempio n. 5
0
        private void SaveCMContractorEntity()
        {
            if (IsValid)
            {
                try
                {
                    #region Member

                    HRMemberEntity hRMemberEntity = BuildHRMemberEntity();

                    Int64 result = -1;

                    if (hRMemberEntity.IsNew)
                    {
                        result = FCCHRMember.GetFacadeCreate().Add(hRMemberEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HRMemberEntity.FLD_NAME_MemberID, hRMemberEntity.MemberID.ToString(), SQLMatchType.Equal);
                        result = FCCHRMember.GetFacadeCreate().Update(hRMemberEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    #endregion

                    if (result > 0)
                    {
                        _MemberID       = 0;
                        _HRMemberEntity = new HRMemberEntity();
                    }


                    if (result > 0)
                    {
                        CMContractorEntity cMContractorEntity = BuildCMContractorEntity();

                        Int64 resultC = -1;

                        if (cMContractorEntity.IsNew)
                        {
                            cMContractorEntity.MemberID = result;

                            resultC = FCCCMContractor.GetFacadeCreate().Add(cMContractorEntity, DatabaseOperationType.Add, TransactionRequired.No);
                        }
                        else
                        {
                            String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CMContractorEntity.FLD_NAME_ContractorID, cMContractorEntity.ContractorID.ToString(), SQLMatchType.Equal);
                            resultC = FCCCMContractor.GetFacadeCreate().Update(cMContractorEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                        }



                        if (resultC > 0)
                        {
                            _ContractorID       = 0;
                            _CMContractorEntity = new CMContractorEntity();
                            PrepareInitialView();
                            BindCMContractorList();

                            if (cMContractorEntity.IsNew)
                            {
                                ResourceEntity resourceEntity = new ResourceEntity();

                                resourceEntity.ReferenceID        = resultC; // means new contractor id
                                resourceEntity.ResourceCategoryID = MasterDataConstants.ResourceCategory.CONTRACTOR;

                                FCCResource.GetFacadeCreate().Add(resourceEntity, DatabaseOperationType.Add, TransactionRequired.No);
                            }

                            if (cMContractorEntity.IsNew)
                            {
                                MiscUtil.ShowMessage(lblMessage, "Contractor Information has been added successfully.", false);
                            }
                            else
                            {
                                MiscUtil.ShowMessage(lblMessage, "Contractor Information has been updated successfully.", false);
                            }
                        }
                        else
                        {
                            if (cMContractorEntity.IsNew)
                            {
                                MiscUtil.ShowMessage(lblMessage, "Failed to add Contractor Information.", false);
                            }
                            else
                            {
                                MiscUtil.ShowMessage(lblMessage, "Failed to update Contractor Information.", false);
                            }
                        }
                    }
                    else
                    {
                        if (hRMemberEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Member Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Member Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvACCPrePayableStatementDetail_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.ItemType == ListViewItemType.DataItem)
            {
                ListViewDataItem dataItem = (ListViewDataItem)e.Item;

                ACCPostPayableStatementDetailEntity ent = (ACCPostPayableStatementDetailEntity)dataItem.DataItem;

                Label        lblProjectNameLV                            = (Label)e.Item.FindControl("lblProjectNameLV");
                Label        lblVendorCategoryNameLV                     = (Label)e.Item.FindControl("lblVendorCategoryNameLV");
                Label        lblVendorCategoryIDLV                       = (Label)e.Item.FindControl("lblVendorCategoryIDLV");
                Label        lblVendorIDLV                               = (Label)e.Item.FindControl("lblVendorIDLV");
                Label        lblVendorNameLV                             = (Label)e.Item.FindControl("lblVendorNameLV");
                Label        lblProjectIDLV                              = (Label)e.Item.FindControl("lblProjectIDLV");
                DropDownList ddlACCPayableApprovalStatusIDLV             = (DropDownList)e.Item.FindControl("ddlACCPayableApprovalStatusIDLV");
                DropDownList ddlACCPayablePaymentStatusIDLV              = (DropDownList)e.Item.FindControl("ddlACCPayablePaymentStatusIDLV");
                DropDownList ddlPayableClassificationIDLV                = (DropDownList)e.Item.FindControl("ddlPayableClassificationIDLV");
                DropDownList ddlAccountPaybleStatementDetailCategoryIDLV = (DropDownList)e.Item.FindControl("ddlAccountPaybleStatementDetailCategoryIDLV");
                CheckBox     chkPartyReconcileLV                         = (CheckBox)e.Item.FindControl("chkPartyReconcileLV");

                if (lblProjectIDLV != null)
                {
                    BDProjectEntity _bDProjectEntity = FCCBDProject.GetFacadeCreate().GetByID(Int64.Parse(lblProjectIDLV.Text));

                    if (_bDProjectEntity != null)
                    {
                        lblProjectNameLV.Text = _bDProjectEntity.ProjectName + " (" + _bDProjectEntity.ProjectCode + ")";
                    }
                }

                MiscUtil.PopulateMDACCPayablePaymentStatus(ddlACCPayablePaymentStatusIDLV, false);
                MiscUtil.PopulateMDACCPayableApprovalStatus(ddlACCPayableApprovalStatusIDLV, false);
                MiscUtil.PopulateMDPayableClassification(ddlPayableClassificationIDLV, false);
                MiscUtil.PopulateMDAccountPaybleStatementDetailCategory(ddlAccountPaybleStatementDetailCategoryIDLV, false);
                _PostPayableStatementDetailID = ent.PostPayableStatementDetailID;

                if (ent.PartyReconcile == true)
                {
                    chkPartyReconcileLV.Checked = true;
                }
                else
                {
                    chkPartyReconcileLV.Checked = false;
                }

                Int64 vendorID;
                Int64.TryParse(lblVendorIDLV.Text.ToString(), out vendorID);

                switch (lblVendorCategoryIDLV.Text)
                {
                case MasterDataConstants.CM_Bill_VendorCategory.CONSULTANT:
                    CMConsultantEntity _cmConsultantEntity = FCCCMConsultant.GetFacadeCreate().GetByID(vendorID);
                    lblVendorCategoryNameLV.Text = "CONSULTANT";
                    lblVendorNameLV.Text         = _cmConsultantEntity.Name;
                    break;

                case MasterDataConstants.CM_Bill_VendorCategory.CONTRACTOR:
                    CMContractorEntity _cMContractorEntity = FCCCMContractor.GetFacadeCreate().GetByID(vendorID);
                    lblVendorCategoryNameLV.Text = "CONTRACTOR";
                    lblVendorNameLV.Text         = _cMContractorEntity.Name;
                    break;

                case MasterDataConstants.CM_Bill_VendorCategory.VENDOR:
                    PRMSupplierEntity _pRMSupplierEntity = FCCPRMSupplier.GetFacadeCreate().GetByID(vendorID);
                    lblVendorCategoryNameLV.Text = "VENDOR";
                    lblVendorNameLV.Text         = _pRMSupplierEntity.SupplierName;
                    break;
                }

                if (ddlACCPayableApprovalStatusIDLV != null && ddlACCPayableApprovalStatusIDLV.Items.Count > 0)
                {
                    ddlACCPayableApprovalStatusIDLV.SelectedValue = ent.ACCPayableApprovalStatusID.ToString();
                }

                if (ddlACCPayablePaymentStatusIDLV != null && ddlACCPayablePaymentStatusIDLV.Items.Count > 0)
                {
                    ddlACCPayablePaymentStatusIDLV.SelectedValue = ent.ACCPayablePaymentStatusID.ToString();
                }

                if (ddlPayableClassificationIDLV != null && ddlPayableClassificationIDLV.Items.Count > 0)
                {
                    ddlPayableClassificationIDLV.SelectedValue = ent.PayableClassificationID.ToString();
                }

                if (ddlAccountPaybleStatementDetailCategoryIDLV != null && ddlAccountPaybleStatementDetailCategoryIDLV.Items.Count > 0)
                {
                    ddlAccountPaybleStatementDetailCategoryIDLV.SelectedValue = ent.AccountPaybleStatementDetailCategoryID.ToString();
                }

                ddlACCPayableApprovalStatusIDLV.Enabled = false;
            }
        }