Пример #1
0
 protected void FileDownloadList1_OnPreRender(object sender, EventArgs e)
 {
     if (RadGridRefund.SelectedValue != null)
     {
         FileDownloadList1.GetFileDownload(Convert.ToInt32(RadGridRefund.SelectedValue));
     }
 }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // CreditMemoId in new or CreditMemoPayoutId in modify
            Id = Convert.ToInt32(Request["id"]);

            if (!IsPostBack)
            {
                FileDownloadList1.InitFileDownloadList((int)CConstValue.Upload.CreditMemo);

                CreditMemoPayout1.SetCreditVisible(false);
                CreditMemoPayout1.SetReadonly(false);

                // new
                if (Request["type"] == "0")
                {
                    //
                }
                // modify
                else
                {
                    var cCreditMemoPayout = new CCreditMemoPayout().Get(Id);
                    RadNumericTextBoxAmount.Value    = (double)cCreditMemoPayout.Amount;
                    RadNumericTextBoxAmount.ReadOnly = true;

                    CreditMemoPayout1.SetData(cCreditMemoPayout);

                    // get Filedownload List
                    FileDownloadList1.GetFileDownload(Id);
                }
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                FileDownloadList1.InitFileDownloadList((int)CConstValue.Upload.PackageProgram);

                hfId.Value   = Request["id"];
                hfType.Value = Request["type"];

                ResetForm();
                LoadFaculty();

                // new
                if (hfType.Value == "0")
                {
                    GetSiteLocation(false);
                    mainToolBar.FindItemByText("Request").Enabled = false;
                }
                // modify
                else
                {
                    GetSiteLocation(true);

                    var cP = new CPackageProgram().GetViewPackageProgram(Convert.ToInt32(hfId.Value));
                    RadTextBoxPackageProgramName.Text = cP.PackageProgramName;

                    var cProgram = new CProgram();
                    var program  = cProgram.Get((int)cP.ProgramId);
                    if (program != null)
                    {
                        if (program.ProgramGroupId != null)
                        {
                            var programGroup = new CProgramGroup().Get(Convert.ToInt32(program.ProgramGroupId));
                            if (programGroup != null)
                            {
                                RadComboBoxFaculty.SelectedValue = programGroup.FacultyId.ToString();
                                LoadProgramGroup(RadComboBoxFaculty.SelectedValue);
                            }
                            RadComboBoxProgramGroup.SelectedValue = program.ProgramGroupId.ToString();
                            LoadProgram(RadComboBoxProgramGroup.SelectedValue);
                        }
                        RadComboBoxProgram.SelectedValue = program.ProgramId.ToString();
                    }

                    RadDatePickerStartDate.SelectedDate = cP.StartDate;
                    RadDatePickerEndDate.SelectedDate   = cP.EndDate;
                    RadTextBoxDescription.Text          = cP.Description;
                    //btnToggleActive.Checked = (bool)cP.IsActive;
                    //btnToggleActive.Visible = true;

                    // UP LOAD
                    FileDownloadList1.GetFileDownload(Convert.ToInt32(hfId.Value));
                }
            }

            RadComboBoxFaculty.OpenDropDownOnLoad      = false;
            RadComboBoxProgramGroup.OpenDropDownOnLoad = false;
            RadComboBoxProgram.OpenDropDownOnLoad      = false;
        }
Пример #4
0
        protected void RadGridPackageProgramDetail_OnPreRender(object sender, EventArgs e)
        {
            SetApprovalList();
            GetPackageDetail();

            if (RadGridProgramPackage.SelectedValue != null)
            {
                FileDownloadList1.GetFileDownload(Convert.ToInt32(RadGridProgramPackage.SelectedValue));
            }
        }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Id = Convert.ToInt32(Request["Id"]);

            if (!IsPostBack)
            {
                var scriptManager = (RadScriptManager)Page.Master.FindControl("RadScriptManager1");
                //scriptManager.RegisterPostBackControl(RadButtonFileDownload);
                FileDownloadList1.InitFileDownloadList((int)CConstValue.Upload.HomestayAgency);

                var global = new CGlobal();
                //Nation drop down list
                RadComboBoxCountry.DataSource     = global.GetCountry();
                RadComboBoxCountry.DataTextField  = "Name";
                RadComboBoxCountry.DataValueField = "Value";
                RadComboBoxCountry.Filter         = (RadComboBoxFilter)Convert.ToInt32(1);
                RadComboBoxCountry.Items.Insert(0, new RadComboBoxItem("Choose a Country"));
                RadComboBoxCountry.DataBind();

                //LoadSite();

                // new
                if (Request["type"] == "0")
                {
                    GetSiteLocation(false);
                }
                // modify
                else
                {
                    GetSiteLocation(true);

                    var cS = new CPromotion().Get(Id);

                    foreach (RadComboBoxItem item in RadComboBoxCountry.Items)
                    {
                        if (item.Value == cS.CountryId.ToString())
                        {
                            item.Selected = true;
                            break;
                        }
                    }

                    RadNumericTextBoxAmount.Value       = (double)cS.Amount;
                    RadDatePickerStartDate.SelectedDate = cS.StartDate;
                    RadDatePickerEndDate.SelectedDate   = cS.EndDate;

                    tbComment.Text = cS.Memo;

                    // UP LOAD
                    FileDownloadList1.GetFileDownload(Convert.ToInt32(Id));
                }
            }
        }
Пример #6
0
        protected void GetInfo()
        {
            if (RadGrid1.SelectedValue != null)
            {
                var cCancel = new CCancel();
                var cancel  = cCancel.Get(Convert.ToInt32(RadGrid1.SelectedValue));
                if (cancel != null)
                {
                    RadDatePickerApplyDate.SelectedDate = cancel.ApplyDate;
                    RadTextBoxComment.Text = cancel.Reason;
                }

                FileDownloadList1.GetFileDownload(Convert.ToInt32(RadGrid1.SelectedValue));
            }
        }
Пример #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (Request["__EVENTTARGET"] == "btnNew" &&
            //Request["__EVENTARGUMENT"] == "MyArgument")
            //{
            //    //do something
            //}

            // Refund_R
            InvoiceItemGrid1.SetTypeOfInvoiceCoaItem(2);

            RefundId = Convert.ToInt32(Request["id"]);

            // find user control
            _sqlDataSourceInvoiceItems = InvoiceItemGrid1.GetSqlDataSourceInvoiceItems();
            _radGridInvoiceItems       = InvoiceItemGrid1.GetRadGridInvoiceItems();
            // connect event of invoice Items.
            _radGridInvoiceItems.PreRender += _radGridInvoiceItems_PreRender;
            //_radGridInvoiceItems.MasterTableView.CommandItemSettings.ShowSaveChangesButton = false;

            FileDownloadList1.InitFileDownloadList((int)CConstValue.Upload.Refund);

            CreditMemoPayout1.SetReadonly(false);

            if (!IsPostBack)
            {
                //// new
                //if (Request["type"] == "0")
                //{
                //    // nothing
                //}
                //else
                //{
                var cRefund = new CRefund();
                var refund  = cRefund.Get(RefundId);
                FileDownloadList1.GetFileDownload(refund.RefundId);

                InvoiceItemGrid1.InvoiceId = refund.InvoiceId;
                InvoiceItemGrid1.SetEditMode(true);

                CreditMemoPayout1.SetCreditVisible(true);
                var cCreditMemoPayout = new CCreditMemoPayout();
                var creditMemoPayout  = cCreditMemoPayout.Get(refund.CreditMemoPayoutId);
                CreditMemoPayout1.SetData(creditMemoPayout);
                //}
            }
        }
