protected void Page_Load(object sender, EventArgs e)
    {
        if (SessionManager.CurrentUser == null)
        {
            Common.RedirectToLoginPage(this);
            return;
        }
        else if (!IsPostBack)
        {
            FillLabelLanguage();
            InitControls();
            ddlType.Items.Add(new RadComboBoxItem(ResourceManager.GetString("candidateContactPhone"), "T"));
            ddlType.Items.Add(new RadComboBoxItem(ResourceManager.GetString("candidateContactFax"), "F"));
            ddlType.Items.Add(new RadComboBoxItem(ResourceManager.GetString("candidateContactMobile"), "G"));
            ddlType.Items.Add(new RadComboBoxItem(ResourceManager.GetString("candidateContactEmail"), "E"));

        }
        if (!string.IsNullOrEmpty(Request.QueryString["TelePhoneId"]))
        {
            if (!IsPostBack)
            {
                CandidateTelephone telephone = new CandidateTelephone();
                int telephoneID = int.Parse(Request.QueryString["TelePhoneId"]);
                if (telephoneID > 0) //existed in database
                {
                    CandidateTelephoneRepository repo = new CandidateTelephoneRepository();
                    telephone = repo.FindOne(new CandidateTelephone(telephoneID));

                }
                else //get from session data
                {
                    telephone = SessionManager.NewCandidateTelephoneList.Find(delegate(CandidateTelephone t) { return t.TelePhoneId == telephoneID; });
                }

                ddlType.SelectedValue = telephone.Type;
                txtZone.Text = telephone.PhoneArea;
                txtPhoneMail.Text = telephone.PhoneMail;
                txtPlace.Text = telephone.Location;
            }
        }
    }
Exemplo n.º 2
0
 protected void OnCandidateContactDeleteClicked(object sender, EventArgs e)
 {
     LinkButton lnkItem = (LinkButton)sender;
     int canTelephonID = int.Parse(lnkItem.CommandArgument);
     if (canTelephonID > 0) //existed in database
     {
         CandidateTelephone deleteItem = new CandidateTelephone(canTelephonID);
         CandidateTelephoneRepository repo = new CandidateTelephoneRepository();
         repo.Delete(deleteItem);
     }
     else
     {
         List<CandidateTelephone> list = SessionManager.NewCandidateTelephoneList;
         CandidateTelephone existedItem = list.Find(delegate(CandidateTelephone t) { return t.TelePhoneId == canTelephonID; });
         if (existedItem != null)
         {
             list.Remove(existedItem);
             SessionManager.NewCandidateTelephoneList = list;
         }
     }
     BindContactGridOfCurrentCandidate(null);
 }
 private CandidateTelephone GetCadidateTelephone()
 {
     CandidateTelephone saveItem = new CandidateTelephone();
     if (!string.IsNullOrEmpty(Request.QueryString["TelePhoneId"]))
     {
         int telId = int.Parse(Request.QueryString["TelePhoneId"]);
         if (telId > 0)
         {
             saveItem = new CandidateTelephoneRepository().FindOne(new CandidateTelephone(telId));
         }
     }
     if (!string.IsNullOrEmpty(Request.QueryString["candidateID"]))
         saveItem.CandidateID = Convert.ToInt32(Request.QueryString["candidateID"]);
     saveItem.Type = ddlType.SelectedValue;
     saveItem.TypeLabel = ddlType.Text;
     saveItem.PhoneArea = txtZone.Text.Trim();
     saveItem.PhoneMail = txtPhoneMail.Text.Trim();
     saveItem.Location = txtPlace.Text.Trim();
     return saveItem;
 }