예제 #1
0
 private void rbtnAgree_Click(object sender, EventArgs e)
 {
     if (rtbNumberAgree.Text.Trim().Count() > 5)
     {
         Manager objManager      = new Manager();
         var     resultFindAgree = objManager.View_agreements(null, null, null, null, null, null, null, null, rtbNumberAgree.Text.Trim());
         if (resultFindAgree.success)
         {
             if (resultFindAgree.ResultTable.Rows.Count > 0)
             {
                 CurrentAgreeId       = decimal.Parse(resultFindAgree.ResultTable.Rows[0]["Agreement_ID"].ToString().Trim());
                 rtbNumberAgree.Text  = resultFindAgree.ResultTable.Rows[0]["Agreement_Number"].ToString().Trim();
                 rtbCompanyAgree.Text = resultFindAgree.ResultTable.Rows[0]["Agreement_Company"].ToString().Trim();
                 // rtbTitleAgree.Text = resultFindAgree.ResultTable.Rows[0]["Agreement_Title"].ToString().Trim();
                 rlblCountCar.Text = ItemsPublic.HowManyCarInAgree(CurrentAgreeId);
             }
             else
             {
                 rlblHintAgree.Visible = true;
             }
         }
         else
         {
             MessageBox.Show(resultFindAgree.Message);
         }
     }
 }
        private void rbtnAgree_Click(object sender, EventArgs e)
        {
            if (rtbNumberAgree.Text.Trim().Count() > 5)
            {
                Manager objManager      = new Manager();
                var     resultFindAgree = objManager.View_agreements(null, null, null, null, null, null, null, null, rtbNumberAgree.Text.Trim());
                if (resultFindAgree.success)
                {
                    if (resultFindAgree.ResultTable.Rows.Count > 0)
                    {
                        CurrentAgreeId       = decimal.Parse(resultFindAgree.ResultTable.Rows[0]["Agreement_ID"].ToString().Trim());
                        rtbNumberAgree.Text  = resultFindAgree.ResultTable.Rows[0]["Agreement_Number"].ToString().Trim();
                        rtbCompanyAgree.Text = resultFindAgree.ResultTable.Rows[0]["Agreement_Company"].ToString().Trim();
                        // rtbTitleAgree.Text = resultFindAgree.ResultTable.Rows[0]["Agreement_Title"].ToString().Trim();
                        rlblCountCar.Text = ItemsPublic.HowManyCarInAgree(CurrentAgreeId);

                        var firstTimeRowFormat = DateTime.Now;
                        var endTimeRowFormat   = (DateTime)resultFindAgree.ResultTable.Rows[0]["Agreement_EndDate"];
                        var countDay           = 1 + (int)endTimeRowFormat.Subtract(firstTimeRowFormat).TotalDays;

                        if (countDay < 1)
                        {
                            rlblHintAgree.Text = "قرارداد اعتبار ندارد";
                        }
                        else
                        {
                            rlblHintAgree.Text = countDay.ToString() + " روز تا پایان قرارداد";
                        }

                        rlblHintAgree.Visible = true;
                    }
                    else
                    {
                        rlblHintAgree.Text    = "قرارداد معتبری یافت نشد";
                        rlblHintAgree.Visible = true;
                    }
                }
                else
                {
                    MessageBox.Show(resultFindAgree.Message);
                }
            }
            else
            {
                rlblHintAgree.Text    = "قرارداد معتبری یافت نشد";
                rlblHintAgree.Visible = true;
            }
        }
        private void ShowPropertiesItems()
        {
            uC_ViewEvents1.rtbEvents.Text = MainRadGridView.CurrentRow.Cells["Package_Events"].Value.ToString();

            // ========================================================
            var result         = new OutputDatas();
            var objGateManager = new Manager();
            var IndexPack      = (decimal?)MainRadGridView.CurrentRow.Cells["package_Id"].Value;

            result = objGateManager.View_Gates(IndexPack);
            if (result.success)
            {
                v3UC_PackDetailsGp21.rtbGates.Text = "";
                v3UC_PackDetailsGp21.CurrentGates  = new List <int>();
                foreach (DataRow obj in result.ResultTable.Rows)
                {
                    //	string ss = obj.Cells["Gate_Id"].Value.ToString().Trim();
                    //int ii = int.Parse(obj.Cells["Gate_Id"].Value.ToString().Trim());
                    v3UC_PackDetailsGp21.CurrentGates.Add(int.Parse(obj["Gate_Id"].ToString().Trim()));
                    v3UC_PackDetailsGp21.rtbGates.Text += obj["Gate_Name"].ToString().Trim() + "\r\n";
                }
            }
            else
            {
                ItemsPublic.ShowMessage(result.Message);
            }


            result         = new OutputDatas();
            objGateManager = new Manager();
            result         = objGateManager.View_Places(IndexPack);
            if (result.success)
            {
                v3UC_PackDetailsGp21.rtbPlaces.Text = "";
                v3UC_PackDetailsGp21.CurrentPlaces  = new List <int>();
                foreach (DataRow obj in result.ResultTable.Rows)
                {
                    //	string ss = obj.Cells["Place_Id"].Value.ToString().Trim();
                    //int ii = int.Parse(obj.Cells["Place_Id"].Value.ToString().Trim());
                    v3UC_PackDetailsGp21.CurrentPlaces.Add(int.Parse(obj["Place_Id"].ToString().Trim()));
                    v3UC_PackDetailsGp21.rtbPlaces.Text += obj["Place_Name"].ToString().Trim() + "\r\n";
                }
            }
            else
            {
                ItemsPublic.ShowMessage(result.Message);
            }



            v3UC_PackDetailsGp21.rddlShift.Text = MainRadGridView.CurrentRow.Cells["Package_Shift"].Value.ToString().Trim();

            v3UC_PackDetailsGp21.rtbStatusPack.Text = MainRadGridView.CurrentRow.Cells["StatusPack_Label"].Value.ToString().Trim();
            v3UC_PackDetailsGp21.rtbPackId.Text     = MainRadGridView.CurrentRow.Cells["Package_TicketId"].Value.ToString().Trim();
            v3UC_PackDetailsGp21.rtbOffice.Text     = MainRadGridView.CurrentRow.Cells["Office_Name"].Value.ToString().Trim();

            if (MainRadGridView.CurrentRow.Cells["TypePack_Id"].Value != null)
            {
                if (!(MainRadGridView.CurrentRow.Cells["TypePack_Id"].Value is DBNull))
                {
                    v3UC_PackDetailsGp21.TypePackRealId    = (int)MainRadGridView.CurrentRow.Cells["TypePack_Id"].Value;
                    v3UC_PackDetailsGp21.isGpType          = (bool?)MainRadGridView.CurrentRow.Cells["TypePack_IsShort"].Value;
                    v3UC_PackDetailsGp21.rddlTypePack.Text = MainRadGridView.CurrentRow.Cells["TypePack_Name"].Value.ToString().Trim();
                }
            }

            //switch ((ServerClasses.AllFunctions._TypePack)MainRadGridView.CurrentRow.Cells["TypePack_Id"].Value)
            //{
            //    case ServerClasses.AllFunctions._TypePack.WorkerMan:
            //        v3UC_PackDetailsGp21.rddlTypePack.SelectedIndex = (int)ServerClasses.AllFunctions._TypePack.WorkerMan;
            //        break;
            //    case ServerClasses.AllFunctions._TypePack.WorkerWoman:
            //        v3UC_PackDetailsGp21.rddlTypePack.SelectedIndex = (int)ServerClasses.AllFunctions._TypePack.WorkerWoman;
            //        break;
            //    case ServerClasses.AllFunctions._TypePack.TeachTrainee:
            //        v3UC_PackDetailsGp21.rddlTypePack.SelectedIndex = (int)ServerClasses.AllFunctions._TypePack.TeachTrainee;
            //        break;
            //    case ServerClasses.AllFunctions._TypePack.TeachUni:
            //        v3UC_PackDetailsGp21.rddlTypePack.SelectedIndex = (int)ServerClasses.AllFunctions._TypePack.TeachUni;
            //        break;
            //    case ServerClasses.AllFunctions._TypePack.TeachAct:
            //        v3UC_PackDetailsGp21.rddlTypePack.SelectedIndex = (int)ServerClasses.AllFunctions._TypePack.TeachAct;
            //        break;
            //    case ServerClasses.AllFunctions._TypePack.Guest:
            //        v3UC_PackDetailsGp21.rddlTypePack.SelectedIndex = (int)ServerClasses.AllFunctions._TypePack.Guest;
            //        break;
            //    case ServerClasses.AllFunctions._TypePack.TempWork:
            //        v3UC_PackDetailsGp21.rddlTypePack.SelectedIndex = (int)ServerClasses.AllFunctions._TypePack.TempWork;
            //        break;
            //    case ServerClasses.AllFunctions._TypePack.Company:
            //        v3UC_PackDetailsGp21.rddlTypePack.SelectedIndex = (int)ServerClasses.AllFunctions._TypePack.Company;
            //        break;
            //}

            if (MainRadGridView.CurrentRow.Cells["Package_StartDate"].Value != null)
            {
                if (!(MainRadGridView.CurrentRow.Cells["Package_StartDate"].Value is DBNull))
                {
                    v3UC_PackDetailsGp21.bdcStartDate.DateTime = (DateTime)MainRadGridView.CurrentRow.Cells["Package_StartDate"].Value;
                }
            }

            if (MainRadGridView.CurrentRow.Cells["Package_EndDate"].Value != null)
            {
                if (!(MainRadGridView.CurrentRow.Cells["Package_EndDate"].Value is DBNull))
                {
                    v3UC_PackDetailsGp21.bdcEndDate.DateTime = (DateTime)MainRadGridView.CurrentRow.Cells["Package_EndDate"].Value;
                }
            }


            v3UC_PackDetailsGp21.rddlValid.SelectedIndex = ((bool)MainRadGridView.CurrentRow.Cells["Package_IsExpired"].Value)
                                                                ? 0
                                                                : 1;

            if (MainRadGridView.CurrentRow.Cells["Agreement_Number"].Value != null)
            {
                if (!(MainRadGridView.CurrentRow.Cells["Agreement_Number"].Value is DBNull))
                {
                    v3UC_PackDetailsGp21.rtbNumberAgree.Text = MainRadGridView.CurrentRow.Cells["Agreement_Number"].Value.ToString().Trim();
                }
            }

            string  temS = MainRadGridView.CurrentRow.Cells["Agreement_ID"].Value.ToString().Trim();
            decimal?temp = string.IsNullOrEmpty(temS) ? (decimal?)null : decimal.Parse(temS);

            v3UC_PackDetailsGp21.CurrentAgreeId = temp;

            if (MainRadGridView.CurrentRow.Cells["Agreement_Company"].Value != null)
            {
                if (!(MainRadGridView.CurrentRow.Cells["Agreement_Company"].Value is DBNull))
                {
                    v3UC_PackDetailsGp21.rtbCompanyAgree.Text = MainRadGridView.CurrentRow.Cells["Agreement_Company"].Value.ToString().Trim();
                }
            }
            //	v3UC_PackDetailsGp21.rtbTitleAgree.Text = MainRadGridView.CurrentRow.Cells["Agreement_Title"].Value.ToString().Trim();
            v3UC_PackDetailsGp21.rlblCountCar.Text = ItemsPublic.HowManyCarInAgree(temp);


            if (MainRadGridView.CurrentRow.Cells["TravelArea_Id"].Value != null)
            {
                if (!(MainRadGridView.CurrentRow.Cells["TravelArea_Id"].Value is DBNull))
                {
                    temS = MainRadGridView.CurrentRow.Cells["TravelArea_Id"].Value.ToString().Trim();
                    int?temp2 = string.IsNullOrEmpty(temS) ? (int?)null : int.Parse(temS);
                    v3UC_PackDetailsGp21.CurrentTravelId = temp2;

                    v3UC_PackDetailsGp21.rtbTravelLabel.Text =
                        MainRadGridView.CurrentRow.Cells["TravelArea_LabelTravel"].Value.ToString().Trim();
                }
            }

            v3UC_PackDetailsGp21.rtbOperRequest.Text     = MainRadGridView.CurrentRow.Cells["OperRequestName"].Value.ToString().Trim();
            v3UC_PackDetailsGp21.rtbOperConfirm.Text     = MainRadGridView.CurrentRow.Cells["OperConfirmName"].Value.ToString().Trim();
            v3UC_PackDetailsGp21.rtbOperPassage.Text     = MainRadGridView.CurrentRow.Cells["OperPassageName"].Value.ToString().Trim();
            v3UC_PackDetailsGp21.tbPackDescriptions.Text =
                MainRadGridView.CurrentRow.Cells["Package_Description"].Value.ToString().Trim();

            //v3UC_PackDetailsGp21.uC_vehicleDetails21.rddlType.SelectedIndex =
            //string stV = rgvPack.CurrentRow.Cells["Vehicle_ID"].Value.ToString().Trim();
            //bool boV = !string.IsNullOrEmpty(stV);
            //v3UC_PackDetailsGp21.rcbHaveVehicle.Checked = boV;
            //if (v3UC_PackDetailsGp21.rcbHaveVehicle.Checked)
            //{
            //    v3UC_PackDetailsGp21.CurrentCarId = (decimal?) rgvPack.CurrentRow.Cells["Vehicle_ID"].Value;
            //    v3UC_PackDetailsGp21.uC_vehicleDetails31.rtbModel.Text =
            //        rgvPack.CurrentRow.Cells["Vehicle_Model"].Value.ToString().Trim();
            //    v3UC_PackDetailsGp21.uC_vehicleDetails31.rtbColor.Text =
            //        rgvPack.CurrentRow.Cells["vehicle_Color"].Value.ToString().Trim();



            //    v3UC_PackDetailsGp21.uC_vehicleDetails31.uC_PlatesCar1.rddlTypePlate.SelectedIndex =
            //        (int)rgvPack.CurrentRow.Cells["TypePlates_Id"].Value;


            //    v3UC_PackDetailsGp21.uC_vehicleDetails31.uC_PlatesCar1.CarNumber =
            //        rgvPack.CurrentRow.Cells["Vehicle_number"].Value.ToString().Trim();



            //    v3UC_PackDetailsGp21.uC_vehicleDetails31.rddlState.SelectedIndex =
            //        (bool) rgvPack.CurrentRow.Cells["Vehicle_IsCompany"].Value ? 0 : 1;
            //    v3UC_PackDetailsGp21.uC_vehicleDetails31.indexTypeModel =
            //        (int?) rgvPack.CurrentRow.Cells["VehicleType_ID"].Value;
            //}
            //else
            //{
            //    v3UC_PackDetailsGp21.rcbHaveVehicle.Checked = false;
            //}
        }