Пример #8
0
        protected void GetInfo()
        {
            if (RadGrid1.SelectedValue != null)
            {
                var cC = new CScheduleChange();
                var c  = cC.Get(Convert.ToInt32(RadGrid1.SelectedValue));
                if (c != null)
                {
                    RadDatePickerApplyDate.SelectedDate = c.ApplyDate;
                    RadDatePickerStartDate.SelectedDate = c.StartDate;
                    RadDatePickerEndDate.SelectedDate   = c.EndDate;
                    RadTextBoxComment.Text = c.Reason;
                }

                FileDownloadList1.GetFileDownload(Convert.ToInt32(RadGrid1.SelectedValue));
            }
        }
Пример #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (new CUser().IsUserInformation(CurrentGroupId) == false)
            {
                Response.Redirect("~/NoPermission");
            }

            Id = Convert.ToInt32(Request["id"]);

            if (!IsPostBack)
            {
                FileDownloadList1.InitFileDownloadList((int)CConstValue.Upload.User);

                var cUsrinfo = new CUserInfomation();
                var usrinfo  = cUsrinfo.Get(Id);
                if (usrinfo != null)
                {
                    RadDatePickerActualHireDate.SelectedDate = usrinfo.ActualHireDate;
                    RadComboBoxJobType.SelectedValue         = usrinfo.JobType.ToString();
                    CheckBoxBank.Checked        = Convert.ToBoolean(usrinfo.BankInfo);
                    CheckBoxDiploma.Checked     = Convert.ToBoolean(usrinfo.Diploma);
                    CheckBoxResume.Checked      = Convert.ToBoolean(usrinfo.Resume);
                    CheckBoxOfferLetter.Checked = Convert.ToBoolean(usrinfo.OfferLetter);
                }

                FileDownloadList1.GetFileDownload(Id);
            }

            sqlDataSourceVacationSchema.WhereParameters.Clear();
            sqlDataSourceVacationSchema.WhereParameters.Add("UserId", DbType.Int32, Id.ToString());
            sqlDataSourceVacationSchema.Where = "UserId== @UserId";

            LinqDataSourceUserSalary.WhereParameters.Clear();
            LinqDataSourceUserSalary.WhereParameters.Add("UserId", DbType.Int32, Id.ToString());
            LinqDataSourceUserSalary.Where = "UserId== @UserId";


            LinqDataSourceUserStatus.WhereParameters.Clear();
            LinqDataSourceUserStatus.WhereParameters.Add("UserId", DbType.Int32, Id.ToString());
            LinqDataSourceUserStatus.Where = "UserId== @UserId";
        }
Пример #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DepositId = Convert.ToInt32(Request["id"]);
            DepositInfomation1.InitDepositInformation(true);

            FileDownloadList1.InitFileDownloadList((int)CConstValue.Upload.Deposit);

            if (!IsPostBack)
            {
                // new
                if (Request["type"] == "0")
                {
                    // nothing
                }
                else
                {
                    var cDeposit = new CDeposit();
                    var deposit  = cDeposit.Get(DepositId);
                    DepositInfomation1.SetData(deposit);
                    FileDownloadList1.GetFileDownload(deposit.DepositId);
                }
            }
        }
Пример #11
0
        protected void GetStudent()
        {
            ResetForm();

            if (RadGridStudentList.SelectedValue != null && RadGridStudentList.SelectedValue.ToString() != "")
            {
                var cStud = new CStudent();
                var stud  = cStud.Get(Convert.ToInt32(RadGridStudentList.SelectedValue));

                if (stud.StudentId > 0)
                {
                    var siteLocation = new CSiteLocation().Get(stud.SiteLocationId);
                    LoadSite(siteLocation.SiteId);
                    LoadSiteLocation(siteLocation.SiteId);
                    RadComboBoxSite.SelectedValue         = siteLocation.SiteId.ToString();
                    RadComboBoxSiteLocation.SelectedValue = siteLocation.SiteLocationId.ToString();

                    ddlmarketer.SelectedValue = stud.MarketerId.ToString();

                    tbFirstName.Text   = stud.FirstName;
                    tbMiddleName1.Text = stud.MiddleName1;
                    tbMiddleName2.Text = stud.MiddleName2;
                    tbLastName1.Text   = stud.LastName1;
                    tbLastName2.Text   = stud.LastName2;

                    ddlGender.SelectedValue    = stud.Gender.ToString();
                    tbDateOfBirth.SelectedDate = stud.DOB;

                    var age = DateTime.Now.Year - stud.DOB.Value.Year;

                    if (age < 12)
                    {
                        ddlAgeSegregation.SelectedValue = "3";
                    }
                    else if (age < 18)
                    {
                        ddlAgeSegregation.SelectedValue = "2";
                    }
                    else
                    {
                        ddlAgeSegregation.SelectedValue = "1";
                    }

                    ddlStudentType.SelectedValue = stud.StudentType.ToString();
                    ddlCountry.SelectedValue     = stud.CountryId.ToString();

                    tbPhone1.Text = stud.Phone1;
                    tbPhone2.Text = stud.Phone2;

                    tbEmail1.Text = stud.Email1;
                    tbEmail2.Text = stud.Email2;

                    tbPassport.Text = stud.Passport;
                    tbLoanNo.Text   = stud.LoanNo;

                    tbComment.Text = stud.Comment;

                    //tbStudentMasterNo.Text = stud.StudentMasterNo;

                    tbContactName.Text         = stud.ContactName;
                    tbContactRelationship.Text = stud.ContactRelationship;
                    tbContactPhone.Text        = stud.ContactPhone;

                    tbPerAddress.Text           = stud.PermanentAddress1;
                    tbPerCity.Text              = stud.PermanentCity;
                    tbPerState.Text             = stud.PermanentProvince;
                    tbPerZiocode.Text           = stud.PermanentPostalCode;
                    ddlPerCountry.SelectedValue = (stud.PermanentCountry.ToString() == null || stud.PermanentCountry.ToString() == "") ? "0" : stud.PermanentCountry.ToString();

                    tbCadAddress.Text  = stud.Address1InCanada;
                    tbCadCity.Text     = stud.CityInCanada;
                    tbCadProvince.Text = stud.ProvinceInCanada;
                    tbCadZipcode.Text  = stud.PostalCodeInCanada;

                    ddlInsurance.SelectedValue = stud.Insurance.ToString();
                    //if (ddlInsurance.SelectedValue == "False")
                    //    tbInsuranceStartDate.Visible = false;
                    //else
                    //    tbInsuranceStartDate.Visible = true;

                    if (stud.InsuranceStart > Convert.ToDateTime("1900-01-01"))
                    {
                        tbInsuranceStartDate.SelectedDate = stud.InsuranceStart;
                    }
                    else
                    {
                        tbInsuranceStartDate.SelectedDate = null;
                    }
                    if (stud.InsuranceEnd > Convert.ToDateTime("1900-01-01"))
                    {
                        tbInsuranceEndtDate.SelectedDate = stud.InsuranceEnd;
                    }
                    else
                    {
                        tbInsuranceEndtDate.SelectedDate = null;
                    }
                    tbInsuranceDayFee.Text   = stud.InsuranceDayFee.ToString();
                    tbInsuranceTotalAmt.Text = stud.InsuranceTotal.ToString();

                    ddlStatus.SelectedValue        = (stud.VisaStatus.ToString() == null || stud.VisaStatus.ToString() == "") ? "120" : stud.VisaStatus.ToString();
                    tbStatusStartDate.SelectedDate = stud.VisaStart;
                    tbStatusEndDate.SelectedDate   = stud.VisaEnd;
                    if (stud.VisaStart > Convert.ToDateTime("1900-01-01"))
                    {
                        tbStatusStartDate.SelectedDate = stud.VisaStart;
                    }
                    else
                    {
                        tbStatusStartDate.SelectedDate = null;
                    }
                    if (stud.VisaEnd > Convert.ToDateTime("1900-01-01"))
                    {
                        tbStatusEndDate.SelectedDate = stud.VisaEnd;
                    }
                    else
                    {
                        tbStatusEndDate.SelectedDate = null;
                    }

                    ddlPermit.SelectedValue        = (stud.WorkPermitStatus.ToString() == null || stud.WorkPermitStatus.ToString() == "") ? "126" : stud.WorkPermitStatus.ToString();
                    tbPermitStartDate.SelectedDate = stud.WorkPermitStart;
                    tbPermitEndDate.SelectedDate   = stud.WorkPermitEnd;
                    if (stud.WorkPermitStart > Convert.ToDateTime("1900-01-01"))
                    {
                        tbPermitStartDate.SelectedDate = stud.WorkPermitStart;
                    }
                    else
                    {
                        tbPermitStartDate.SelectedDate = null;
                    }
                    if (stud.WorkPermitEnd > Convert.ToDateTime("1900-01-01"))
                    {
                        tbPermitEndDate.SelectedDate = stud.WorkPermitEnd;
                    }
                    else
                    {
                        tbPermitEndDate.SelectedDate = null;
                    }

                    FileDownloadList1.GetFileDownload(Convert.ToInt32(RadGridStudentList.SelectedValue));
                }
            }
        }
