public IList <ACCPostPayableStatementDetailEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <ACCPostPayableStatementDetailEntity> aCCPostPayableStatementDetailEntityList = new List <ACCPostPayableStatementDetailEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = ACCPostPayableStatementDetailEntity.FLD_NAME_PostPayableStatementDetailID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                aCCPostPayableStatementDetailEntityList = FCCACCPostPayableStatementDetail.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(aCCPostPayableStatementDetailEntityList ?? new List <ACCPostPayableStatementDetailEntity>());
        }
        private void SaveACCPostPayableStatementDetailEntity()
        {
            if (IsValid)
            {
                try
                {
                    ACCPostPayableStatementDetailEntity aCCPostPayableStatementDetailEntity = BuildACCPostPayableStatementDetailEntity();//new ACCPostPayableStatementDetailEntity();//BuildACCPostPayableStatementDetailEntity();

                    Int64 result = -1;

                    if (aCCPostPayableStatementDetailEntity.IsNew)
                    {
                        result = FCCACCPostPayableStatementDetail.GetFacadeCreate().Add(aCCPostPayableStatementDetailEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(ACCPostPayableStatementDetailEntity.FLD_NAME_PostPayableStatementDetailID, aCCPostPayableStatementDetailEntity.PostPayableStatementDetailID.ToString(), SQLMatchType.Equal);
                        result = FCCACCPostPayableStatementDetail.GetFacadeCreate().Update(aCCPostPayableStatementDetailEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _PostPayableStatementDetailID        = 0;
                        _ACCPostPayableStatementDetailEntity = new ACCPostPayableStatementDetailEntity();
                        PrepareInitialView();
                        BindACCPostPayableStatementDetailList();

                        if (aCCPostPayableStatementDetailEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Payable Statement Detail Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Payable Statement Detail Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (aCCPostPayableStatementDetailEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Payable Statement Detail Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Payable Statement Detail Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Ejemplo n.º 3
0
        protected void lvACCPostPayableStatementDetail_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 PostPayableStatementDetailID;

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

            if (PostPayableStatementDetailID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _PostPayableStatementDetailID = PostPayableStatementDetailID;

                    PrepareEditView();
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(ACCPostPayableStatementDetailEntity.FLD_NAME_PostPayableStatementDetailID, PostPayableStatementDetailID.ToString(), SQLMatchType.Equal);

                        ACCPostPayableStatementDetailEntity aCCPostPayableStatementDetailEntity = new ACCPostPayableStatementDetailEntity();


                        result = FCCACCPostPayableStatementDetail.GetFacadeCreate().Delete(aCCPostPayableStatementDetailEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _PostPayableStatementDetailID        = 0;
                            _ACCPostPayableStatementDetailEntity = new ACCPostPayableStatementDetailEntity();
                            PrepareInitialView();
                            BindACCPostPayableStatementDetailList();

                            MiscUtil.ShowMessage(lblMessage, "A CCPost Payable Statement Detail has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete A CCPost Payable Statement Detail.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        public IList <ACCPostPayableStatementDetailEntity> GetData()
        {
            IList <ACCPostPayableStatementDetailEntity> aCCPostPayableStatementDetailEntityList = new List <ACCPostPayableStatementDetailEntity>();

            try
            {
                aCCPostPayableStatementDetailEntityList = FCCACCPostPayableStatementDetail.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(aCCPostPayableStatementDetailEntityList ?? new List <ACCPostPayableStatementDetailEntity>());
        }
        private void UpdatePayableStatementDetail()
        {
            try
            {
                IList <ListViewDataItem> list = lvACCPrePayableStatementDetail.Items;

                if (list != null && list.Count > 0)
                {
                    Int32 tempDataItemIndex = 0;

                    foreach (ListViewDataItem lvdi in list)
                    {
                        DataKey currentDataKey = lvACCPrePayableStatementDetail.DataKeys[tempDataItemIndex++];
                        Int64   _postPayableStatementDetailID = (Int64)currentDataKey["PostPayableStatementDetailID"];

                        // Decimal workOrderAgreementAmount = 0, paidAmount = 0, tDSAmount = 0, securityMoney = 0;

                        ACCPostPayableStatementDetailEntity aCCPrePayableStatementDetailEntity = FCCACCPostPayableStatementDetail.GetFacadeCreate().GetByID(_postPayableStatementDetailID);

                        DropDownList ddlACCPayableApprovalStatusIDLV             = (DropDownList)lvdi.FindControl("ddlACCPayableApprovalStatusIDLV");
                        DropDownList ddlACCPayablePaymentStatusIDLV              = (DropDownList)lvdi.FindControl("ddlACCPayablePaymentStatusIDLV");
                        DropDownList ddlAccountPaybleStatementDetailCategoryIDLV = (DropDownList)lvdi.FindControl("ddlAccountPaybleStatementDetailCategoryIDLV");
                        DropDownList ddlPayableClassificationIDLV = (DropDownList)lvdi.FindControl("ddlPayableClassificationIDLV");
                        CheckBox     chkPartyReconcileLV          = (CheckBox)lvdi.FindControl("chkPartyReconcileLV");
                        //L lblWorkOrderNoLV = (TextBox)lvdi.FindControl("lblWorkOrderNoLV");
                        //TextBox txtWorkOrderAmountLV = (TextBox)lvdi.FindControl("txtWorkOrderAmountLV");
                        //TextBox txtWorkOrderDateLV = (TextBox)lvdi.FindControl("txtWorkOrderDateLV");
                        //TextBox txtPaidAmountLV = (TextBox)lvdi.FindControl("txtPaidAmountLV");
                        //TextBox txtSecurityMoneyLV = (TextBox)lvdi.FindControl("txtSecurityMoneyLV");
                        TextBox txtPayableAgainstWorkOrderLV = (TextBox)lvdi.FindControl("txtPayableAgainstWorkOrderLV");
                        //TextBox txtTDSAmountLV = (TextBox)lvdi.FindControl("txtTDSAmountLV");
                        //TextBox txtApprovedBillAmountLV = (TextBox)lvdi.FindControl("txtApprovedBillAmountLV");
                        TextBox txtNetPayableConsideringBillAndSecurityLV = (TextBox)lvdi.FindControl("txtNetPayableConsideringBillAndSecurityLV");
                        //TextBox txtRequisitionNoLV = (TextBox)lvdi.FindControl("txtRequisitionNoLV");
                        //TextBox txtRequisitionDateLV = (TextBox)lvdi.FindControl("txtRequisitionDateLV");
                        // TextBox txtBillNoLV = (TextBox)lvdi.FindControl("txtBillNoLV");
                        //TextBox txtBillDateLV = (TextBox)lvdi.FindControl("txtBillDateLV");
                        //TextBox txtRefLV = (TextBox)lvdi.FindControl("txtRefLV");
                        //TextBox txtCreateDateLV = (TextBox)lvdi.FindControl("txtCreateDateLV");
                        TextBox txtDueDateLV     = (TextBox)lvdi.FindControl("txtDueDateLV");
                        TextBox txtPlannedDateLV = (TextBox)lvdi.FindControl("txtPlannedDateLV");
                        TextBox txtRemarksLV     = (TextBox)lvdi.FindControl("txtRemarksLV");
                        //TextBox txtAdditionalRemarksLV = (TextBox)lvdi.FindControl("txtAdditionalRemarksLV");

                        //if (!lblWorkOrderNoLV.Text.Trim().IsNullOrEmpty())
                        //{
                        //    aCCPrePayableStatementDetailEntity.WorkOrderNo = lblWorkOrderNoLV.Text.Trim();
                        //}
                        //else
                        //{
                        //    aCCPrePayableStatementDetailEntity.WorkOrderNo = null;
                        //}

                        //Decimal payableAgainstWO = (workOrderAgreementAmount - paidAmount - tDSAmount);
                        //Decimal netPayableConsideringBillSecurity = (payableAgainstWO - paidAmount - securityMoney - tDSAmount);

                        //if (!txtWorkOrderAmountLV.Text.Trim().IsNullOrEmpty())
                        //{
                        //    aCCPrePayableStatementDetailEntity.WorkOrderAmount = Decimal.Parse(txtWorkOrderAmountLV.Text.Trim());
                        //}
                        //else
                        //{
                        //    aCCPrePayableStatementDetailEntity.WorkOrderAmount = null;
                        //}

                        //if (txtWorkOrderDateLV.Text.Trim().IsNotNullOrEmpty())
                        //{
                        //    aCCPrePayableStatementDetailEntity.WorkOrderDate = MiscUtil.ParseToDateTime(txtWorkOrderDateLV.Text);
                        //}
                        //else
                        //{
                        //    aCCPrePayableStatementDetailEntity.WorkOrderDate = null;
                        //}

                        //if (!txtPaidAmountLV.Text.Trim().IsNullOrEmpty())
                        //{
                        //    aCCPrePayableStatementDetailEntity.PaidAmount = Decimal.Parse(txtPaidAmountLV.Text.Trim());
                        //}
                        //else
                        //{
                        //    aCCPrePayableStatementDetailEntity.PaidAmount = null;
                        //}

                        //if (!txtSecurityMoneyLV.Text.Trim().IsNullOrEmpty())
                        //{
                        //    aCCPrePayableStatementDetailEntity.SecurityMoney = Decimal.Parse(txtSecurityMoneyLV.Text.Trim());
                        //}
                        //else
                        //{
                        //    aCCPrePayableStatementDetailEntity.SecurityMoney = null;
                        //}

                        //if (!txtTDSAmountLV.Text.Trim().IsNullOrEmpty())
                        //{
                        //    aCCPrePayableStatementDetailEntity.TDSAmount = Decimal.Parse(txtTDSAmountLV.Text.Trim());
                        //}
                        //else
                        //{
                        //    aCCPrePayableStatementDetailEntity.TDSAmount = null;
                        //}

                        if (!txtPayableAgainstWorkOrderLV.Text.Trim().IsNullOrEmpty())
                        {
                            aCCPrePayableStatementDetailEntity.PayableAgainstWorkOrder = Decimal.Parse(txtPayableAgainstWorkOrderLV.Text.Trim());
                        }
                        else
                        {
                            aCCPrePayableStatementDetailEntity.PayableAgainstWorkOrder = null;
                        }

                        //if (!txtApprovedBillAmountLV.Text.Trim().IsNullOrEmpty())
                        //{
                        //    aCCPrePayableStatementDetailEntity.ApprovedBillAmount = Decimal.Parse(txtApprovedBillAmountLV.Text.Trim());
                        //}
                        //else
                        //{
                        //    aCCPrePayableStatementDetailEntity.ApprovedBillAmount = null;
                        //}

                        if (!txtNetPayableConsideringBillAndSecurityLV.Text.Trim().IsNullOrEmpty())
                        {
                            aCCPrePayableStatementDetailEntity.NetPayableConsideringBillAndSecurity = Decimal.Parse(txtNetPayableConsideringBillAndSecurityLV.Text.Trim());
                        }
                        else
                        {
                            aCCPrePayableStatementDetailEntity.NetPayableConsideringBillAndSecurity = null;
                        }

                        aCCPrePayableStatementDetailEntity.PartyReconcile = chkPartyReconcileLV.Checked;

                        //aCCPrePayableStatementDetailEntity.RequisitionNo = txtRequisitionNoLV.Text.Trim();
                        //if (txtRequisitionDateLV.Text.Trim().IsNotNullOrEmpty())
                        //{
                        //    aCCPrePayableStatementDetailEntity.RequisitionDate = MiscUtil.ParseToDateTime(txtRequisitionDateLV.Text);
                        //}
                        //else
                        //{
                        //    aCCPrePayableStatementDetailEntity.RequisitionDate = null;
                        //}

                        //aCCPrePayableStatementDetailEntity.BillNo = txtBillNoLV.Text.Trim();
                        //if (txtBillDateLV.Text.Trim().IsNotNullOrEmpty())
                        //{
                        //    aCCPrePayableStatementDetailEntity.BillDate = MiscUtil.ParseToDateTime(txtBillDateLV.Text);
                        //}
                        //else
                        //{
                        //    aCCPrePayableStatementDetailEntity.BillDate = null;
                        //}

                        aCCPrePayableStatementDetailEntity.Remarks = txtRemarksLV.Text.Trim();
                        // aCCPrePayableStatementDetailEntity.Ref = txtRemarksLV.Text.Trim();

                        //if (txtCreateDateLV.Text.Trim().IsNotNullOrEmpty())
                        //{
                        //    aCCPrePayableStatementDetailEntity.CreateDate = MiscUtil.ParseToDateTime(txtCreateDateLV.Text);
                        //}

                        aCCPrePayableStatementDetailEntity.CreateDate = System.DateTime.Now;

                        if (txtDueDateLV.Text.Trim().IsNotNullOrEmpty())
                        {
                            aCCPrePayableStatementDetailEntity.DueDate = MiscUtil.ParseToDateTime(txtDueDateLV.Text);
                        }

                        if (txtPlannedDateLV.Text.Trim().IsNotNullOrEmpty())
                        {
                            aCCPrePayableStatementDetailEntity.PlannedDate = MiscUtil.ParseToDateTime(txtPlannedDateLV.Text);
                        }
                        else
                        {
                            aCCPrePayableStatementDetailEntity.PlannedDate = null;
                        }

                        // aCCPrePayableStatementDetailEntity.AdditionalRemarks = txtAdditionalRemarksLV.Text.Trim();

                        if (ddlACCPayablePaymentStatusIDLV.Items.Count > 0)
                        {
                            if (ddlACCPayablePaymentStatusIDLV.SelectedValue == "0")
                            {
                            }
                            else
                            {
                                aCCPrePayableStatementDetailEntity.ACCPayablePaymentStatusID = Int64.Parse(ddlACCPayablePaymentStatusIDLV.SelectedValue);
                            }
                        }

                        if (ddlACCPayableApprovalStatusIDLV.Items.Count > 0)
                        {
                            if (ddlACCPayableApprovalStatusIDLV.SelectedValue == "0")
                            {
                            }
                            else
                            {
                                aCCPrePayableStatementDetailEntity.ACCPayableApprovalStatusID = Int64.Parse(ddlACCPayableApprovalStatusIDLV.SelectedValue);
                            }
                        }

                        if (ddlAccountPaybleStatementDetailCategoryIDLV.Items.Count > 0)
                        {
                            if (ddlAccountPaybleStatementDetailCategoryIDLV.SelectedValue == "0")
                            {
                            }
                            else
                            {
                                aCCPrePayableStatementDetailEntity.AccountPaybleStatementDetailCategoryID = Int64.Parse(ddlAccountPaybleStatementDetailCategoryIDLV.SelectedValue);
                            }
                        }

                        if (ddlPayableClassificationIDLV.Items.Count > 0)
                        {
                            if (ddlPayableClassificationIDLV.SelectedValue == "0")
                            {
                            }
                            else
                            {
                                aCCPrePayableStatementDetailEntity.PayableClassificationID = Int64.Parse(ddlPayableClassificationIDLV.SelectedValue);
                            }
                        }

                        aCCPrePayableStatementDetailEntity.CreateByEmployeeID = MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember);

                        aCCPrePayableStatementDetailEntity.IPAddress = MiscUtil.GetLocalIP();
                        aCCPrePayableStatementDetailEntity.IsRemoved = false;
                        aCCPrePayableStatementDetailEntity.IsLocked  = false;

                        String fe_member = SqlExpressionBuilder.PrepareFilterExpression(ACCPostPayableStatementDetailEntity.FLD_NAME_PostPayableStatementDetailID, _postPayableStatementDetailID.ToString(), SQLMatchType.Equal);
                        FCCACCPostPayableStatementDetail.GetFacadeCreate().Update(aCCPrePayableStatementDetailEntity, fe_member, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    PrepareInitialView();
                    MiscUtil.ShowMessage(lblMessage, "Accounts Payable Information has been saved successfully.", false);
                }
            }
            catch (Exception ex)
            {
                MiscUtil.ShowMessage(lblMessage, "Failed to Save Accounts Payable Information.", true);
            }
        }