Ejemplo n.º 1
0
        private void comboBoxName_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (comboBoxName.Text.Length > 0)
                {
                    char[] del = { ' ', '(', ')' };

                    string s = comboBoxName.Text.Trim();

                    string[] words = s.Split(del);

                    clPlayer = new CPlayer(connect, words[0].Trim(), words[1].Trim(), words[3].Trim());
                    CEntryPlayers cl = new CEntryPlayers(connect);

                    int idt = cl.IsEntryPlayer(IS.idseason, clPlayer.stPlayer.idplayer);


                    if (idt != 0)
                    {
                        CTeam tm = new CTeam(connect, idt);
                        labelIsDemind.ForeColor = Color.Red;
                        labelIsDemind.Text      = string.Format("{0}", tm.stTeam.name);
                    }
                    else
                    {
                        labelIsDemind.ForeColor = Color.DarkGreen;
                        labelIsDemind.Text      = "свободен";
                    }


                    string str1 = string.Format("{0} {1} {2}", clPlayer.stPlayer.family, clPlayer.stPlayer.name,
                                                clPlayer.stPlayer.payname);

                    labelFIO.Text = str1;

                    CAge age = new CAge();

                    if (clPlayer.stPlayer.datebirth != null)
                    {
                        DateTime dte = (DateTime)clPlayer.stPlayer.datebirth;
                        string   sm  = age.GetFullAge(dte, datein);

                        string str2 = string.Format("{0}, {1}", dte.ToLongDateString(), sm);

                        labelDate.Text = str2;
                    }

                    CCountry clCountry = new CCountry(connect);

                    string str3 = string.Format("{0}, {1}", clPlayer.stPlayer.personalnum,
                                                clCountry.stCountry.shortname);

                    labelPersNum.Text = str3;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }
        }