Пример #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Id = Convert.ToInt32(Request["id"]);

            if (!IsPostBack)
            {
                foreach (GridColumn v in RadGridPurchaseOrderDetail.Columns)
                {
                    if (v.GetType() == typeof(GridTemplateColumn))
                    {
                        var column = (GridTemplateColumn)v;
                        switch (column.UniqueName)
                        {
                        case "Quantity":
                            column.DefaultInsertValue = "1";
                            break;
                        }
                    }
                }

                var scriptManager = (RadScriptManager)Page.Master.FindControl("RadScriptManager1");
                //scriptManager.Scripts.Add(new ScriptReference() { Path = ResolveUrl("~/assets/js/jquery.printArea.js") });
                //scriptManager.RegisterPostBackControl(RadButtonFileDownload);
                FileDownloadList1.InitFileDownloadList((int)CConstValue.Upload.PurchaseOrder);

                var global = new CGlobal();
                RadComboBoxType.DataSource     = global.GetDictionary(1466);
                RadComboBoxType.DataTextField  = "Name";
                RadComboBoxType.DataValueField = "Value";
                RadComboBoxType.DataBind();

                RadComboBoxPriority.DataSource     = global.GetDictionary(1470);
                RadComboBoxPriority.DataTextField  = "Name";
                RadComboBoxPriority.DataValueField = "Value";
                RadComboBoxPriority.DataBind();

                RadComboBoxShippingMethod.DataSource     = global.GetDictionary(1471);
                RadComboBoxShippingMethod.DataTextField  = "Name";
                RadComboBoxShippingMethod.DataValueField = "Value";
                RadComboBoxShippingMethod.DataBind();

                RadComboBoxReviewType.DataSource     = global.GetDictionary(1489);
                RadComboBoxReviewType.DataTextField  = "Name";
                RadComboBoxReviewType.DataValueField = "Value";
                RadComboBoxReviewType.DataBind();
                RadComboBoxReviewType.Items.Add(new RadComboBoxItem("N/A", null));
                RadComboBoxReviewType.SelectedIndex = RadComboBoxReviewType.Items.Count - 1;

                var obj = new CPurchaseOrder();
                var requestOrApprovalType = Request["requestOrApprovalType"];
                var approvalType          = Request["approvalType"];

                var buttonList = new List <string>();

                // new
                if (Request["createOrListType"] == "0")
                {
                    obj = obj.GetNewDocument(CurrentUserId);

                    buttonList.Add("TempSave");
                    buttonList.Add("Request");
                    buttonList.Add("Close");

                    SetVisibleItems(true);
                }
                // select
                else
                {
                    FileDownloadList1.GetFileDownload(Convert.ToInt32(Id));

                    // date
                    obj = new CPurchaseOrder(Id);

                    // request list
                    if (requestOrApprovalType == "0")
                    {
                        // Revise
                        if (approvalType == ((int)CConstValue.ApprovalStatus.Revise).ToString())
                        {
                            buttonList.Add("Request");
                            buttonList.Add("Cancel");
                            buttonList.Add("Close");

                            SetVisibleItems(true);
                        }
                        // TempSave
                        else if (approvalType == string.Empty)
                        {
                            buttonList.Add("TempSave");
                            buttonList.Add("Request");
                            buttonList.Add("Cancel");
                            buttonList.Add("Close");

                            SetVisibleItems(true);
                        }
                        // Request
                        else if (approvalType == "1")
                        {
                            buttonList.Add("Cancel");
                            buttonList.Add("Close");

                            SetVisibleItems(false);
                        }
                        else
                        {
                            buttonList.Add("Close");

                            SetVisibleItems(false);
                        }
                    }
                    // approval
                    else if (requestOrApprovalType == "1")
                    {
                        // approved or rejected
                        if (approvalType == ((int)CConstValue.ApprovalStatus.Approved).ToString() ||
                            approvalType == ((int)CConstValue.ApprovalStatus.Rejected).ToString() ||
                            approvalType == ((int)CConstValue.ApprovalStatus.Canceled).ToString())
                        {
                            buttonList.Add("Close");
                        }
                        else
                        {
                            var refundApproveInfo = new CGlobal();
                            var supervisor        = refundApproveInfo.CheckApprovalEnable((int)CConstValue.Approval.PurchaseOrder, Convert.ToInt32(Id));

                            if (CurrentUserId == supervisor)
                            {
                                buttonList.Add("Approve");
                                buttonList.Add("Reject");
                                buttonList.Add("Revise");
                                buttonList.Add("Close");
                            }
                            else
                            {
                                buttonList.Add("Close");
                            }
                        }

                        SetVisibleItems(false);
                    }
                    // Purchase Order from HQ
                    else if (requestOrApprovalType == "2")
                    {
                        // Wating for review from HQ
                        if (approvalType == ((int)CConstValue.ApprovalStatus.WaitingForPreviewFromHq).ToString())
                        {
                            buttonList.Add("Accept");
                            buttonList.Add("Reject");
                            buttonList.Add("Close");
                        }
                        // Approved
                        else if (approvalType == ((int)CConstValue.ApprovalStatus.Approved).ToString())
                        {
                            buttonList.Add("Print");
                            buttonList.Add("Accept");
                            buttonList.Add("Close");
                        }
                        else
                        {
                            buttonList.Add("Close");
                        }

                        SetVisibleItems(false);
                    }
                }

                foreach (RadToolBarItem item in RadToolBar1.Items)
                {
                    if (buttonList.Contains(item.Text))
                    {
                        item.Visible = true;
                    }
                    else
                    {
                        item.Visible = false;
                    }
                }

                // new or temp
                if (approvalType == "0" || approvalType == string.Empty)
                {
                    FileDownloadList1.SetVisibieUploadControls(true);
                }
                else
                {
                    FileDownloadList1.SetVisibieUploadControls(false);
                }

                if (approvalType != ((int)CConstValue.ApprovalStatus.WaitingForPreviewFromHq).ToString() &&
                    approvalType != ((int)CConstValue.ApprovalStatus.Approved).ToString())
                {
                    RunClientScript("HideReview();");
                }

                var dt = new DataTable();
                dt.Columns.Add("DocNo");
                dt.Columns.Add("Site");
                dt.Columns.Add("Location");
                dt.Columns.Add("Name");
                dt.Columns.Add("Date");
                var newDr = dt.NewRow();
                newDr["DocNo"]    = obj.DocNo;
                newDr["Site"]     = obj.Site;
                newDr["Location"] = obj.Location;
                newDr["Name"]     = obj.Name;
                newDr["Date"]     = obj.Date;
                dt.Rows.Add(newDr);

                RadGridInfo.DataSource = dt;

                // New
                if (Request["createOrListType"] == "0")
                {
                    var cUser = new CUser();
                    var user  = cUser.Get(CurrentUserId);
                    if (user != null)
                    {
                        RadTextBoxShipToName.Text       = cUser.GetUserName(user);
                        RadTextBoxShipToAddress.Text    = user.Address1 + " " + user.Address2;
                        RadTextBoxShipToCity.Text       = user.City;
                        RadTextBoxShipToProvince.Text   = user.Province;
                        RadTextBoxShipToPostalCode.Text = user.PostalCode;
                        RadTextBoxShipToPhone.Text      = user.CellPhone;
                        RadTextBoxShipToEmail.Text      = user.Email;
                    }

                    // Init
                    RadNumericTextBoxShippingTerms.Value   = 1;
                    RadDatePickerDeliveryDate.SelectedDate = DateTime.Now;
                }
                else
                {
                    var result = obj.Get(Id);
                    if (result != null)
                    {
                        RadComboBoxType.SelectedIndex           = result.PurchaseOrderType;
                        RadComboBoxPriority.SelectedIndex       = (int)result.PriorityType;
                        RadComboBoxShippingMethod.SelectedIndex = (int)result.ShippingMethodType;
                        RadNumericTextBoxShippingTerms.Value    = result.ShippingTerms;
                        RadDatePickerDeliveryDate.SelectedDate  = result.ShippingDeliveryDate;
                        RadTextBoxDescription.Text = result.Description;

                        RadTextBoxVendorName.Text       = result.VendorName;
                        RadTextBoxVendorAddress.Text    = result.VendorAddress;
                        RadTextBoxVendorCity.Text       = result.VendorCity;
                        RadTextBoxVendorProvince.Text   = result.VendorProvince;
                        RadTextBoxVendorPostalCode.Text = result.VendorPostalCode;
                        RadTextBoxVendorPhone.Text      = result.VendorPhone;
                        RadTextBoxVendorEmail.Text      = result.VendorEmail;

                        RadTextBoxShipToName.Text       = result.ShipToName;
                        RadTextBoxShipToAddress.Text    = result.ShipToAddress;
                        RadTextBoxShipToCity.Text       = result.ShipToCity;
                        RadTextBoxShipToProvince.Text   = result.ShipToProvince;
                        RadTextBoxShipToPostalCode.Text = result.ShipToPostalCode;
                        RadTextBoxShipToPhone.Text      = result.ShipToPhone;
                        RadTextBoxShipToEmail.Text      = result.ShipToEmail;

                        if (result.ReviewType != null)
                        {
                            RadComboBoxReviewType.SelectedIndex = (int)result.ReviewType;
                        }
                        if (result.ReviewDate != null)
                        {
                            RadDatePickerReviewDate.SelectedDate = result.ReviewDate;
                        }
                        if (result.ReviewUserId != null)
                        {
                            var cUser = new CUser();
                            var user  = cUser.Get((int)result.ReviewUserId);
                            RadTextBoxReviewUser.Text = cUser.GetUserName(user);
                        }
                        RadDatePickerReviewDate.SelectedDate = result.ReviewDate;
                        RadTextBoxReviewMemo.Text            = result.ReviewMemo;
                        RadNumericTextBoxTax.Value           = (double)result.Tax;
                    }
                }
            }
        }
