Example #1
0
        protected void cpVoucherBookingEntry_OnCallback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            string[] para = e.Parameter.Split(',');
            string   trs  = para[0];

            switch (trs)
            {
            case "open":
                NAS.DAL.Vouches.Vouches v = session.GetObjectByKey <NAS.DAL.Vouches.Vouches>(VoucherId);
                if (v == null)
                {
                    throw new Exception("The Voucher is not exist");
                }

                if (v.RowStatus != Utility.Constant.ROWSTATUS_BOOKED_ENTRY)
                {
                    GUIContext.State = new ReadyBookingVoucherState(this);
                }
                else
                {
                    GUIContext.State = new BookedVoucherState(this);
                }
                break;

            default:
                GUIContext.Request(trs, this);
                break;
            }

            //if (trs.Equals("Book"))
            //    cpVoucherBookingEntry.JSProperties.Add("cp"
        }
Example #2
0
        protected void ASPxCallbackPanel_PopupPerson_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            if (e.Parameter == null || e.Parameter.Equals(string.Empty))
            {
                return;
            }
            string[] transition = e.Parameter.Split(',');

            switch (transition[0])
            {
            case "Create":
                GUIContext.State = new PersonCreating(this);
                break;

            case "Edit":
                PersonId         = Guid.Parse(transition[1].ToString());
                GUIContext.State = new PersonEditing(this);
                //ASPxCallbackPanel_PopupPerson.JSProperties.Add("{{\"EndCallback:\"{0}\"\"}}", PersonId);
                break;

            default:
                if (GUIContext != null)
                {
                    GUIContext.Request(transition[0], this);
                }
                break;
            }

            if (transition[0].Equals("Save"))
            {
                ASPxCallbackPanel_PopupPerson.JSProperties.Add("cpIsSaved", true);
            }
        }
