コード例 #1
0
        public IList <PRMWorkOrderEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <PRMWorkOrderEntity> pRMWorkOrderEntityList = new List <PRMWorkOrderEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = PRMWorkOrderEntity.FLD_NAME_WorkOrderID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                pRMWorkOrderEntityList = FCCPRMWorkOrder.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(pRMWorkOrderEntityList ?? new List <PRMWorkOrderEntity>());
        }
コード例 #2
0
        private void BuildGrandTotalLabel()
        {
            if (PRMWorkOrderID > 0)
            {
                String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMWorkOrderItemMapEntity.FLD_NAME_WorkOrderID, PRMWorkOrderID.ToString(), SQLMatchType.Equal);
                IList <PRMWorkOrderItemMapEntity> lst = FCCPRMWorkOrderItemMap.GetFacadeCreate().GetIL(100000, 1, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

                if (lst != null && lst.Count > 0)
                {
                    var transinfo = (from transaction in lst
                                     select transaction.RequiredQty * transaction.Rate).Sum(val => val);

                    PRMWorkOrderEntity pRMWorkOrderEntity = FCCPRMWorkOrder.GetFacadeCreate().GetByID(PRMWorkOrderID);
                    Decimal            totalPrice = transinfo;
                    Decimal            AIT, Discount, Vat, Tax, CarryingCharge;

                    Decimal.TryParse(pRMWorkOrderEntity.AIT.ToString(), out AIT);
                    Decimal.TryParse(pRMWorkOrderEntity.Discount.ToString(), out Discount);
                    Decimal.TryParse(pRMWorkOrderEntity.CarryingCharge.ToString(), out CarryingCharge);
                    Decimal.TryParse(pRMWorkOrderEntity.VAT.ToString(), out Vat);
                    Decimal.TryParse(pRMWorkOrderEntity.Tax.ToString(), out Tax);

                    totalPrice += AIT;
                    totalPrice += Discount;
                    totalPrice -= Vat;
                    totalPrice -= Tax;
                    totalPrice -= CarryingCharge;
                    //lblGrandTotal.Text = Math.Round(transinfo,2).ToString();
                    lblGrandTotal.Text = MiscUtil.NumericCommaSeperatedFormat((Decimal)totalPrice);
                }
            }
        }
コード例 #3
0
        protected void btnPnlCancelWO_Click(object sender, EventArgs e)
        {
            PRMWorkOrderEntity pRMWorkOrderEntity = FCCPRMWorkOrder.GetFacadeCreate().GetByID(PRMWorkOrderID);

            pRMWorkOrderEntity.WorkOrderStatusID = MasterDataConstants.WorkOrderStatus.CANCELED;
            pRMWorkOrderEntity.Remarks           = txtWOCancelRemarks.Text.Trim().ToString();

            Int64  result = -1;
            String fe     = SqlExpressionBuilder.PrepareFilterExpression(PRMWorkOrderEntity.FLD_NAME_WorkOrderID, PRMWorkOrderID.ToString(), SQLMatchType.Equal);

            result = FCCPRMWorkOrder.GetFacadeCreate().Update(pRMWorkOrderEntity, fe, DatabaseOperationType.Update, TransactionRequired.No);

            if (result > 0)
            {
                #region AP Update

                APApprovalProcessEntity aPApprovalProcessEntity = FCCAPApprovalProcess.GetFacadeCreate().GetByID(APApprovalProcessID);

                if (aPApprovalProcessEntity != null && aPApprovalProcessEntity.APApprovalProcessID > 0)
                {
                    aPApprovalProcessEntity.APStatusID = MasterDataConstants.APStatus.CANCELED;

                    Int64 resultOne = -1;

                    String fe_one = SqlExpressionBuilder.PrepareFilterExpression(APApprovalProcessEntity.FLD_NAME_APApprovalProcessID, APApprovalProcessID.ToString(), SQLMatchType.Equal);
                    resultOne = FCCAPApprovalProcess.GetFacadeCreate().Update(aPApprovalProcessEntity, fe_one, DatabaseOperationType.Update, TransactionRequired.No);

                    if (resultOne > 0)
                    {
                        APMemberFeedbackEntity aPMemberFeedbackEntity = FCCAPMemberFeedback.GetFacadeCreate().GetByID(APMemberFeedbackID);

                        if (aPMemberFeedbackEntity != null && aPMemberFeedbackEntity.APMemberFeedbackID > 0)
                        {
                            aPMemberFeedbackEntity.APFeedbackID = MasterDataConstants.APFeedback.CANCELED;

                            Int64  resultC           = -1;
                            String fe_memberfeedback = SqlExpressionBuilder.PrepareFilterExpression(APMemberFeedbackEntity.FLD_NAME_APMemberFeedbackID, APMemberFeedbackID.ToString(), SQLMatchType.Equal);

                            resultC = FCCAPMemberFeedback.GetFacadeCreate().Update(aPMemberFeedbackEntity, fe_memberfeedback, DatabaseOperationType.Update, TransactionRequired.No);

                            RedirectPageToPendingList();
                        }
                    }
                }

                #endregion
            }
        }