Пример #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Id = Convert.ToInt32(Request["id"]);

            if (!IsPostBack)
            {
                //var scriptManager = (RadScriptManager)Page.Master.FindControl("RadScriptManager1");
                //scriptManager.RegisterPostBackControl(RadButtonFileDownload);
                FileDownloadList1.InitFileDownloadList((int)CConstValue.Upload.BulletinBoard);

                // new
                if (Request["createOrListType"] == "0")
                {
                    var cUser = new CUser();
                    var user  = cUser.Get(CurrentUserId);
                    RadTextBoxUserName.Text        = cUser.GetUserName(user);
                    RadDatePickerDate.SelectedDate = DateTime.Today;
                }
                // select
                else
                {
                    var cBulletinBoard = new CBulletinBoard();
                    var bulletinBoard  = cBulletinBoard.Get(Id);

                    if (bulletinBoard != null)
                    {
                        var cUser = new CUser();
                        var user  = cUser.Get((int)bulletinBoard.CreatedId);
                        RadTextBoxUserName.Text        = cUser.GetUserName(user);
                        RadDatePickerDate.SelectedDate = bulletinBoard.CreatedDate;
                        RadTextBoxSubject.Text         = bulletinBoard.Subject;
                        RadEditorBody.Content          = bulletinBoard.Body;

                        // update views
                        bulletinBoard.Views++;
                        cBulletinBoard.Update(bulletinBoard);

                        // view
                        if (CurrentUserId != bulletinBoard.CreatedId)
                        {
                            RadTextBoxSubject.Enabled = false;
                            RadEditorBody.EditModes   = EditModes.Preview;
                            FileDownloadList1.SetVisibieUploadControls(false);


                            foreach (RadToolBarItem item in RadToolBar1.Items)
                            {
                                if (item.Text == "Save")
                                {
                                    item.Visible = false;
                                    break;
                                }
                            }
                        }
                    }

                    // UP LOAD
                    FileDownloadList1.GetFileDownload(Convert.ToInt32(Id));
                }
            }
        }
