private void LoadInfoToControls()
        {
            int       codeostad = Convert.ToInt32(Session[sessionNames.userID_StudentOstad]);
            DataTable dtResult  = FRB.GetOstadInfoFromHR(codeostad);

            if (dtResult.Rows.Count == 0)
            {
                string msg = "کد استادی شما در هیچ کدام از سامانه ها فعال نیست. لطفا جهت فعال سازی با کارشناس مربوطه تماس حاصل فرمایید";
                RadWindowManager1.RadAlert(msg, 400, 200, "پیام سیستم", "RedirectToMain");
                return;
            }
            Session.Add("hrInfoPeopleId", dtResult.Rows[0]["Id"]);

            ListItem itmSelect = new ListItem("انتخاب کنید", "");
            ListItem itmOther  = new ListItem("سایر", "0");

            DTO.University.Faculty.editInfoStruct editInfo = FRB.getOstadInf(codeostad);

            //Session.Add("hrInfoPeopleId", editInfo.hrId);



            DataTable dtControlToSidaList = FRB.GetAllControlToSidaFields();

            DataRow        existsDrp  = null;
            ChangedInfoDTO oChangeDrp = new ChangedInfoDTO();


            existsDrp = dtControlToSidaList.AsEnumerable()
                        .Where(x => x.Field <string>("ControlName") == drpProvince1.ID + "Value")
                        .FirstOrDefault();
            oChangeDrp                  = new ChangedInfoDTO();
            oChangeDrp.Code_Ostad       = codeostad;
            oChangeDrp.ControlToFieldId = Convert.ToInt32(existsDrp["Id"]);
            oChangeDrp.ControlId        = drpProvince1.ID + "value";
            oChangeDrp.OldValue         = getOldValue(existsDrp["id"].ToString(), editInfo);// as string;
            ChangeList.Add(oChangeDrp);

            existsDrp = dtControlToSidaList.AsEnumerable()
                        .Where(x => x.Field <string>("ControlName") == drpLivingCity.ID + "Value")
                        .FirstOrDefault();
            oChangeDrp                  = new ChangedInfoDTO();
            oChangeDrp.Code_Ostad       = codeostad;
            oChangeDrp.ControlToFieldId = Convert.ToInt32(existsDrp["Id"]);
            oChangeDrp.ControlId        = drpLivingCity.ID + "value";
            oChangeDrp.OldValue         = getOldValue(existsDrp["id"].ToString(), editInfo);// as string;
            ChangeList.Add(oChangeDrp);


            existsDrp = dtControlToSidaList.AsEnumerable()
                        .Where(x => x.Field <string>("ControlName") == drpProvince2.ID + "Value")
                        .FirstOrDefault();
            oChangeDrp                  = new ChangedInfoDTO();
            oChangeDrp.Code_Ostad       = codeostad;
            oChangeDrp.ControlToFieldId = Convert.ToInt32(existsDrp["Id"]);
            oChangeDrp.ControlId        = drpProvince2.ID + "value";
            oChangeDrp.OldValue         = getOldValue(existsDrp["id"].ToString(), editInfo);// as string;
            ChangeList.Add(oChangeDrp);
            existsDrp = dtControlToSidaList.AsEnumerable()
                        .Where(x => x.Field <string>("ControlName") == drpWorkingCity.ID + "Value")
                        .FirstOrDefault();
            oChangeDrp                  = new ChangedInfoDTO();
            oChangeDrp.Code_Ostad       = codeostad;
            oChangeDrp.ControlToFieldId = Convert.ToInt32(existsDrp["Id"]);
            oChangeDrp.ControlId        = drpWorkingCity.ID + "value";
            oChangeDrp.OldValue         = getOldValue(existsDrp["id"].ToString(), editInfo);// as string;
            ChangeList.Add(oChangeDrp);

            foreach (Control item in dvAddressFileds.Controls)
            {
                DataRow exists = null;
                if (item is TextBox)
                {
                    exists = dtControlToSidaList.AsEnumerable()
                             .Where(x => x.Field <string>("ControlName") == item.ID)
                             .FirstOrDefault();
                }

                if (exists != null)
                {
                    ChangedInfoDTO oChange = new ChangedInfoDTO();
                    oChange.Code_Ostad       = codeostad;
                    oChange.ControlToFieldId = Convert.ToInt32(exists["Id"]);
                    oChange.ControlId        = item.ID;
                    oChange.OldValue         = getOldValue(exists["id"].ToString(), editInfo);// as string;
                    ChangeList.Add(oChange);
                }
            }

            ViewState.Add("ChangeList", ChangeList);

            txtHomePhone.Text = editInfo.telHome.ToString();

            txtWorkPhone.Text      = editInfo.telKar.ToString();
            txtMobileNumber.Text   = editInfo.telMobile.ToString();
            txtLivingAddress.Text  = editInfo.addressHome.ToString();
            txtWorkingAddress.Text = editInfo.addressKar.ToString();
            txtLivingZipCode.Text  = editInfo.codePosti.ToString();
            txtEmail.Text          = editInfo.email.ToString();

            setDropDownOstanSource(drpProvince1, editInfo.ostanHome);
            setDropDownOstanSource(drpProvince2, editInfo.ostanKar);
            setDropDownShahrSource(drpLivingCity, editInfo.ostanHome, editInfo.shahrHome);
            setDropDownShahrSource(drpWorkingCity, editInfo.ostanKar, editInfo.shahrKar);
        }