コード例 #4
0
        protected void lvPRMWorkOrder_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 WorkOrderID;

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

            if (WorkOrderID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    String url = UrlHelper.BuildSecureUrl("~/PRM/PRMWorkOrder.aspx", string.Empty, UrlConstants.OVERVIEW_WORKORDER_ID, WorkOrderID.ToString()).ToString();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMWorkOrderEntity.FLD_NAME_WorkOrderID, WorkOrderID.ToString(), SQLMatchType.Equal);

                        PRMWorkOrderEntity pRMWorkOrderEntity = new PRMWorkOrderEntity();


                        result = FCCPRMWorkOrder.GetFacadeCreate().Delete(pRMWorkOrderEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _WorkOrderID        = 0;
                            _PRMWorkOrderEntity = new PRMWorkOrderEntity();
                            PrepareInitialView();
                            BindPRMWorkOrderList();

                            MiscUtil.ShowMessage(lblMessage, "Work Order has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Work Order.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
コード例 #5
0
        public IList <PRMWorkOrderEntity> GetData()
        {
            IList <PRMWorkOrderEntity> pRMWorkOrderEntityList = new List <PRMWorkOrderEntity>();

            try
            {
                pRMWorkOrderEntityList = FCCPRMWorkOrder.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(pRMWorkOrderEntityList ?? new List <PRMWorkOrderEntity>());
        }
コード例 #6
0
        protected void lvPRMWorkOrder_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 WorkOrderID;

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

            if (WorkOrderID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    String url = UrlHelper.BuildSecureUrl("~/PRM/PRMWorkOrder.aspx", string.Empty, UrlConstants.OVERVIEW_WORKORDER_ID, WorkOrderID.ToString()).ToString();
                    Response.Redirect(url);
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMWorkOrderEntity.FLD_NAME_WorkOrderID, WorkOrderID.ToString(), SQLMatchType.Equal);

                        PRMWorkOrderEntity pRMWorkOrderEntity = new PRMWorkOrderEntity();


                        result = FCCPRMWorkOrder.GetFacadeCreate().Delete(pRMWorkOrderEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _WorkOrderID        = 0;
                            _PRMWorkOrderEntity = new PRMWorkOrderEntity();
                            PrepareInitialView();
                            BindPRMWorkOrderList();

                            MiscUtil.ShowMessage(lblMessage, "Work Order has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Work Order.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }

                else if (string.Equals(e.CommandName, "CancelItem"))
                {
                    try
                    {
                        _WorkOrderID = WorkOrderID;
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMWorkOrderEntity.FLD_NAME_WorkOrderID, WorkOrderID.ToString(), SQLMatchType.Equal);

                        PRMWorkOrderEntity pRMWorkOrderEntity = CurrentPRMWorkOrderEntity;

                        pRMWorkOrderEntity.WorkOrderStatusID = MasterDataConstants.WorkOrderStatus.CANCELED;

                        result = FCCPRMWorkOrder.GetFacadeCreate().Update(pRMWorkOrderEntity, fe, DatabaseOperationType.Update, TransactionRequired.No);

                        if (result > 0)
                        {
                            _WorkOrderID        = 0;
                            _PRMWorkOrderEntity = new PRMWorkOrderEntity();
                            PrepareInitialView();
                            BindPRMWorkOrderList();

                            MiscUtil.ShowMessage(lblMessage, "WorkOrder has been successfully Rejected.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to WorkOrder Rejected", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
                else if (string.Equals(e.CommandName, "UpdateItem"))
                {
                    try
                    {
                        #region Approval Process

                        Boolean apResult = APRobot.ResetApprovalProcessForWorkOrder(WorkOrderID);

                        if (apResult == true)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Approval Process has been reset successfully.", UIConstants.MessageType.GREEN);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to reset approval process.", UIConstants.MessageType.RED);
                        }

                        // EnableDisableApprovalProcessCheck();

                        BindList();

                        #endregion

                        //Int64 result = -1;

                        //String fe = SqlExpressionBuilder.PrepareFilterExpression(PRMWorkOrderEntity.FLD_NAME_WorkOrderID, WorkOrderID.ToString(), SQLMatchType.Equal);

                        //PRMWorkOrderEntity pRMWorkOrderEntity = new PRMWorkOrderEntity();


                        //result = FCCPRMWorkOrder.GetFacadeCreate().Delete(pRMWorkOrderEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        //if (result == 0)
                        //{
                        //    _WorkOrderID = 0;
                        //    _PRMWorkOrderEntity = new PRMWorkOrderEntity();
                        //    PrepareInitialView();
                        //    BindPRMWorkOrderList();

                        //    MiscUtil.ShowMessage(lblMessage, "Work Order has been successfully deleted.", true);
                        //}
                        //else
                        //{
                        //    MiscUtil.ShowMessage(lblMessage, "Failed to delete Work Order.", true);
                        //}
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
コード例 #7
0
        private void SavePRMWorkOrderEntity()
        {
            if (IsValid)
            {
                try
                {
                    PRMWorkOrderEntity pRMWorkOrderEntity = BuildPRMWorkOrderEntity();

                    Int64 result = -1;

                    if (pRMWorkOrderEntity.IsNew)
                    {
                        result = FCCPRMWorkOrder.GetFacadeCreate().Add(pRMWorkOrderEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(PRMWorkOrderEntity.FLD_NAME_WorkOrderID, pRMWorkOrderEntity.WorkOrderID.ToString(), SQLMatchType.Equal);
                        result = FCCPRMWorkOrder.GetFacadeCreate().Update(pRMWorkOrderEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _WorkOrderID        = result;
                        _PRMWorkOrderEntity = new PRMWorkOrderEntity();
                        PrepareInitialView();
                        PrepareEditView();

                        if (pRMWorkOrderEntity.IsNew)
                        {
                            if (result > 0)
                            {
                                _WorkOrderID = result;
                                BuildLabel(result);

                                String NavUrl = UrlHelper.BuildSecureUrl("~/PRM/PRMWorkOrderItemMap.aspx", string.Empty, UrlConstants.OVERVIEW_WORKORDER_ID, result.ToString(), PRMWorkOrderEntity.FLD_NAME_WorkOrderNo, CurrentPRMWorkOrderEntity.WorkOrderNo.ToString()).ToString();
                                Response.Redirect(NavUrl);
                            }

                            MiscUtil.ShowMessage(lblMessage, "Work Order Information has been added successfully.", false);
                        }
                        else
                        {
                            String NavUrl = UrlHelper.BuildSecureUrl("~/PRM/PRMWorkOrderPaymentTerm.aspx", string.Empty, UrlConstants.OVERVIEW_WORKORDER_ID, result.ToString(), PRMWorkOrderEntity.FLD_NAME_WorkOrderNo, CurrentPRMWorkOrderEntity.WorkOrderNo.ToString()).ToString();
                            Response.Redirect(NavUrl);
                            MiscUtil.ShowMessage(lblMessage, "Work Order Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (pRMWorkOrderEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Work Order Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Work Order Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
コード例 #8
0
        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);
                    }
                }
            }
        }