Пример #14
0
        protected void GetDepositDetail()
        {
            var buttonList = new List <string>();

            buttonList.Add("Add Deposit");
            buttonList.Add("Excel");

            if (RadGridDepositList.SelectedValue != null)
            {
                var cDeposit = new CDeposit();
                var deposit  = cDeposit.Get(Convert.ToInt32(RadGridDepositList.SelectedValue.ToString()));
                DepositInfomation1.SetData(deposit);

                FileDownloadList1.GetFileDownload(Convert.ToInt32(RadGridDepositList.SelectedValue));

                bool isChecked = false;
                switch (deposit.Status)
                {
                // Pending
                case 1:
                    if (CurrentUserId == deposit.CreatedId)
                    {
                        buttonList.Add("Modify Deposit");
                        buttonList.Add("Confirm");
                        buttonList.Add("Cancel");
                        isChecked = true;
                    }
                    break;

                // Created
                case 2:
                    if (CurrentGroupId == (int)CConstValue.UserGroupForDepositConfirm.Accounting)     //HQ
                    {
                        buttonList.Add("Confirm");
                    }
                    else
                    {
                        buttonList.Add("Cancel");
                    }
                    break;

                // Confirmed
                case 3:
                    if (CurrentGroupId == (int)CConstValue.UserGroupForDepositConfirm.Accounting)     //HQ
                    {
                        buttonList.Add("Cancel");
                    }
                    break;

                // cancel
                default:
                    if (CurrentGroupId == (int)CConstValue.UserGroupForDepositConfirm.Accounting)     //HQ
                    {
                        // nothing
                    }
                    else
                    {
                        buttonList.Add("Confirm");
                        isChecked = true;
                    }
                    break;
                }

                _radGridDepositPayment.ClientSettings.AllowRowsDragDrop  = isChecked;
                RadGridUnDepositPayment.ClientSettings.AllowRowsDragDrop = isChecked;
            }

            foreach (RadToolBarItem item in DepositInfoToolbar.Items)
            {
                if (buttonList.Contains(item.Text))
                {
                    item.Enabled = true;
                }
                else
                {
                    item.Enabled = false;
                }
            }

            _linqDataSourceDepositPayment.WhereParameters.Clear();
            LinqDataSourceUnDepositPayment.WhereParameters.Clear();
            if (RadGridDepositList.SelectedValue != null)
            {
                _linqDataSourceDepositPayment.WhereParameters.Add("DepositId", DbType.Int32, RadGridDepositList.SelectedValue.ToString());
                LinqDataSourceUnDepositPayment.WhereParameters.Add("SiteLocationId", DbType.Int32, CurrentSiteLocationId.ToString());
            }
            else
            {
                _linqDataSourceDepositPayment.WhereParameters.Add("DepositId", DbType.Int32, 0.ToString());
                LinqDataSourceUnDepositPayment.WhereParameters.Add("SiteLocationId", DbType.Int32, 0.ToString());
            }
            _linqDataSourceDepositPayment.Where  = "DepositId == @DepositId";
            LinqDataSourceUnDepositPayment.Where = "SiteLocationId == @SiteLocationId";
        }
Пример #15
0
        protected void RadGrid1_PreRender(object sender, EventArgs e)
        {
            if (ViewState["PromotionId"] != null)
            {
                foreach (GridDataItem item in RadGrid1.Items)
                {
                    if (item.GetDataKeyValue("PromotionId").ToString() == ViewState["PromotionId"].ToString())
                    {
                        if (item.Selected == false)
                        {
                            item.Selected = true;
                            break;
                        }
                    }
                }
            }

            SetApprovalList();
            GetStudent();
            GetPromotionHistory();

            FileDownloadList1.GetFileDownload(Convert.ToInt32(RadGrid1.SelectedValue));

            foreach (RadToolBarItem toolbarItem in RadToolBar1.Items)
            {
                if (RadGrid1.SelectedValue != null)
                {
                    var cPromotion = new CPromotion();
                    var promotion  = cPromotion.Get(Convert.ToInt32(RadGrid1.SelectedValue));

                    // request active check
                    if (toolbarItem.Text == "Request")
                    {
                        if ((promotion.ApprovalStatus == null || promotion.ApprovalStatus == (int)CConstValue.ApprovalStatus.Revise) && promotion.CreatedId == CurrentUserId)
                        {
                            toolbarItem.Enabled = true;
                        }
                        else
                        {
                            toolbarItem.Enabled = false;
                        }
                    }
                    else if (toolbarItem.Text == "Cancel")
                    {
                        if ((promotion.ApprovalStatus == null ||
                             promotion.ApprovalStatus == (int)CConstValue.ApprovalStatus.Revise ||
                             promotion.ApprovalStatus == (int)CConstValue.ApprovalStatus.Requested) && promotion.CreatedId == CurrentUserId)
                        {
                            toolbarItem.Enabled = true;
                        }
                        else
                        {
                            toolbarItem.Enabled = false;
                        }
                    }
                    else if (toolbarItem.Text == "Approve" || toolbarItem.Text == "Reject" || toolbarItem.Text == "Revise")
                    {
                        // approve active check
                        var refundApproveInfo = new CGlobal();
                        var supervisor        = refundApproveInfo.CheckApprovalEnable((int)CConstValue.Approval.Promotion, Convert.ToInt32(promotion.PromotionId));

                        // supervisor
                        if ((CurrentUserId == supervisor) &&
                            promotion.ApprovalStatus != (int)CConstValue.ApprovalStatus.Approved &&
                            promotion.ApprovalStatus != (int)CConstValue.ApprovalStatus.Rejected &&
                            promotion.ApprovalStatus != (int)CConstValue.ApprovalStatus.Canceled &&
                            promotion.ApprovalStatus != null &&
                            CurrentUserId != promotion.ApprovalId)
                        {
                            toolbarItem.Enabled = true;
                        }
                        else
                        {
                            toolbarItem.Enabled = false;
                        }
                    }
                }
                else
                {
                    if (toolbarItem.Text == "View" || toolbarItem.Text == "New Promotion")
                    {
                        continue;
                    }
                    toolbarItem.Enabled = false;
                }
            }
        }