예제 #2
0
        private void LoadInfoToControls()
        {
            ListItem itmSelect = new ListItem("انتخاب کنید", "-1");
            ListItem itmOther  = new ListItem("سایر", "0");
            int      codeostad = Convert.ToInt32(Session[sessionNames.userID_StudentOstad]);

            DTO.University.Faculty.editInfoStruct editInfo = FRB.getOstadInf(codeostad);

            //Session.Add("hrInfoPeopleId", editInfo.hrId);
            DataTable dtResault = FRB.GetOstadInfoFromHR(codeostad);

            if (dtResault.Rows.Count == 0)
            {
                string msg = "کد استادی شما در هیچ کدام از سامانه ها فعال نیست. لطفا جهت فعال سازی با کارشناس مربوطه تماس حاصل فرمایید";
                RadWindowManager1.RadAlert(msg, 400, 200, "پیام سیستم", "RedirectToMain");
                return;
            }
            Session.Add("hrInfoPeopleId", dtResault.Rows[0]["Id"]);


            DataTable dtControlToSidaList = FRB.GetAllControlToSidaFields();

            txtCodeMeli.Text   = editInfo.idd_Melli;
            txtFirstName.Text  = editInfo.name;
            txtFamily.Text     = editInfo.family;
            txtFatherName.Text = editInfo.fatherName;
            AddValueToChangeList(codeostad, dtControlToSidaList, txtFatherName.Text, txtFatherName.ID);
            txtShCode.Text = editInfo.idd;
            AddValueToChangeList(codeostad, dtControlToSidaList, txtShCode.Text, txtShCode.ID);
            txtYearBorn.Text = editInfo.salTavalod;
            AddValueToChangeList(codeostad, dtControlToSidaList, txtYearBorn.Text, txtYearBorn.ID);

            drpNezam.DataSource     = CB.GetStatusMilitary_fcoding();
            drpNezam.DataTextField  = "namecoding";
            drpNezam.DataValueField = "id";
            drpNezam.DataBind();
            drpNezam.Items.Insert(0, new ListItem(itmSelect.Text, itmSelect.Value));
            drpNezam.Items.Insert(drpNezam.Items.Count, new ListItem(itmOther.Text, itmOther.Value));
            drpNezam.SelectedValue = editInfo.nezam.ToString();
            AddValueToChangeList(codeostad, dtControlToSidaList, drpNezam.SelectedValue, drpNezam.ID + "Value");

            rdblMarriage.SelectedValue = editInfo.taahol ? "2" : "1";
            AddValueToChangeList(codeostad, dtControlToSidaList, rdblMarriage.SelectedValue, rdblMarriage.ID);

            rblGender.SelectedValue = editInfo.sexIsMan ? "1" : "2";
            AddValueToChangeList(codeostad, dtControlToSidaList, rblGender.SelectedValue, rblGender.ID);
            if (!editInfo.sexIsMan)
            {
                pnlMilitary.Visible = false;
            }

            drpLastMaghta.Items.Clear();
            drpLastMaghta.DataSource     = CB.GetCodingByTypeId(2);
            drpLastMaghta.DataValueField = "Id";
            drpLastMaghta.DataTextField  = "namecoding";
            drpLastMaghta.DataBind();
            drpLastMaghta.Items.Insert(0, new ListItem(itmSelect.Text, itmSelect.Value));
            drpLastMaghta.SelectedValue = editInfo.maghta.ToString();
            AddValueToChangeList(codeostad, dtControlToSidaList, editInfo.maghta == 0 ? "" : editInfo.maghta.ToString(), drpLastMaghta.ID + "Value");

            DataTable dtField = CB.SelectField_fcoding();

            for (int i = 0; i <= dtField.Rows.Count - 1; i++)
            {
                dtField.Rows[i]["nameresh"] = dtField.Rows[i]["nameresh"].ToString().Replace("ي", "ی");
            }
            drpReshte.DataSource     = dtField;
            drpReshte.DataTextField  = "nameresh";
            drpReshte.DataValueField = "id";
            drpReshte.DataBind();
            drpReshte.Items.Insert(0, new RadComboBoxItem(itmSelect.Text, itmSelect.Value));
            drpReshte.Items.Insert(drpReshte.Items.Count, new RadComboBoxItem(itmOther.Text, itmOther.Value));
            drpReshte.SelectedValue = editInfo.reshte.ToString();
            AddValueToChangeList(codeostad, dtControlToSidaList, editInfo.reshte == 0 ? "" : editInfo.reshte.ToString(), drpReshte.ID + "Value");



            drpUniversityType.SelectedValue = editInfo.typeUniMadrak.ToString();
            AddValueToChangeList(codeostad, dtControlToSidaList, drpUniversityType.SelectedValue, drpUniversityType.ID + "Value");


            txtSiba.Text = editInfo.siba;
            AddValueToChangeList(codeostad, dtControlToSidaList, editInfo.siba, txtSiba.ID);


            txtYearGetMadrak.Text = editInfo.salMadrak;
            AddValueToChangeList(codeostad, dtControlToSidaList, editInfo.salMadrak, txtYearGetMadrak.ID);


            txtSanavat.Text = editInfo.sanavat;
            AddValueToChangeList(codeostad, dtControlToSidaList, editInfo.sanavat, txtSanavat.ID);

            DataTable dtCountrySource = CB.GetNameCountry_fcoding();

            drpCountry.DataSource     = dtCountrySource.Select("id<56").CopyToDataTable();
            drpCountry.DataTextField  = "namecoding";
            drpCountry.DataValueField = "id";
            drpCountry.DataBind();
            drpCountry.Items.Insert(0, new ListItem(itmSelect.Text, itmSelect.Value));
            drpCountry.SelectedValue = editInfo.keshvar.ToString();
            AddValueToChangeList(codeostad, dtControlToSidaList, editInfo.keshvar.ToString(), drpCountry.ID + "Value");

            DataTable dtUniName = CB.GetNameUni_fcoding();

            for (int i = 0; i <= dtUniName.Rows.Count - 1; i++)
            {
                dtUniName.Rows[i][0] = dtUniName.Rows[i][0].ToString().Replace("ي", "ی");
            }
            drpUniName.DataSource     = dtUniName;
            drpUniName.DataTextField  = "namecoding";
            drpUniName.DataValueField = "ID";
            drpUniName.DataBind();
            drpUniName.Items.Insert(0, new RadComboBoxItem(itmSelect.Text, itmSelect.Value));
            drpUniName.Items.Insert(drpUniName.Items.Count, new RadComboBoxItem(itmOther.Text, itmOther.Value));
            drpUniName.SelectedValue = editInfo.nameUniMadrak.ToString();
            AddValueToChangeList(codeostad, dtControlToSidaList, drpUniName.SelectedValue, drpUniName.ID + "Value");

            if (editInfo.bime)
            {
                rdblBimehStatus.SelectedValue = "1";
                drpBimehType.Enabled          = true;
                txtInsuranceNumber.Enabled    = true;
                drpBimehType.SelectedValue    = editInfo.bimeType.ToString();
                txtInsuranceNumber.Text       = editInfo.bimeNum;
                drpBimehType.Enabled          = true;
                txtInsuranceNumber.Enabled    = true;
            }
            else
            {
                rdblBimehStatus.SelectedValue = "2";
            }
            AddValueToChangeList(codeostad, dtControlToSidaList, drpBimehType.SelectedValue, drpBimehType.ID + "Value");
            AddValueToChangeList(codeostad, dtControlToSidaList, txtInsuranceNumber.Text, txtInsuranceNumber.ID);

            chbkIsRetired.Checked = editInfo.bazneshaste;

            AddValueToChangeList(codeostad, dtControlToSidaList, chbkIsRetired.Checked.ToString(), "chbkIsRetired");


            ViewState.Add(listOfChanges, ChangeList);
            getScansAreNotInDB();
        }