Пример #1
0
        protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e)
        {
            switch (e.Item.Text)
            {
            case "Save":
                if (IsValid)
                {
                    foreach (var chkItem in RadComboBoxMenu.CheckedItems)
                    {
                        var cInvoice = new CInvoice();
                        var invoice  = new Erp2016.Lib.Invoice();

                        invoice.StudentId = Convert.ToInt32(chkItem.Value);

                        invoice.Status         = (int)CConstValue.InvoiceStatus.Pending; // pending
                        invoice.SiteLocationId = CurrentSiteLocationId;
                        invoice.InvoiceType    = (int)CConstValue.InvoiceType.Simple;    //Simple Invoice(SI)

                        invoice.CreatedId   = CurrentUserId;
                        invoice.CreatedDate = DateTime.Now;

                        var invoiceId = cInvoice.Add(invoice);     //DB:Invoice

                        if (invoiceId > 0)
                        {
                            var cInvoiceItem = new CInvoiceItem();
                            var gridData     = InvoiceItemGrid1.GetGridData();
                            gridData = gridData.Insert(0, ",");
                            var gridDataRows = gridData.Split('|');
                            foreach (var gridDataRow in gridDataRows)
                            {
                                if (string.IsNullOrEmpty(gridDataRow))
                                {
                                    break;
                                }

                                var gridDataRowCell = gridDataRow.Split(',');

                                var invoiceCoaItem = gridDataRowCell[1];
                                var standardPrice  = gridDataRowCell[2];
                                var studentPrice   = gridDataRowCell[3];
                                var agencyPrice    = gridDataRowCell[4];
                                var remark         = gridDataRowCell[5];

                                var invoiceItem = new InvoiceItem();
                                invoiceItem.InvoiceId = invoiceId;
                                var cInvoiceCoaItem = new CInvoiceCoaItem();
                                invoiceItem.InvoiceCoaItemId = cInvoiceCoaItem.Get(invoiceCoaItem).InvoiceCoaItemId;
                                if (!string.IsNullOrEmpty(standardPrice))
                                {
                                    invoiceItem.StandardPrice = Convert.ToDecimal(standardPrice.Replace("$", string.Empty));
                                }
                                if (!string.IsNullOrEmpty(studentPrice))
                                {
                                    invoiceItem.StudentPrice = Convert.ToDecimal(studentPrice.Replace("$", string.Empty));
                                }
                                if (!string.IsNullOrEmpty(agencyPrice))
                                {
                                    invoiceItem.AgencyPrice = Convert.ToDecimal(agencyPrice.Replace("$", string.Empty));
                                }
                                invoiceItem.Remark = remark;

                                invoiceItem.CreatedId   = CurrentUserId;
                                invoiceItem.CreatedDate = DateTime.Now;

                                cInvoiceItem.Add(invoiceItem);
                            }
                        }
                    }
                    RunClientScript("Close();");
                }
                else
                {
                    ShowMessage("Error to add Simple Invoice");
                }
                break;

            case "Cancel":
                RunClientScript("Close();");
                break;
            }
        }
Пример #2
0
    public static void SetFilterCheckListItems(GridFilterCheckListItemsRequestedEventArgs e)
    {
        object dataSource = null;
        string dataField  = (e.Column as IGridDataColumn).GetActiveDataField();

        switch (dataField)
        {
        // Common
        case "SiteName":
            dataSource = new CSite().GetSiteNameList();
            break;

        case "SiteLocationName":
            dataSource = new CSiteLocation().GetSiteLocationNameList();
            break;

        case "CountryName":
            dataSource = new CCountry().GetCountryNameList();
            break;

        case "AgencyName":
            dataSource = new CAgency().GetAgencyNameList();
            break;

        case "ProgramName":
            dataSource = new CProgram().GetProgramNameList();
            break;

        case "InvoiceCoaItemId":
            dataSource = new CInvoiceCoaItem().GetInvoiceCoaItemIdNameList();
            break;

        case "InvoiceName":
            dataSource = new CProgram().GetInvoiceNameList();
            break;

        case "StudentName":
            dataSource = new CStudent().GetStudentNameList();
            break;

        case "UserName":
            dataSource = new CUser().GetUserNameList();
            break;

        case "Status":
            dataSource = new CApproval().GetStatusNameList();
            break;

        case "ApprovalUserName":
            dataSource = new CUser().GetApprovalUserNameList();
            break;

        case "InstructorName":
            dataSource = new CUser().GetInstructorNameList();
            break;

        case "ProgramStatusName":
            dataSource = new CProgramRegistration().GetProgramStatusList();
            break;

        // Dashboard
        case "Type":
            dataSource = new CApproval().GetApprovalTypeNameList();
            break;

        // Invoice
        case "InvoiceType":
            dataSource = new CInvoice().GetInvoiceTypeList();
            break;

        case "InvoiceStatus":
            dataSource = new CInvoice().GetInvoiceStatusList();
            break;

        // Deposit
        case "DepositStatus":
            dataSource = new CDeposit().GetDepositStatusNameList();
            break;

        case "DepositBank":
            dataSource = new CDeposit().GetDepositBankNameList();
            break;

        case "PaidMethod":
            dataSource = new CDeposit().GetPaidMethodNameList();
            break;

        case "ExtraTypeName":
            dataSource = new CDeposit().GetExtraTypeNameList();
            break;

        // CreditMemo
        case "CreditMemoType":
            dataSource = new CCreditMemo().GetCreditMemoTypeNameList();
            break;

        case "PayoutMethodName":
            dataSource = new CCreditMemoPayout().GetPayoutMethodNameList();
            break;

        // Academic
        case "FacultyName":
            dataSource = new CFaculty().GetFacultyNameList();
            break;

        case "ProgramGroupName":
            dataSource = new CProgramGroup().GetProgramGroupNameList();
            break;

        // Vacation
        case "VacationType":
            dataSource = new CVacation().GetVacationTypeNameList();
            break;

        // User
        case "CreatedUserName":
            dataSource = new CUser().GetCreatedUserNameList();
            break;

        case "UpdatedUserName":
            dataSource = new CUser().GetUpdatedUserNameList();
            break;

        case "PositionName":
            dataSource = new CUser().GetPositionNameList();
            break;

        case "Email":
            dataSource = new CUser().GetEmailNameList();
            break;

        case "LoginId":
            dataSource = new CUser().GetLoginIdNameList();
            break;

        // PurchaseOrder
        case "PurchaseOrderTypeName":
            dataSource = new CPurchaseOrder().GetPurchaseOrderTypeNameList();
            break;

        case "PriorityTypeName":
            dataSource = new CPurchaseOrder().GetPriorityTypeNameList();
            break;

        case "ReviewTypeName":
            dataSource = new CPurchaseOrder().GetReviewTypeNameList();
            break;
        ////Invoice#
        //case "SchoolName":
        //    dataSource = new CSite().GetSiteNameList();
        //    break;

        // Inventory
        case "AssignedUserName":
            dataSource = new CUser().GetAssignedUserNameList();
            break;

        case "InventoryCategoryName":
            dataSource = new CInventory().GetInventoryCategoryNameList();
            break;

        case "InventoryCategoryItemName":
            dataSource = new CInventory().GetInventoryCategoryItemNameList();
            break;

        case "ConditionName":
            dataSource = new CInventory().GetConditionNameList();
            break;

        case "InUseName":
            dataSource = new CInventory().GetInUseNameList();
            break;
        }

        if (dataSource != null)
        {
            SetFilter(e, dataField, dataSource);
        }
    }