Пример #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Id = Convert.ToInt32(Request["id"]);

            RadAsyncUpload asyncUpload = FileDownloadList1.GetAsyncUpload();

            asyncUpload.FileUploaded += HirePop_FileUploaded;

            if (!IsPostBack)
            {
                var scriptManager = (RadScriptManager)Page.Master.FindControl("RadScriptManager1");
                //scriptManager.Scripts.Add(new ScriptReference() { Path = ResolveUrl("~/assets/js/jquery.printArea.js") });
                //scriptManager.RegisterPostBackControl(RadButtonFileDownload);
                FileDownloadList1.InitFileDownloadList((int)CConstValue.Upload.Hire);

                var obj = new CHire();
                var requestOrApprovalType = Request["requestOrApprovalType"];
                var approvalType          = Request["approvalType"];

                var buttonList = new List <string>();

                // new
                if (Request["createOrListType"] == "0")
                {
                    obj = obj.GetNewDocument(CurrentUserId);

                    buttonList.Add("TempSave");
                    buttonList.Add("Request");
                    buttonList.Add("Close");

                    SetVisibleItems(true);
                }
                // select
                else
                {
                    FileDownloadList1.GetFileDownload(Convert.ToInt32(Id));

                    // date
                    obj = new CHire(Id);

                    // request list
                    if (requestOrApprovalType == "0")
                    {
                        // Revise
                        if (approvalType == ((int)CConstValue.ApprovalStatus.Revise).ToString())
                        {
                            buttonList.Add("Request");
                            buttonList.Add("Cancel");
                            buttonList.Add("Close");

                            SetVisibleItems(true);
                        }
                        // TempSave
                        else if (approvalType == string.Empty)
                        {
                            buttonList.Add("TempSave");
                            buttonList.Add("Request");
                            buttonList.Add("Cancel");
                            buttonList.Add("Close");

                            SetVisibleItems(true);
                        }
                        // Request
                        else if (approvalType == "1")
                        {
                            buttonList.Add("Cancel");
                            buttonList.Add("Close");

                            SetVisibleItems(false);
                        }
                        else
                        {
                            buttonList.Add("Close");

                            SetVisibleItems(false);
                        }
                    }
                    // approval
                    else if (requestOrApprovalType == "1")
                    {
                        // approved or rejected
                        if (approvalType == ((int)CConstValue.ApprovalStatus.Approved).ToString() ||
                            approvalType == ((int)CConstValue.ApprovalStatus.Rejected).ToString() ||
                            approvalType == ((int)CConstValue.ApprovalStatus.Canceled).ToString())
                        {
                            buttonList.Add("Close");
                        }
                        else
                        {
                            var refundApproveInfo = new CGlobal();
                            var supervisor        = refundApproveInfo.CheckApprovalEnable((int)CConstValue.Approval.Hire, Convert.ToInt32(Id));

                            if (CurrentUserId == supervisor)
                            {
                                buttonList.Add("Approve");
                                buttonList.Add("Reject");
                                buttonList.Add("Revise");
                                buttonList.Add("Close");
                            }
                            else
                            {
                                buttonList.Add("Close");
                            }
                        }

                        SetVisibleItems(false);
                    }
                    // Hire from HQ
                    else if (requestOrApprovalType == "2")
                    {
                        buttonList.Add("Print");
                        buttonList.Add("Cancel");
                        buttonList.Add("Close");

                        SetVisibleItems(false);
                    }
                }

                foreach (RadToolBarItem item in RadToolBar1.Items)
                {
                    if (buttonList.Contains(item.Text))
                    {
                        item.Visible = true;
                    }
                    else
                    {
                        item.Visible = false;
                    }
                }

                if (approvalType == ((int)CConstValue.ApprovalStatus.Approved).ToString())
                {
                    FileDownloadList1.SetVisibieUploadControls(true);
                    //if (FileDownloadList1.GetFileInfoCountForHire() == 0)
                    //    FileDownloadList1.SetVisibieUploadControls(true);
                    //else
                    //    FileDownloadList1.SetVisibieUploadControls(false);
                }
                else
                {
                    FileDownloadList1.SetVisibieUploadControls(false);
                }

                var dt = new DataTable();
                dt.Columns.Add("DocNo");
                dt.Columns.Add("DateOfIssue");
                dt.Columns.Add("DraftingDepartment");
                dt.Columns.Add("ShelfLife");
                var newDr = dt.NewRow();
                newDr["DocNo"]              = obj.DocNo;
                newDr["DateOfIssue"]        = obj.DateOfIssue;
                newDr["DraftingDepartment"] = obj.DraftingDepartment;
                newDr["ShelfLife"]          = obj.ShelfLife;
                dt.Rows.Add(newDr);

                RadGridInfo.DataSource = dt;

                // Get Data
                var hireObj = obj.Get(Id);
                if (hireObj != null)
                {
                    RadComboBoxDepartment.SelectedValue = hireObj.Department.ToString();
                    RadComboBoxGenre.SelectedValue      = hireObj.Genre.ToString();
                    RadComboBoxCondition.SelectedValue  = hireObj.Condition.ToString();

                    RadTextBoxJobTitle.Text        = hireObj.JobTitle;
                    RadTextBoxReasonForHiring.Text = hireObj.ReasonForHiring;
                    RadEditorDuties.Content        = hireObj.DutiesAndResponsibilities;
                    RadEditorSkills.Content        = hireObj.SkillsAndExperienceAndQualification;
                    RadTextBoxSalary.Text          = hireObj.SalaryOrWage;
                    RadTextBoxEmployment.Text      = hireObj.EmploymentCategory;
                    RadTextBoxHours.Text           = hireObj.HoursOrDaysOfWork;
                    RadEditorAdditional.Content    = hireObj.AdditionalComments;
                }
            }
        }