Example #3
0
        protected void cpLegalInvoiceArtifact_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            string[] param      = e.Parameter.Split('|');
            string   transition = param[0];

            switch (transition)
            {
            case "Create":
                GUIContext.State = new LegalInvoiceArtifact_Creating(this);
                break;

            case "Edit":
                clock_textBox(true);
                LegalInvoiceArtifactId = Guid.Parse(param[1]);
                GUIContext.State       = new LegalInvoiceArtifact_Editing(this);
                break;

            case "Cancel":
                GUIContext.State = new LegalInvoiceArtifact_Canceling(this);
                break;

            case "Change_Edit":
                Update_LegalInvoiceArtifact_Saving();
                clock_textBox(false);
                break;

            case "Save":
                GUIContext.State = new LegalInvoiceArtifact_Saving(this);
                break;

            default:
                GUIContext.Request(transition);
                break;
            }
        }
        protected void cpnVoucherBookingEntriesForm_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            string[] args      = e.Parameter.Split('|');
            string   command   = args[0];
            bool     isSuccess = false;

            try
            {
                switch (command)
                {
                case "Edit":
                    if (args.Length < 2)
                    {
                        throw new Exception("Invalid parameters");
                    }
                    VoucherId = Guid.Parse(args[1]);
                    UpdateState();
                    break;

                case "ForceRefresh":
                    UpdateState();
                    break;

                case "Cancel":
                    GUIContext.Request(command, this);
                    break;

                case "Book":
                    GUIContext.Request(command, this);
                    UpdateState();
                    break;

                default:
                    break;
                }
                isSuccess = true;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (command != null)
                {
                    cpnVoucherBookingEntriesForm.JSProperties.Add("cpCallbackArgs",
                                                                  String.Format("{{ \"transition\": \"{0}\", \"success\": {1} }}",
                                                                                command, isSuccess.ToString().ToLower()));
                }
            }
        }
        protected void cpSettingManufacturerList_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            string trs = e.Parameter.ToString();

            switch (trs)
            {
            case NAS.BO.Sale.PricePolicy.RulesWiz.Rules.RuleCondition.OPEN_TRANSIT:
                GUIContext.State = new PricePolicy.PredicatorSubForm.ManufacturerList.State.RuleConditionManufacturerOpening(this);
                break;

            case "SelectUnselectAll":
            case "Next":
            case "Back":
            case "Save":
                GUIContext.Request(trs, this);
                break;
            }
        }
        protected void cpnCodeRuleDefinitionEditingForm_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            string transition = null;
            bool   isSuccess  = false;

            try
            {
                string[] args = e.Parameter.Split('|');
                transition = args[0];

                if (transition.Equals("Edit"))
                {
                    if (args.Length > 1)
                    {
                        CodeRuleDefinitionId       = Guid.Parse(args[1]);
                        ParentCodeRuleDefinitionId = Guid.Empty;
                    }
                    else
                    {
                        throw new Exception();
                    }

                    GUIContext.State =
                        new ERPSystem.ArtifactCode.State.CodeRuleDefinitionForm.CodeRuleDefinitionEditing(this);
                    CodeRuleData codeRuleData =
                        codeRuleDataBO.GetCodeRuleData(session, CodeRuleDefinitionId);

                    CodeRuleDataId = codeRuleData.CodeRuleDataId;

                    transition =
                        GetTransitionByDataTypeCode(codeRuleData.CodeRuleDefinitionId.CodeRuleDataTypeId.Code);
                    //Request change state
                    GUIContext.Request(transition, this);
                }
                else if (transition.Equals("Create"))
                {
                    if (args.Length > 1)
                    {
                        CodeRuleDefinitionId = Guid.Empty;
                        Guid temp;
                        if (!Guid.TryParse(args[1], out temp))
                        {
                            temp = Guid.Empty;
                        }
                        ParentCodeRuleDefinitionId = temp;
                    }
                    else
                    {
                        throw new Exception();
                    }

                    GUIContext.State =
                        new ERPSystem.ArtifactCode.State.CodeRuleDefinitionForm.CodeRuleDefinitionCreating(this);

                    cbCodeRuleDataType.SelectedIndex = 0;
                    Guid             selectedCodeRuleDataTypeId = Guid.Parse(cbCodeRuleDataType.SelectedItem.Value.ToString());
                    CodeRuleDataType codeRuleDataType           =
                        session.GetObjectByKey <CodeRuleDataType>(selectedCodeRuleDataTypeId);
                    transition =
                        GetTransitionByDataTypeCode(codeRuleDataType.Code);
                    //Request change state
                    GUIContext.Request(transition, this);
                }
                else if (transition.Equals("ChangeDataType"))
                {
                    Guid             selectedCodeRuleDataTypeId = Guid.Parse(cbCodeRuleDataType.SelectedItem.Value.ToString());
                    CodeRuleDataType codeRuleDataType           =
                        session.GetObjectByKey <CodeRuleDataType>(selectedCodeRuleDataTypeId);
                    transition =
                        GetTransitionByDataTypeCode(codeRuleDataType.Code);
                    //Request change state
                    GUIContext.Request(transition, this);
                }
                else
                {
                    //Request change state
                    GUIContext.Request(transition, this);
                }

                isSuccess = true;
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                if (transition != null)
                {
                    cpnCodeRuleDefinitionEditingForm.JSProperties.Add("cpCallbackArgs",
                                                                      String.Format("{{ \"transition\": \"{0}\", \"success\": {1} }}",
                                                                                    transition, isSuccess.ToString().ToLower()));
                }
            }
        }
        protected void cpnCustomFieldEditingForm_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            string[] args       = e.Parameter.Split('|');
            string   command    = args[0];
            bool     isSuccess  = false;
            string   transition = null;

            try
            {
                switch (command)
                {
                case "Create":
                    ClearForm();
                    CustomFieldId    = Guid.NewGuid();
                    GUIContext.State = new CustomFieldCreating(this);
                    transition       = command;
                    isSuccess        = true;
                    break;

                case "Edit":
                    if (args.Length > 1)
                    {
                        CustomFieldId = Guid.Parse(args[1]);
                        //Check is system type
                        NAS.DAL.CMS.ObjectDocument.CustomField customField =
                            session.GetObjectByKey <NAS.DAL.CMS.ObjectDocument.CustomField>(CustomFieldId);
                        if (customField.CustomFieldType.Equals(CustomFieldTypeConstant.CUSTOM_FIELD_TYPE_READONLY) ||
                            customField.CustomFieldType.Equals(CustomFieldTypeConstant.CUSTOM_FIELD_TYPE_MASTER_READONLY))
                        {
                            throw new Exception("Không thể chỉnh sửa trường dữ liệu được tạo ra bởi hệ thống");
                        }
                    }
                    else
                    {
                        throw new Exception("CustomFieldId cannot be null");
                    }
                    ClearForm();
                    GUIContext.State = new CustomFieldEditing(this);
                    GUIContext.Request(GetCustomFieldEditingTransition(GetSelectedCustomFieldType().Code), this);
                    transition = command;
                    isSuccess  = true;
                    break;

                case "TabChanged":
                    string editingTransition = null;
                    if (pagCustomFieldEditingForm.ActiveTabIndex == 0)
                    {
                        string customFieldEditingTransition = null;
                        editingTransition = "EDIT_FIELD";
                        //Transit to CustomFieldDataEditing state by transition 'EDIT_FIELD'
                        GUIContext.Request(editingTransition, this);
                        //Then transit to concrete CustomFieldCreating
                        customFieldEditingTransition = GetCustomFieldEditingTransition(GetSelectedCustomFieldType().Code);
                        GUIContext.Request(customFieldEditingTransition, this);
                    }
                    else if (pagCustomFieldEditingForm.ActiveTabIndex == 1)
                    {
                        editingTransition = "EDIT_DATA";
                        GUIContext.Request(editingTransition, this);
                        GUIContext.Request(GetCustomFieldDataEditingTransition(GetSelectedCustomFieldType().Code), this);
                    }
                    transition = editingTransition;
                    txtCustomFieldName.IsValid = true;
                    isSuccess = true;
                    break;

                case "DataTypeChanged":
                    string customFieldTransition = null;
                    customFieldTransition = GetCustomFieldCreatingTransition(GetSelectedCustomFieldType().Code);
                    GUIContext.Request(customFieldTransition, this);
                    transition = customFieldTransition;
                    txtCustomFieldName.IsValid = true;
                    isSuccess = true;
                    break;

                case "Next":
                    string customFieldDataCreatingTransition = null;
                    //Transit to CustomFieldDataCreating state by transition 'NEXT'
                    if (GUIContext.Request(command, this))
                    {
                        //Then transit to concrete CustomFieldDataCreating
                        customFieldDataCreatingTransition = GetCustomFieldDataCreatingTransition(GetSelectedCustomFieldType().Code);
                        GUIContext.Request(customFieldDataCreatingTransition, this);
                    }
                    isSuccess  = true;
                    transition = command;
                    break;

                default:
                    GUIContext.Request(command, this);
                    transition = command;
                    isSuccess  = true;
                    break;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                if (transition != null)
                {
                    cpnCustomFieldEditingForm.JSProperties.Add("cpCallbackArgs",
                                                               String.Format("{{ \"transition\": \"{0}\", \"success\": {1} }}",
                                                                             transition, isSuccess.ToString().ToLower()));
                }
            }
        }
        protected void cpnReceiptVoucherEditingForm_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            string[] args      = e.Parameter.Split('|');
            string   command   = args[0];
            bool     isSuccess = false;
            ReceiptVoucherTransactionBO receiptVoucherTransactionBO;

            try
            {
                switch (command)
                {
                case "Create":
                    VoucherId = Guid.Empty;
                    //If create voucher from bill
                    if (args.Length > 1)
                    {
                        BillId = Guid.Parse(args[1]);
                    }
                    GUIContext.State         = new ReceiptVoucherCreating(this);
                    hiddenField["voucherId"] = VoucherId;
                    number = null;
                    break;

                case "Edit":
                    if (args.Length < 2)
                    {
                        throw new Exception("Invalid parameters");
                    }
                    VoucherId = Guid.Parse(args[1]);
                    hiddenField["voucherId"]    = VoucherId;
                    receiptVoucherTransactionBO = new ReceiptVoucherTransactionBO();
                    if (receiptVoucherTransactionBO.IsVoucherLockedBookingEntry(VoucherId))
                    {
                        GUIContext.State = new ReceiptVoucherLocked(this);
                    }
                    else
                    {
                        GUIContext.State = new ReceiptVoucherEditing(this);
                        UpdateBookingEntryState();
                    }
                    number = null;
                    break;

                case "ForceRefresh":
                    if (GUIContext.State is ReceiptVoucherCreating)
                    {
                        ClearFormValidation();
                        ReceiptVoucherCreating_UpdateGUI();
                        UpdateGUIByCurrency(gridlookupCurrency.GetSelectedCurrency(session));
                    }
                    else
                    {
                        receiptVoucherTransactionBO = new ReceiptVoucherTransactionBO();
                        if (receiptVoucherTransactionBO.IsVoucherLockedBookingEntry(VoucherId))
                        {
                            GUIContext.State = new ReceiptVoucherLocked(this);
                        }
                        else
                        {
                            UpdateBookingEntryState();
                        }
                    }
                    break;

                case "Cancel":
                    GUIContext.Request(command, this);
                    number = null;
                    break;

                default:
                    GUIContext.Request(command, this);
                    UpdateBookingEntryState();
                    number = null;
                    break;
                }
                isSuccess = true;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (command != null)
                {
                    cpnReceiptVoucherEditingForm.JSProperties.Add("cpCallbackArgs",
                                                                  String.Format("{{ \"transition\": \"{0}\", \"success\": {1} }}",
                                                                                command, isSuccess.ToString().ToLower()));
                }
            }
        }
        protected void panelInvoiceEditingForm_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            string[]          args              = e.Parameter.Split('|');
            string            command           = args[0];
            PurchaseInvoiceBO purchaseInvoiceBO = new PurchaseInvoiceBO();
            Bill bill = null;

            switch (command)
            {
            case "Create":
                GUIContext.State = new PurchaseInvoiceCreating(this);

                billDetails.InitState();
                break;

            case "Edit":
                if (args.Length < 2)
                {
                    throw new Exception("Invalid parameters");
                }
                BillId = Guid.Parse(args[1]);
                //Determine bill status
                hfBillId["BillId"] = BillId.ToString();
                bill = purchaseInvoiceBO.GetBillById(session, BillId);
                if (bill.RowStatus.Equals(Utility.Constant.ROWSTATUS_BOOKED_ENTRY))
                {
                    GUIContext.State = new PurchaseInvoiceLocked(this);
                }
                else
                {
                    GUIContext.State = new PurchaseInvoiceEditing(this);
                }

                billDetails.InitState();
                break;

            case "Save":
                GUIContext.Request(command, this);

                bill = purchaseInvoiceBO.GetBillById(session, BillId);
                if (bill.RowStatus.Equals(Utility.Constant.ROWSTATUS_BOOKED_ENTRY))
                {
                    GUIContext.State = new PurchaseInvoiceLocked(this);
                }
                break;

            case "Cancel":
                GUIContext.Request(command, this);
                panelInvoiceEditingForm.JSProperties["cpEvent"] = "Closing";
                break;

            case "Refresh":
                bill = purchaseInvoiceBO.GetBillById(session, BillId);
                if (bill.RowStatus.Equals(Utility.Constant.ROWSTATUS_BOOKED_ENTRY))
                {
                    GUIContext.State = new PurchaseInvoiceLocked(this);
                }
                else
                {
                    GUIContext.State = new PurchaseInvoiceEditing(this);
                }
                break;

            default:
                break;
            }

            uEdittingInputInventoryCommand1.SettingInit <NAS.DAL.Invoice.PurchaseInvoice>(BillId, ButtonCreateInventoryCommand);
        }
Example #10
0
 protected void grdPricePolicy_CustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e)
 {
     GUIContext.Request(e.ButtonID, this);
 }