Esempio n. 1
0
        protected void GetInfo()
        {
            if (RadGrid1.SelectedValue != null)
            {
                var cC = new CBreak();
                var c  = cC.Get(Convert.ToInt32(RadGrid1.SelectedValue));
                if (c != null)
                {
                    RadDatePickerBreakStartDate.SelectedDate = c.BreakStartDate;
                    RadDatePickerBreakEndDate.SelectedDate   = c.BreakEndDate;
                    RadDatePickerStartDate.SelectedDate      = c.StartDate;
                    RadDatePickerEndDate.SelectedDate        = c.EndDate;
                    RadTextBoxComment.Text = c.Reason;
                }

                FileDownloadList1.GetFileDownload(Convert.ToInt32(RadGrid1.SelectedValue));
            }
        }
Esempio n. 2
0
        protected void ToolbarButtonClick(object sender, RadToolBarEventArgs e)
        {
            switch (e.Item.Text)
            {
            case "Request":
                if (IsValid)
                {
                    var cInvoice = new CInvoice();
                    var original = cInvoice.Get(InvoiceId);
                    if (original != null)
                    {
                        var cBreak = new CBreak();
                        var b      = new Break();

                        b.InvoiceId      = original.InvoiceId;
                        b.BreakStartDate = RadDatePickerStartDate.SelectedDate.Value;
                        b.BreakEndDate   = RadDatePickerEndDate.SelectedDate.Value;

                        b.StartDate = RadDatePickerProgramStartDate.SelectedDate.Value;
                        b.EndDate   = RadDatePickerProgramEndDate.SelectedDate.Value;
                        b.Reason    = RadTextBoxReason.Text;
                        b.IsActive  = true;
                        b.CreatedId = CurrentUserId;

                        int breakId = cBreak.Add(b);
                        if (breakId > 0)
                        {
                            // save uploading file
                            FileDownloadList1.SaveFile(breakId);

                            // Program
                            if (original.ProgramRegistrationId != null)
                            {
                                var cProgramRegiInfo = new CProgramRegistration();
                                var programRegiInfo  = cProgramRegiInfo.Get(Convert.ToInt32(original.ProgramRegistrationId));
                                programRegiInfo.EndDate     = RadDatePickerProgramEndDate.SelectedDate.Value;
                                programRegiInfo.UpdatedId   = CurrentUserId;
                                programRegiInfo.UpdatedDate = DateTime.Now;

                                cProgramRegiInfo.Update(programRegiInfo);
                            }
                            // Homestay
                            else if (original.HomestayRegistrationId != null)
                            {
                                var cHomestayPlacement     = new CHomestayPlacement();
                                var homestayStudentRequest = cHomestayPlacement.GetByStudentBasicId(Convert.ToInt32(original.HomestayRegistrationId));
                                homestayStudentRequest.EndDate     = RadDatePickerProgramEndDate.SelectedDate.Value;
                                homestayStudentRequest.UpdatedId   = CurrentUserId;
                                homestayStudentRequest.UpdatedDate = DateTime.Now;

                                cHomestayPlacement.Update(homestayStudentRequest);
                            }
                            // Dormitory
                            else if (original.DormitoryRegistrationId != null)
                            {
                                var cDormitoryPlacement = new CDormitoryPlacement();
                                var dormitoryPlacement  = cDormitoryPlacement.GetByStudentBasicId(Convert.ToInt32(original.DormitoryRegistrationId));
                                dormitoryPlacement.EndDate     = RadDatePickerProgramEndDate.SelectedDate.Value;
                                dormitoryPlacement.UpdatedId   = CurrentUserId;
                                dormitoryPlacement.UpdatedDate = DateTime.Now;

                                cDormitoryPlacement.Update(dormitoryPlacement);
                            }

                            RunClientScript("Close();");
                        }
                        else
                        {
                            ShowMessage("failed to update inqury (Add Break)");
                        }
                    }
                    else
                    {
                        ShowMessage("failed to update inqury (Original Invoice is null)");
                    }
                }
                break;

            case "Close":
                RunClientScript("Close();");
                break;
            }
        }