Пример #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Id = Convert.ToInt32(Request["id"]);

            if (!IsPostBack)
            {
                foreach (GridColumn v in RadGridFlight.Columns)
                {
                    if (v.GetType() == typeof(GridTemplateColumn))
                    {
                        var column = (GridTemplateColumn)v;
                        switch (column.UniqueName)
                        {
                        case "AirDate":
                            column.DefaultInsertValue = DateTime.Today.ToString("MM-dd-yyyy");
                            break;

                        case "Departure":
                            column.DefaultInsertValue = "12:00 AM";
                            break;
                        }
                    }
                }

                foreach (GridColumn v in RadGridAccommodation.Columns)
                {
                    if (v.GetType() == typeof(GridTemplateColumn))
                    {
                        var column = (GridTemplateColumn)v;
                        switch (column.UniqueName)
                        {
                        case "AccomIn":
                            column.DefaultInsertValue = DateTime.Today.ToString("MM-dd-yyyy");
                            break;

                        case "AccomOut":
                            column.DefaultInsertValue = DateTime.Today.ToString("MM-dd-yyyy");
                            break;
                        }
                    }
                }

                foreach (GridColumn v in RadGridCash.Columns)
                {
                    if (v.GetType() == typeof(GridTemplateColumn))
                    {
                        var column = (GridTemplateColumn)v;
                        switch (column.UniqueName)
                        {
                        case "CashDate":
                            column.DefaultInsertValue = DateTime.Today.ToString("MM-dd-yyyy");
                            break;

                        case "CashTime":
                            column.DefaultInsertValue = "12:00 AM";
                            break;
                        }
                    }
                }

                var scriptManager = (RadScriptManager)Page.Master.FindControl("RadScriptManager1");
                //scriptManager.Scripts.Add(new ScriptReference() { Path = ResolveUrl("~/assets/js/jquery.printArea.js") });
                //scriptManager.RegisterPostBackControl(RadButtonFileDownload);
                FileDownloadList1.InitFileDownloadList((int)CConstValue.Upload.BusinessTrip);

                var obj = new CBusinessTrip();
                var requestOrApprovalType = Request["requestOrApprovalType"];
                var approvalType          = Request["approvalType"];

                var buttonList = new List <string>();

                // new
                if (Request["createOrListType"] == "0")
                {
                    obj = obj.GetNewDocument(CurrentUserId);

                    buttonList.Add("TempSave");
                    buttonList.Add("Request");
                    buttonList.Add("Close");

                    SetVisibleItems(true);
                }
                // select
                else
                {
                    FileDownloadList1.GetFileDownload(Convert.ToInt32(Id));

                    // date
                    obj = new CBusinessTrip(Id);

                    // request list
                    if (requestOrApprovalType == "0")
                    {
                        // Revise
                        if (approvalType == ((int)CConstValue.ApprovalStatus.Revise).ToString())
                        {
                            buttonList.Add("Request");
                            buttonList.Add("Cancel");
                            buttonList.Add("Close");

                            SetVisibleItems(true);
                        }
                        // TempSave
                        else if (approvalType == string.Empty)
                        {
                            buttonList.Add("TempSave");
                            buttonList.Add("Request");
                            buttonList.Add("Cancel");
                            buttonList.Add("Close");

                            SetVisibleItems(true);
                        }
                        // Request
                        else if (approvalType == "1")
                        {
                            buttonList.Add("Cancel");
                            buttonList.Add("Close");

                            SetVisibleItems(false);
                        }
                        else
                        {
                            buttonList.Add("Close");
                            SetVisibleItems(false);
                        }
                    }
                    // approval
                    else if (requestOrApprovalType == "1")
                    {
                        // approved or rejected
                        if (approvalType == ((int)CConstValue.ApprovalStatus.Approved).ToString() ||
                            approvalType == ((int)CConstValue.ApprovalStatus.Rejected).ToString() ||
                            approvalType == ((int)CConstValue.ApprovalStatus.Canceled).ToString())
                        {
                            buttonList.Add("Close");
                        }
                        else
                        {
                            var refundApproveInfo = new CGlobal();
                            var supervisor        = refundApproveInfo.CheckApprovalEnable((int)CConstValue.Approval.BusinessTrip, Convert.ToInt32(Id));

                            if (CurrentUserId == supervisor)
                            {
                                buttonList.Add("Approve");
                                buttonList.Add("Reject");
                                buttonList.Add("Revise");
                                buttonList.Add("Close");
                            }
                            else
                            {
                                buttonList.Add("Close");
                            }
                        }

                        SetVisibleItems(false);
                    }
                    // Hire from HQ
                    else if (requestOrApprovalType == "2")
                    {
                        // Wating for review from HQ
                        if (approvalType == ((int)CConstValue.ApprovalStatus.WaitingForPreviewFromHq).ToString())
                        {
                            buttonList.Add("Accept");
                            buttonList.Add("Reject");
                            buttonList.Add("Close");
                        }
                        // In progress
                        else if (approvalType == ((int)CConstValue.ApprovalStatus.InProgress).ToString())
                        {
                            buttonList.Add("Print");
                            buttonList.Add("Complete");
                            buttonList.Add("Reject");
                            buttonList.Add("Close");
                        }
                        // Approved
                        else if (approvalType == ((int)CConstValue.ApprovalStatus.Approved).ToString())
                        {
                            buttonList.Add("Print");
                            buttonList.Add("Close");
                        }
                        else
                        {
                            buttonList.Add("Close");
                        }

                        SetVisibleItems(false);
                    }
                }

                foreach (RadToolBarItem item in RadToolBar1.Items)
                {
                    if (buttonList.Contains(item.Text))
                    {
                        item.Visible = true;
                    }
                    else
                    {
                        item.Visible = false;
                    }
                }

                // new or temp
                if (approvalType == "0" || approvalType == string.Empty)
                {
                    FileDownloadList1.SetVisibieUploadControls(true);
                }
                else
                {
                    FileDownloadList1.SetVisibieUploadControls(false);
                }

                // radio
                if (obj.TypeOfTrip != null)
                {
                    if (obj.TypeOfTrip.ToLower() == "local")
                    {
                        RadButtonOverseas.Checked = false;
                        RadButtonLocal.Checked    = true;
                    }
                    else
                    {
                        RadButtonLocal.Checked    = false;
                        RadButtonOverseas.Checked = true;
                    }
                }

                var dt = new DataTable();
                dt.Columns.Add("DocNo");
                dt.Columns.Add("Site");
                dt.Columns.Add("Location");
                dt.Columns.Add("Name");
                dt.Columns.Add("Date");
                var newDr = dt.NewRow();
                newDr["DocNo"]    = obj.DocNo.ToString();
                newDr["Site"]     = obj.Site;
                newDr["Location"] = obj.Location;
                newDr["Name"]     = obj.Name1;
                newDr["Date"]     = obj.Name2;
                dt.Rows.Add(newDr);

                RadGridInfo.DataSource = dt;
            }
        }
Пример #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Id = Convert.ToInt32(Request["id"]);

            if (!IsPostBack)
            {
                FileDownloadList1.InitFileDownloadList((int)CConstValue.Upload.Inventory);

                var buttonList = new List <string>();

                // new
                if (Request["createOrListType"] == "0")
                {
                    buttonList.Add("Save");
                    buttonList.Add("Close");
                }
                // select
                else
                {
                    buttonList.Add("Save");
                    buttonList.Add("Print");
                    buttonList.Add("Close");
                }

                foreach (RadToolBarItem item in RadToolBar1.Items)
                {
                    if (buttonList.Contains(item.Text))
                    {
                        item.Visible = true;
                    }
                    else
                    {
                        item.Visible = false;
                    }
                }

                LoadInventoryCategory();
                if (!string.IsNullOrEmpty(RadComboBoxInventoryCategory.SelectedValue))
                {
                    LoadInventoryCategoryItem(Convert.ToInt32(RadComboBoxInventoryCategory.SelectedValue));
                }

                LoadSite();
                LoadSiteLocation(CurrentSiteId);
                LoadAssignedUser(CurrentSiteLocationId);

                LoadInUse();
                LoadCondition();

                var inventory = new CInventory().Get(Id);
                if (inventory != null)
                {
                    var inventoryCategoryItem = new CInventoryCategoryItem().Get(inventory.InventoryCategoryItemId);
                    RadComboBoxInventoryCategory.SelectedValue     = inventoryCategoryItem.InventoryCategoryId.ToString();
                    RadComboBoxInventoryCategoryItem.SelectedValue = inventory.InventoryCategoryItemId.ToString();

                    var siteLocation = new CSiteLocation().Get(inventory.SiteLocationId);
                    RadComboBoxSite.SelectedValue         = siteLocation.SiteId.ToString();
                    RadComboBoxSiteLocation.SelectedValue = inventory.SiteLocationId.ToString();

                    RadComboBoxAssignedUser.SelectedValue = inventory.AssignedUserId.ToString();

                    RadComboBoxInUse.SelectedValue     = inventory.InUseType.ToString();
                    RadComboBoxCondition.SelectedValue = inventory.ConditionType.ToString();

                    RadTextBoxCompany.Text              = inventory.Company;
                    RadNumericTextBoxPrice.Value        = (double)inventory.Price;
                    RadDatePickerPurchased.SelectedDate = inventory.PurchasedDate?.Date;
                    RadDatePickerExpire.SelectedDate    = inventory.ExpireDate?.Date;
                    RadTextBoxDepartment.Text           = inventory.Company;
                    RadTextBoxModelNo.Text              = inventory.ModelNo;
                    RadTextBoxSerialNo.Text             = inventory.SerialNo;

                    FileDownloadList1.GetFileDownload(Convert.ToInt32(Id));
                }
            }
        }