Ejemplo n.º 2
0
        private void init_data()
        {
            string   text;
            DateTime dt;

            CCountry clCo = new CCountry(connect);

            g_f = false;

            try
            {
                dataGridViewCoach.Rows.Clear();

                list = new List <STCoach>();

                list = clCoach.GetList();

                if (list.Count > 0)
                {
                    g_f = true;

                    dataGridViewCoach.Rows.Add(list.Count);

                    for (int i = 0; i < list.Count; i++)
                    {
                        dataGridViewCoach.Rows[i].Cells[0].Value = (i + 1).ToString();

                        text = list[i].family + " " + list[i].name + " " + list[i].payname;
                        dataGridViewCoach.Rows[i].Cells[1].Value = text;

                        if (list[i].datebirth != null)
                        {
                            dt = (DateTime)list[i].datebirth;
                            dataGridViewCoach.Rows[i].Cells[2].Value = dt.ToShortDateString();
                        }

                        dataGridViewCoach.Rows[i].Cells[3].Value = list[i].personalnum;

                        if (list[i].idcountry != null)
                        {
                            clCo = new CCountry(connect, (int)list[i].idcountry);
                            dataGridViewCoach.Rows[i].Cells[4].Value = clCo.stCountry.shortname;
                        }

                        dataGridViewCoach.Rows[i].Cells[5].Value = list[i].namefoto;

                        dataGridViewCoach.Rows[i].Cells[6].Value = list[i].idcoach.ToString();

                        dataGridViewCoach.Rows[i].Cells[7].Value = list[i].descript;
                    }

                    dataGridViewCoach.AllowUserToAddRows = false;
                }

                toolStripStatusLabel1.Text = string.Format("Число тренеров: {0}", list.Count);
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // find user control
            _radGridInvoiceItems = InvoiceItemGrid1.GetRadGridInvoiceItems();
            // connect event of invoice Items.
            _radGridInvoiceItems.PreRender += _radGridInvoiceItems_PreRender;
            _radGridInvoiceItems.MasterTableView.DataSourceID = null;
            _radGridInvoiceItems.DataSourceID = null;
            // just view
            InvoiceItemGrid1.SetEditMode(false);

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

            if (!IsPostBack)
            {
                var global   = new CGlobal();
                var cStudent = new CStudent();
                var student  = cStudent.Get(Id);

                var studentSite = new CSiteLocation().Get(student.SiteLocationId);

                StudentSiteId         = studentSite.SiteId;
                StudentSiteLocationId = student.SiteLocationId;

                LoadAgency();
                LoadFaculty();
                LoadProgramGroup("0");
                LoadProgram("0");

                ddlProgramWeeks.DataSource     = new CProgram().GetProgramWeeksList();
                ddlProgramWeeks.DataTextField  = "Name";
                ddlProgramWeeks.DataValueField = "Value";
                ddlProgramWeeks.DataBind();

                ddlPrgHours.DataSource     = global.GetDictionary(150);
                ddlPrgHours.DataTextField  = "Name";
                ddlPrgHours.DataValueField = "Value";
                ddlPrgHours.DataBind();


                var cCountry       = new CCountry().Get((int)student.CountryId);
                var cCountryMarket = new CCountryMarket().Get((int)cCountry.CountryMarketId);
                ViewState["CountryMarketId"] = cCountry.CountryMarketId;

                ttName1.Text = cStudent.GetStudentName(student) + " [" + student.StudentNo + "]";
                ttName2.Text = cCountryMarket.Name;
            }

            ddlAgency.OpenDropDownOnLoad       = false;
            ddlFaculty.OpenDropDownOnLoad      = false;
            ddlProgramGrp.OpenDropDownOnLoad   = false;
            ddlProgramName.OpenDropDownOnLoad  = false;
            ddlProgramWeeks.OpenDropDownOnLoad = false;
            ddlPrgHours.OpenDropDownOnLoad     = false;
        }
Ejemplo n.º 4
0
 private void RClassSummary_ItemDataBinding(object sender, EventArgs e)
 {
     try
     {
         Telerik.Reporting.Processing.Report rpt = (Telerik.Reporting.Processing.Report)sender;
         var country = new CCountry().Get(Convert.ToInt32(rpt.Parameters["CountryId"].Value));
         htmlTextBoxCountry.Value = "<b>Student numbers in classes : </b>" + country?.Name;
     }
     catch (Exception ex)
     {
         Debug.Print(ex.Message);
     }
 }
Ejemplo n.º 5
0
        private void init_list()
        {
            dataGridViewRegion.Rows.Clear();

            list = clRegion.GetListRegion();

            CCountry country;

            try
            {
                if (list.Count > 0)
                {
                    g_f = true;

                    dataGridViewRegion.Rows.Add(list.Count);

                    for (int i = 0; i < list.Count; i++)
                    {
                        dataGridViewRegion.Rows[i].Cells[0].Value = (i + 1).ToString();

                        dataGridViewRegion.Rows[i].Cells[1].Value = list[i].name;

                        dataGridViewRegion.Rows[i].Cells[2].Value = list[i].shortname;

                        country = new CCountry(connect, list[i].idcountry);
                        dataGridViewRegion.Rows[i].Cells[3].Value = country.stCountry.shortname;

                        if (flawour.Equals(list[i]))
                        {
                            gpos = i;
                        }
                    }

                    dataGridViewRegion.AllowUserToAddRows = false;
                }
                else
                {
                    dataGridViewRegion.AllowUserToAddRows = false;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // find user control
            _radGridInvoiceItems = InvoiceItemGrid1.GetRadGridInvoiceItems();
            // connect event of invoice Items.
            _radGridInvoiceItems.PreRender += _radGridInvoiceItems_PreRender;
            _radGridInvoiceItems.MasterTableView.DataSourceID = null;
            _radGridInvoiceItems.DataSourceID = null;
            // just view
            InvoiceItemGrid1.SetEditMode(false);

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

            if (!IsPostBack)
            {
                var cStudent = new CStudent();
                var student  = cStudent.Get(Id);

                LoadAgency(student.SiteLocationId);
                var cCountry       = new CCountry().Get((int)student.CountryId);
                var cCountryMarket = new CCountryMarket().Get((int)cCountry.CountryMarketId);
                ViewState["CountryMarketId"] = cCountry.CountryMarketId;

                ttName1.Text = cStudent.GetStudentName(student) + " [" + student.StudentNo + "]";
                ttName2.Text = cCountryMarket.Name;

                // Package Program
                ddlPackageProgram.DataSource     = new CPackageProgram().GetPackageProgramBySiteIdAndCountryId(student.SiteLocationId);
                ddlPackageProgram.DataTextField  = "Name";
                ddlPackageProgram.DataValueField = "Value";
                ddlPackageProgram.DataBind();
                if (ddlPackageProgram.Items.Count > 0)
                {
                    SetPackageProgramData(ddlPackageProgram.Items[0].Value);
                }
            }

            ddlPackageProgram.OpenDropDownOnLoad = false;
        }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            InvoiceId = Convert.ToInt32(Request["id"]);

            if (!IsPostBack)
            {
                FileDownloadList1.InitFileDownloadList((int)CConstValue.Upload.ProgramChange);
                RefundInfo1.InitReundInfo(InvoiceId, CurrentSiteLocationId, true);


                /////////////////
                var global = new CGlobal();

                var student = new CStudent().Get(InvoiceId);

                LoadAgency(student.SiteLocationId);
                ddlAgencyContact.Items.Insert(0, new RadComboBoxItem("-None-", "0"));
                LoadFaculty();
                LoadProgramGroup("0");
                LoadProgram("0");

                var cCountry = new CCountry().Get((int)student.CountryId);
                ViewState["CountryMarketId"] = cCountry.CountryMarketId;

                tbRequestDate.SelectedDate = DateTime.Now;

                ddlProgramWeeks.DataSource     = GetProgramWeeksList();
                ddlProgramWeeks.DataTextField  = "Name";
                ddlProgramWeeks.DataValueField = "Value";
                ddlProgramWeeks.DataBind();
                ddlProgramWeeks.Items.Insert(0, new RadComboBoxItem("-Select Weeks-", "0"));

                ddlPrgHours.DataSource     = global.GetDictionary(150);
                ddlPrgHours.DataTextField  = "Name";
                ddlPrgHours.DataValueField = "Value";
                ddlPrgHours.DataBind();
                ddlPrgHours.Items.Insert(0, new RadComboBoxItem("-Select HRS-", "0"));
            }
        }
Ejemplo n.º 8
0
        private STPlayer read_data()
        {
            STPlayer ret = new STPlayer();

            CCountry clCo;

            try
            {
                ret.idplayer = gid;

                if (textBoxFamily.Text.Length > 0)
                {
                    ret.family = textBoxFamily.Text;
                }
                else
                {
                    ret.family = null;
                }

                if (textBoxName.Text.Length > 0)
                {
                    ret.name = textBoxName.Text;
                }
                else
                {
                    ret.name = null;
                }

                if (textBoxSecondName.Text.Length > 0)
                {
                    ret.payname = textBoxSecondName.Text;
                }
                else
                {
                    ret.payname = null;
                }

                ret.datebirth = new DateTime(dateTimePickerDateBirth.Value.Year,
                                             dateTimePickerDateBirth.Value.Month, dateTimePickerDateBirth.Value.Day, 0, 0, 0, 0);

                if (textBoxPersonalNum.Text.Length > 0)
                {
                    ret.personalnum = textBoxPersonalNum.Text;
                }
                else
                {
                    ret.personalnum = null;
                }

                if (comboBoxCountry.Text.Length > 0)
                {
                    string c = comboBoxCountry.Text;

                    clCo = new CCountry(connect, c);

                    ret.idcountry = clCo.stCountry.id;
                }
                else
                {
                    ret.idcountry = 0;
                }

                if (labelNameFoto.Text.Length > 0)
                {
                    ret.namefoto = labelNameFoto.Text.Trim();
                }
                else
                {
                    ret.namefoto = null;
                }

                if (textBoxDescript.Text.Length > 0)
                {
                    ret.descript = textBoxDescript.Text;
                }
                else
                {
                    ret.descript = null;
                }

                if (textBoxFotoWeb.Text.Length > 0)
                {
                    ret.fotoweb = textBoxFotoWeb.Text.Trim();
                }
                else
                {
                    ret.fotoweb = null;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }

            return(ret);
        }
Ejemplo n.º 9
0
        private void set_data()
        {
            CCountry clCo;

            try
            {
                textBoxId.Text = gid.ToString();

                if (gstReferee.idref != 0)
                {
                    textBoxFamily.Text = gstReferee.family;
                    textBoxName.Text   = gstReferee.name;
                    if (gstReferee.payname != null)
                    {
                        textBoxSecondName.Text = gstReferee.payname;
                    }
                    if (gstReferee.datebirth != null)
                    {
                        dateTimePickerDateBirth.Value = (DateTime)gstReferee.datebirth;
                    }
                    if (gstReferee.category != null)
                    {
                        comboBoxCategory.Text = gstReferee.category;
                    }

                    textBoxPersonalNum.Text = gstReferee.personalnum;

                    if (gstReferee.idcountry != null)
                    {
                        clCo = new CCountry(connect, (int)gstReferee.idcountry);
                        comboBoxCountry.Text = clCo.stCountry.shortname;
                    }

                    if (gstReferee.descript != null)
                    {
                        textBoxDescript.Text = gstReferee.descript;
                    }

                    if (gstReferee.namefoto != null && gstReferee.namefoto.Length > 0)
                    {
                        string pathfoto = string.Format("{0}\\{1}", clParam.s_Path.pathfoto, gstReferee.namefoto);

                        FileInfo fi = new FileInfo(pathfoto);
                        if (fi.Exists)
                        {
                            labelNameFoto.Text = gstReferee.namefoto;

                            Bitmap bt = new Bitmap(pathfoto);
                            pictureBoxFoto.Image = bt;;
                        }
                        else
                        {
                            MessageBox.Show(string.Format("‘айл {0} не найден", pathfoto),
                                            "¬нимание!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }

                    if (gstReferee.vf == 1)
                    {
                        checkBoxVisible.Checked = true;
                    }
                    else
                    {
                        checkBoxVisible.Checked = false;
                    }

                    if (gstReferee.tax != null)
                    {
                        textBoxTax.Text = ((double)gstReferee.tax).ToString("f2");
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }
        }
Ejemplo n.º 10
0
        private STReferee read_data()
        {
            STReferee ret = new STReferee();

            CCountry clCo;

            try
            {
                ret.idref = gid;

                if (textBoxFamily.Text.Length > 0)
                {
                    ret.family = textBoxFamily.Text;
                }
                else
                {
                    ret.family = null;
                }

                if (textBoxName.Text.Length > 0)
                {
                    ret.name = textBoxName.Text;
                }
                else
                {
                    ret.name = null;
                }

                if (textBoxSecondName.Text.Length > 0)
                {
                    ret.payname = textBoxSecondName.Text;
                }
                else
                {
                    ret.payname = null;
                }

                if (comboBoxCategory.Text.Length > 0)
                {
                    ret.category = comboBoxCategory.Text;
                }
                else
                {
                    ret.category = null;
                }

                ret.datebirth = new DateTime(dateTimePickerDateBirth.Value.Year,
                                             dateTimePickerDateBirth.Value.Month, dateTimePickerDateBirth.Value.Day, 0, 0, 0, 0);

                if (textBoxPersonalNum.Text.Length > 0)
                {
                    ret.personalnum = textBoxPersonalNum.Text;
                }
                else
                {
                    ret.personalnum = null;
                }

                if (comboBoxCountry.Text.Length > 0)
                {
                    string c = comboBoxCountry.Text;

                    clCo = new CCountry(connect, c);

                    ret.idcountry = clCo.stCountry.id;
                }
                else
                {
                    ret.idcountry = 0;
                }

                if (labelNameFoto.Text.Length > 0)
                {
                    ret.namefoto = labelNameFoto.Text.Trim();
                }
                else
                {
                    ret.namefoto = null;
                }

                if (textBoxDescript.Text.Length > 0)
                {
                    ret.descript = textBoxDescript.Text;
                }
                else
                {
                    ret.descript = null;
                }

                if (checkBoxVisible.Checked == true)
                {
                    ret.vf = 1;
                }
                else
                {
                    ret.vf = 0;
                }

                if (!string.IsNullOrEmpty(textBoxTax.Text.Trim()))
                {
                    double dbl = 0;
                    string s   = string.Format("{0:f2}", textBoxTax.Text.Trim());
                    double.TryParse(s, out dbl);
                    ret.tax = dbl;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }

            return(ret);
        }
Ejemplo n.º 11
0
        private STParticipant read_data()
        {
            STParticipant ret = new STParticipant();

            CCountry clCo;

            try
            {
                ret.idpart = gid;

                if (textBoxFamily.Text.Length > 0)
                {
                    ret.family = textBoxFamily.Text;
                }
                else
                {
                    ret.family = null;
                }

                if (textBoxName.Text.Length > 0)
                {
                    ret.name = textBoxName.Text;
                }
                else
                {
                    ret.name = null;
                }

                if (textBoxSecondName.Text.Length > 0)
                {
                    ret.payname = textBoxSecondName.Text;
                }
                else
                {
                    ret.payname = null;
                }

                ret.datebirth = new DateTime(dateTimePickerDateBirth.Value.Year,
                                             dateTimePickerDateBirth.Value.Month, dateTimePickerDateBirth.Value.Day, 0, 0, 0, 0);

                if (checkBoxNBL.CheckState == CheckState.Checked)
                {
                    ret.adminflag = 1;
                }
                else
                {
                    ret.adminflag = 0;
                }

                if (textBoxPersonalNum.Text.Length > 0)
                {
                    ret.personalnum = textBoxPersonalNum.Text;
                }
                else
                {
                    ret.personalnum = null;
                }

                if (comboBoxCountry.Text.Length > 0)
                {
                    string c = comboBoxCountry.Text;

                    clCo = new CCountry(connect, c);

                    ret.idcountry = clCo.stCountry.id;
                }
                else
                {
                    ret.idcountry = 0;
                }

                if (labelNameFoto.Text.Length > 0)
                {
                    ret.namefoto = labelNameFoto.Text.Trim();
                }
                else
                {
                    ret.namefoto = null;
                }

                if (textBoxDescript.Text.Length > 0)
                {
                    ret.descript = textBoxDescript.Text;
                }
                else
                {
                    ret.descript = null;
                }

                if (checkBoxVisible.Checked == true)
                {
                    ret.vf = 1;
                }
                else
                {
                    ret.vf = 0;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }

            return(ret);
        }
Ejemplo n.º 12
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);
        }
    }
Ejemplo n.º 13
0
        public void GetInvoiceItems()
        {
            var btnConfirm          = RadToolBar1.FindItemByText("Confirm");
            var btnModify           = RadToolBar1.FindItemByText("Modify");
            var btnCancel           = RadToolBar1.FindItemByText("Cancel");
            var btnStudentInvoice   = RadToolBar1.FindItemByText("Student Invoice");
            var btnAgencyInvoice    = RadToolBar1.FindItemByText("Agency Invoice");
            var btnNewSimpleInvoice = RadToolBar1.FindItemByText("New Simple Invoice");

            if (RadGridInvoice.SelectedValue == null)
            {
                _sqlDataSourceInvoiceItems.WhereParameters.Clear();
                _sqlDataSourceInvoiceItems.WhereParameters.Add("InvoiceId", DbType.Int32, "0");
                _sqlDataSourceInvoiceItems.Where = "InvoiceId == @InvoiceId";

                LinqDataSourceInvoiceHistory.WhereParameters.Clear();
                LinqDataSourceInvoiceHistory.WhereParameters.Add("InvoiceId", DbType.Int32, "0");
                LinqDataSourceInvoiceHistory.Where = "InvoiceId == @InvoiceId";
            }
            else
            {
                var cInvoice = new CInvoice();
                var invoice  = cInvoice.Get(Convert.ToInt32(RadGridInvoice.SelectedValue.ToString()));

                _sqlDataSourceInvoiceItems.WhereParameters.Clear();
                _sqlDataSourceInvoiceItems.WhereParameters.Add("InvoiceId", DbType.Int32, RadGridInvoice.SelectedValue.ToString());
                _sqlDataSourceInvoiceItems.Where = "InvoiceId == @InvoiceId";

                if (invoice.OriginalInvoiceId != null)
                {
                    LinqDataSourceInvoiceHistory.WhereParameters.Clear();
                    LinqDataSourceInvoiceHistory.WhereParameters.Add("InvoiceId", DbType.Int32, invoice.InvoiceId.ToString());
                    LinqDataSourceInvoiceHistory.WhereParameters.Add("InvoiceNumber", DbType.String, invoice.InvoiceNumber.Substring(2, 8));
                    LinqDataSourceInvoiceHistory.WhereParameters.Add("InvoicePartialIndex", DbType.Int32, invoice.InvoicePartialIndex.ToString());
                    LinqDataSourceInvoiceHistory.Where = "InvoiceId != @InvoiceId && InvoiceNumber.Contains(@InvoiceNumber) && InvoicePartialIndex < @InvoicePartialIndex";
                }
                else
                {
                    LinqDataSourceInvoiceHistory.WhereParameters.Clear();
                    LinqDataSourceInvoiceHistory.WhereParameters.Add("OriginalInvoiceId", DbType.Int32, "0");
                    LinqDataSourceInvoiceHistory.Where = "InvoiceId == @OriginalInvoiceId";
                }

                ddlFG.SelectedValue = invoice.IsFinancialGurantee.ToString();

                var status      = Convert.ToInt32(invoice.Status);
                var invoiceType = Convert.ToInt32(invoice.InvoiceType);
                var delete      = _radGridInvoiceItems.MasterTableView.GetColumn("DeleteColumn");
                if (status == (int)CConstValue.InvoiceStatus.Pending)
                {
                    switch (invoiceType)
                    {
                    case (int)CConstValue.InvoiceType.Simple:
                    case (int)CConstValue.InvoiceType.General:
                    case (int)CConstValue.InvoiceType.Manual:
                    case (int)CConstValue.InvoiceType.Dormitory:
                    case (int)CConstValue.InvoiceType.Homestay:
                        btnConfirm.Enabled        = true;
                        btnModify.Enabled         = false;
                        btnCancel.Enabled         = true;
                        btnStudentInvoice.Enabled = true;
                        btnAgencyInvoice.Enabled  = true;
                        _radGridInvoiceItems.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
                        _radGridInvoiceItems.MasterTableView.EditMode           = GridEditMode.Batch;
                        delete.Visible = true;
                        ddlFG.Enabled  = true;
                        break;

                    default:
                        btnConfirm.Enabled        = false; //Confirm
                        btnModify.Enabled         = false; //Modify
                        btnCancel.Enabled         = false; //Cancel
                        btnStudentInvoice.Enabled = true;  //Student Invoice Print
                        btnAgencyInvoice.Enabled  = true;  //Agency Invoice Print
                        _radGridInvoiceItems.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
                        _radGridInvoiceItems.MasterTableView.EditMode           = GridEditMode.InPlace;
                        delete.Visible = false;
                        ddlFG.Enabled  = false;
                        break;
                    }
                }
                else if (status == (int)CConstValue.InvoiceStatus.Invoiced) //Invoiced
                {
                    switch (invoiceType)
                    {
                    case (int)CConstValue.InvoiceType.Simple:
                    case (int)CConstValue.InvoiceType.General:
                    case (int)CConstValue.InvoiceType.Manual:
                    case (int)CConstValue.InvoiceType.Dormitory:
                    case (int)CConstValue.InvoiceType.Homestay:
                        btnConfirm.Enabled        = false;
                        btnModify.Enabled         = true;
                        btnCancel.Enabled         = true;
                        btnStudentInvoice.Enabled = true;
                        btnAgencyInvoice.Enabled  = true;
                        _radGridInvoiceItems.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
                        _radGridInvoiceItems.MasterTableView.EditMode           = GridEditMode.InPlace;
                        delete.Visible = false;
                        ddlFG.Enabled  = false;
                        break;

                    default:
                        btnConfirm.Enabled        = false; //Confirm
                        btnModify.Enabled         = false; //Modify
                        btnCancel.Enabled         = false; //Cancel
                        btnStudentInvoice.Enabled = true;  //Student Invoice Print
                        btnAgencyInvoice.Enabled  = true;  //Agency Invoice Print
                        _radGridInvoiceItems.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
                        _radGridInvoiceItems.MasterTableView.EditMode           = GridEditMode.InPlace;
                        delete.Visible = false;
                        ddlFG.Enabled  = false;
                        break;
                    }
                }
                else
                {
                    btnConfirm.Enabled        = false;
                    btnModify.Enabled         = false;
                    btnCancel.Enabled         = false;
                    btnStudentInvoice.Enabled = true;
                    btnAgencyInvoice.Enabled  = true;
                    _radGridInvoiceItems.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
                    _radGridInvoiceItems.MasterTableView.EditMode           = GridEditMode.InPlace;
                    delete.Visible = false;
                    ddlFG.Enabled  = false;
                }

                if (invoice.AgencyId != null)
                {
                    var cAgency = new CAgency();
                    var agency  = cAgency.Get(Convert.ToInt32(invoice.AgencyId));
                    if (agency != null)
                    {
                        tbAgencyName.Text = agency.Name;
                        if (agency.Location != null)
                        {
                            var country = new CCountry().Get((int)agency.Location);
                            tbCountryCity.Text = country.Name;
                        }
                        else
                        {
                            tbCountryCity.Text = string.Empty;
                        }
                        if (agency.ContractStartDate != null && agency.ContractEndDate != null)
                        {
                            tbContractDate.Text = agency.ContractStartDate.Value.Date.ToString("MM-dd-yyyy") + " - " + agency.ContractEndDate.Value.Date.ToString("MM-dd-yyyy");
                        }
                        tbCommissionRate.Text = invoice.AgencyRate + "%";
                        tbDescription.Text    = agency.Comment;
                    }
                }
                else
                {
                    tbAgencyName.Text     = "Direct Student";
                    tbCountryCity.Text    = string.Empty;
                    tbContractDate.Text   = string.Empty;
                    tbCommissionRate.Text = string.Empty;
                    tbDescription.Text    = string.Empty;
                }

                if (_radGridInvoiceItems.MasterTableView.EditMode == GridEditMode.Batch)
                {
                    InvoiceItemGrid1.SetTypeOfInvoiceCoaItem(invoice.InvoiceType);
                }
            }

            _radGridInvoiceItems.Rebind();
            RadGridInvoiceHistory.Rebind();
        }
Ejemplo n.º 14
0
        private STParticipant read_data()
        {
            STParticipant ret = new STParticipant();

            CCountry clCo;

            try
            {
                if (textBoxId.Text.Length > 0)
                {
                    ret.idpart = int.Parse(textBoxId.Text.Trim());
                }
                else
                {
                    ret.idpart = 0;
                }

                if (textBoxFamily.Text.Length > 0)
                {
                    ret.family = textBoxFamily.Text;
                }
                else
                {
                    ret.family = null;
                }

                if (textBoxName.Text.Length > 0)
                {
                    ret.name = textBoxName.Text;
                }
                else
                {
                    ret.name = null;
                }

                if (textBoxSecondName.Text.Length > 0)
                {
                    ret.payname = textBoxSecondName.Text;
                }
                else
                {
                    ret.payname = null;
                }

                ret.datebirth = new DateTime(dateTimePickerDateBirth.Value.Year,
                                             dateTimePickerDateBirth.Value.Month, dateTimePickerDateBirth.Value.Day, 0, 0, 0, 0);

                if (checkBoxNBL.CheckState == CheckState.Checked)
                {
                    ret.adminflag = 1;
                }
                else
                {
                    ret.adminflag = 0;
                }

                if (textBoxPersonalNum.Text.Length > 0)
                {
                    ret.personalnum = textBoxPersonalNum.Text;
                }
                else
                {
                    ret.personalnum = null;
                }

                if (comboBoxCountry.Text.Length > 0)
                {
                    string c = comboBoxCountry.Text;

                    clCo = new CCountry(connect, c);

                    ret.idcountry = clCo.stCountry.id;
                }
                else
                {
                    ret.idcountry = 0;
                }

                if (labelNameFoto.Text.Length > 0)
                {
                    ret.namefoto = labelNameFoto.Text.Trim();
                }
                else
                {
                    ret.namefoto = null;
                }

                if (checkBoxVisible.Checked == true)
                {
                    ret.vf = 1;
                }
                else
                {
                    ret.vf = 0;
                }

                List <int> arr = new List <int>();
                STPostment st;
                for (int i = 0; i < checkedListBoxPost.Items.Count; i++)
                {
                    if (checkedListBoxPost.GetItemChecked(i))
                    {
                        st = new STPostment();
                        string text = checkedListBoxPost.Items[i].ToString();
                        if (text.Length > 0)
                        {
                            st = clPost.GetPost(text);
                        }

                        arr.Add(st.idpost);
                    }
                }

                if (arr.Count > 0)
                {
                    ret.post = clWork.GetStringPost(arr);
                }
                else
                {
                    ret.post = null;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }

            return(ret);
        }
Ejemplo n.º 15
0
        private void set_data(STParticipant data)
        {
            CCountry clCo;

            try
            {
                textBoxId.Text = data.idpart.ToString();

                if (data.idpart != 0)
                {
                    textBoxFamily.Text = data.family;
                    textBoxName.Text   = data.name;
                    if (data.payname != null)
                    {
                        textBoxSecondName.Text = data.payname;
                    }
                    if (data.datebirth != null)
                    {
                        dateTimePickerDateBirth.Value = (DateTime)data.datebirth;
                    }

                    if (data.adminflag == 1)
                    {
                        checkBoxNBL.CheckState = CheckState.Checked;
                    }
                    else
                    {
                        checkBoxNBL.CheckState = CheckState.Unchecked;
                    }

                    textBoxPersonalNum.Text = data.personalnum;

                    if (data.idcountry != null)
                    {
                        clCo = new CCountry(connect, (int)data.idcountry);
                        comboBoxCountry.Text = clCo.stCountry.shortname;
                    }

                    if (data.namefoto != null && data.namefoto.Length > 0)
                    {
                        string pathfoto = string.Format("{0}\\{1}", clParam.s_Path.pathfoto, data.namefoto);

                        FileInfo fi = new FileInfo(pathfoto);
                        if (fi.Exists)
                        {
                            labelNameFoto.Text = data.namefoto;

                            Bitmap bt = new Bitmap(pathfoto);
                            pictureBoxFoto.Image = bt;;
                        }
                        else
                        {
                            MessageBox.Show(string.Format("‘айл {0} не найден", pathfoto),
                                            "¬нимание!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }

                    if (data.vf == 1)
                    {
                        checkBoxVisible.Checked = true;
                    }
                    else
                    {
                        checkBoxVisible.Checked = false;
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }
        }