Пример #19
0
        public void GetCreditMemoPayoutInfo()
        {
            // toolbar
            foreach (RadToolBarItem toolbarItem in RadToolBarCreditMemo.Items)
            {
                if (toolbarItem.Text == "Disbursement")
                {
                    if (RadGridCreditMemo.SelectedValue != null)
                    {
                        var creditMemo = new CCreditMemo().GetVwCreditMemo(Convert.ToInt32(RadGridCreditMemo.SelectedValue));
                        if (creditMemo != null)
                        {
                            var  cCreditMemoPayout     = new CCreditMemoPayout();
                            var  creditMemoPayoutList  = cCreditMemoPayout.GetCreditMemoPayoutList(creditMemo.CreditMemoId);
                            bool hasNullOfDisbursement = false;
                            foreach (var c in creditMemoPayoutList)
                            {
                                if (c.Disbursement == false && c.ApprovalStatus == (int)CConstValue.ApprovalStatus.Approved)
                                {
                                    toolbarItem.Enabled   = true;
                                    hasNullOfDisbursement = true;
                                    break;
                                }
                            }

                            if (hasNullOfDisbursement == false)
                            {
                                toolbarItem.Enabled = false;
                            }
                        }
                        else
                        {
                            toolbarItem.Enabled = false;
                        }
                    }
                    else
                    {
                        toolbarItem.Enabled = false;
                    }
                }
                else
                {
                    if (toolbarItem.Text == "View Invoice" || toolbarItem.Text == "View Payment" || toolbarItem.Text == "View Deposit" ||
                        toolbarItem.Text == "Student Page" || toolbarItem.Text == "Invoice Page" || toolbarItem.Text == "Payment Page" ||
                        toolbarItem.Text == "Deposit Page" || toolbarItem.Text == "Refund Page" || toolbarItem.Text == "Excel")
                    {
                        continue;
                    }

                    toolbarItem.Enabled = false;
                }
            }

            // toolbar
            foreach (RadToolBarItem toolbarItem in RadToolBarCreditMemoPayout.Items)
            {
                if (toolbarItem.Text == "New Payout")
                {
                    if (RadGridCreditMemo.SelectedValue != null)
                    {
                        toolbarItem.Enabled = true;
                    }
                    else
                    {
                        toolbarItem.Enabled = false;
                    }
                }
            }

            if (RadGridCreditMemoPayout.SelectedValue != null)
            {
                var cCreditMemoPayout = new CCreditMemoPayout();
                var creditMemoPayout  = cCreditMemoPayout.Get(Convert.ToInt32(RadGridCreditMemoPayout.SelectedValue));
                CreditMemoPayout1.SetData(creditMemoPayout);

                // toolbar
                foreach (RadToolBarItem toolbarItem in RadToolBarCreditMemoPayout.Items)
                {
                    // request active check
                    if (toolbarItem.Text == "Request")
                    {
                        if ((creditMemoPayout.ApprovalStatus == null || creditMemoPayout.ApprovalStatus == (int)CConstValue.ApprovalStatus.Revise) && creditMemoPayout.CreatedId == CurrentUserId)
                        {
                            toolbarItem.Enabled = true;
                        }
                        else
                        {
                            toolbarItem.Enabled = false;
                        }
                    }
                    else if (toolbarItem.Text == "Cancel")
                    {
                        if ((creditMemoPayout.ApprovalStatus == null ||
                             creditMemoPayout.ApprovalStatus == (int)CConstValue.ApprovalStatus.Revise ||
                             creditMemoPayout.ApprovalStatus == (int)CConstValue.ApprovalStatus.Requested) && creditMemoPayout.CreatedId == CurrentUserId)
                        {
                            toolbarItem.Enabled = true;
                        }
                        else
                        {
                            toolbarItem.Enabled = false;
                        }
                    }
                    else if (toolbarItem.Text == "Approve" || toolbarItem.Text == "Reject" || toolbarItem.Text == "Revise")
                    {
                        // approve active check
                        var refundApproveInfo = new CGlobal();
                        var supervisor        = refundApproveInfo.CheckApprovalEnable((int)CConstValue.Approval.CreditMemoPayout, Convert.ToInt32(RadGridCreditMemoPayout.SelectedValue));

                        // supervisor or loy employees
                        if ((CurrentUserId == supervisor) &&
                            creditMemoPayout.ApprovalStatus != (int)CConstValue.ApprovalStatus.Approved &&
                            creditMemoPayout.ApprovalStatus != (int)CConstValue.ApprovalStatus.Rejected &&
                            creditMemoPayout.ApprovalStatus != (int)CConstValue.ApprovalStatus.Canceled &&
                            creditMemoPayout.ApprovalStatus != null &&
                            CurrentUserId != creditMemoPayout.ApprovalId)
                        {
                            toolbarItem.Enabled = true;
                        }
                        else
                        {
                            toolbarItem.Enabled = false;
                        }
                    }
                }

                foreach (RadToolBarItem toolbarItem in RadToolBarCreditMemoPayoutHistory.Items)
                {
                    if (toolbarItem.Text == "Add Payout")
                    {
                        if (creditMemoPayout.ApprovalStatus == (int)CConstValue.ApprovalStatus.Approved &&
                            creditMemoPayout.Disbursement &&
                            (CurrentGroupId == (int)CConstValue.UserGroupForCreditPayoutHistory.Accounting ||
                             CurrentGroupId == (int)CConstValue.UserGroupForCreditPayoutHistory.IT))
                        {
                            toolbarItem.Enabled = true;
                        }
                        else
                        {
                            toolbarItem.Enabled = false;
                        }
                    }
                    else if (toolbarItem.Text == "Payout Reverse")
                    {
                        if (CurrentGroupId == (int)CConstValue.UserGroupForCreditPayoutHistory.Accounting ||
                            CurrentGroupId == (int)CConstValue.UserGroupForCreditPayoutHistory.IT)
                        {
                            toolbarItem.Enabled = true;
                        }
                        else
                        {
                            toolbarItem.Enabled = false;
                        }
                    }
                }

                // get DownloadList
                FileDownloadList1.GetFileDownload(Convert.ToInt32(RadGridCreditMemoPayout.SelectedValue));
            }
            else
            {
                foreach (RadToolBarItem toolbarItem in RadToolBarCreditMemoPayoutHistory.Items)
                {
                    toolbarItem.Enabled = false;
                }

                // get DownloadList
                FileDownloadList1.GetFileDownload(0);
            }

            RefreshApprovalList();
        }