protected void OnBtnSaveClicked(object sender, EventArgs e)
    {
        ParamTypeActionRepository repo = new ParamTypeActionRepository();

        ParamTypeAction saveItem = new ParamTypeAction();
        saveItem.Label = txtTypeActionLabel.Text.Trim();
        saveItem.UnitCode = txtUnitCode.Text.Trim();

        if (string.IsNullOrEmpty(Request.QueryString["TypeActionID"]))
        {
            repo.Insert(saveItem);
        }
        else
        {
            saveItem.ParamActionID = int.Parse(Request.QueryString["TypeActionID"]);
            repo.Update(saveItem);
        }

        string script = "<script type=\"text/javascript\">";
        script += " OnBtnSaveClientClicked();";
        script += " </script>";

        if (!ClientScript.IsClientScriptBlockRegistered("redirectUser"))
            ClientScript.RegisterStartupScript(this.GetType(), "redirectUser", script);
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (SessionManager.CurrentUser == null)
     {
         Common.RedirectToLoginPage(this);
         return;
     }
     else if (!IsPostBack)
     {
         FillLabelLanguage();
         if (!string.IsNullOrEmpty(Request.QueryString["TypeActionID"]))
         {
             int typeActionID = int.Parse(Request.QueryString["TypeActionID"]);
             ParamTypeAction typeAction = new ParamTypeActionRepository().FindOne(new ParamTypeAction(typeActionID));
             txtTypeActionLabel.Text = typeAction.Label;
             txtUnitCode.Text = typeAction.UnitCode;
         }
     }
 }
Example #3
0
    private void BindData()
    {
        BindLast5ViewedCandidate();
        BindLast5ViewedCompany();

        //fill Job sections
        BindProfileData();
        BindFunctionData();
        BindLocationData();
        BindResponsible();
        //Action
        ddlTypeAction.DataValueField = "ParamActionID";
        ddlTypeAction.DataTextField = "Label";
        IList<ParamTypeAction> list = new List<ParamTypeAction>();
        list = new ParamTypeActionRepository().FindAll();
        list.Insert(0, new ParamTypeAction(-1, string.Empty));
        ddlTypeAction.DataSource = list;
        ddlTypeAction.DataBind();

        ParamUserRepository paramUserRepo = new ParamUserRepository();
        ddlResponsibleAction.DataValueField = "UserID";
        ddlResponsibleAction.DataTextField = "LastName";
        ddlResponsibleAction.DataSource = paramUserRepo.GetAllUser(true);
        ddlResponsibleAction.DataBind();

        if (SessionManager.CurrentUser != null)
        {
            ddlResponsibleAction.SelectedValue = SessionManager.CurrentUser.UserID;
        }

        //Invoice
        ddlInvoiceType.Items.Add(new RadComboBoxItem(ResourceManager.GetString("allText"), ""));
        ddlInvoiceType.Items.Add(new RadComboBoxItem("Invoice", "I"));
        ddlInvoiceType.Items.Add(new RadComboBoxItem("Credite note", "C"));
        ddlInvoiceType.SelectedValue = "I";

        ddlFiscalYear.Items.Add(new RadComboBoxItem(ResourceManager.GetString("allText"), ""));
        for (int year = DateTime.Today.Year; year >= 2000; year--)
        {
            ddlFiscalYear.Items.Add(new RadComboBoxItem(year.ToString(), year.ToString()));
        }
        ddlFiscalYear.SelectedValue = DateTime.Today.Year.ToString();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (SessionManager.CurrentUser == null)
        {
            Common.RedirectToLoginPage(this);
            return;
        }
        else if (!IsPostBack)
        {
            FillLabelLanguage();
            InitControls();

            //Fill data for combobox
            ddlTypeAction.DataValueField = "ParamActionID";
            ddlTypeAction.DataTextField = "Label";
            ParamTypeActionRepository paramTypeActionRepo = new ParamTypeActionRepository();
            ddlTypeAction.DataSource = paramTypeActionRepo.FindAll();
            ddlTypeAction.DataBind();

            ddlResponsible.DataValueField = "UserID";
            ddlResponsible.DataTextField = "LastName";
            ParamUserRepository userRepo = new ParamUserRepository();
            ddlResponsible.DataSource = userRepo.GetAllUser(true);
            ddlResponsible.DataBind();
            ddlResponsible.SelectedValue = SessionManager.CurrentUser.UserID;

            bool isCompany = false;
            bool isCandidate = false;
            if (!string.IsNullOrEmpty(Request.QueryString["type"]))
            {
                if (Request.QueryString["type"] == "company")
                {
                    isCompany = true;
                    btnCompany.Enabled = false;
                    ddlCompany.Enabled = false;
                }
                else if (Request.QueryString["type"] == "candidate")
                {
                    isCandidate = true;
                    btnCandidate.Enabled = false;
                    ddlCandidate.Enabled = false;
                }
                else if (Request.QueryString["type"] == "action"
                        && string.IsNullOrEmpty(Request.QueryString["ActionID"]))
                {
                    if (SessionManager.CurrentUser != null)
                        ddlResponsible.SelectedValue = SessionManager.CurrentUser.UserID;
                }
            }

            if (SessionManager.CurrentCompany != null && isCompany)
            {
                ddlCompany.Items.Clear();
                ddlCompany.Items.Add(new RadComboBoxItem(SessionManager.CurrentCompany.CompanyName, SessionManager.CurrentCompany.CompanyID.ToString()));
                ddlCompany.SelectedIndex = 0;

                hiddenCompanyId.Value = SessionManager.CurrentCompany.CompanyID.ToString();
                txtCompany.Text = SessionManager.CurrentCompany.CompanyName;
                BindContactListByCompany(SessionManager.CurrentCompany.CompanyID);
            }
            if (SessionManager.CurrentCandidate != null && isCandidate)
            {
                hiddenCandidateId.Value = SessionManager.CurrentCandidate.CandidateId.ToString();
                txtCandidate.Text = SessionManager.CurrentCandidate.FirstName + " " + SessionManager.CurrentCandidate.LastName;
                ddlCandidate.Items.Add(new RadComboBoxItem(SessionManager.CurrentCandidate.FirstName + " " + SessionManager.CurrentCandidate.LastName, SessionManager.CurrentCandidate.CandidateId.ToString()));
                ddlCandidate.SelectedIndex = 0;
            }

            if (!string.IsNullOrEmpty(Request.QueryString["ActionID"]))
            {

                int actionID = int.Parse(Request.QueryString["ActionID"]);
                ActionRepository repo = new ActionRepository();
                Neos.Data.Action action = repo.GetActionByActionID(actionID);
                if (action.CompanyID.HasValue)
                {
                    hiddenCompanyId.Value = action.CompanyID.Value.ToString();

                    BindContactListByCompany(action.CompanyID.Value);
                }
                if (action.CandidateID.HasValue)
                {

                    hiddenCandidateId.Value = action.CandidateID.Value.ToString();
                }
                if (action.ContactID.HasValue)
                {
                    ddlContact.SelectedValue = action.ContactID.Value.ToString();
                }
                else
                    ddlContact.SelectedValue = "-1";

                txtTaskNbr.Text = action.ActionID.ToString();
                chkActive.Checked = action.Actif;
                datDateAction.SelectedDate = action.DateAction;
                radTimeHour.SelectedDate = action.Hour;
                if (action.TypeAction.HasValue)
                    ddlTypeAction.SelectedValue = action.TypeAction.Value.ToString();
                datCreationDate.SelectedDate = action.DateCreation;
                txtCompany.Text = action.CompanyName;
                txtCandidate.Text = action.CandidateFullName;

                txtAppointmentPlace.Text = action.LieuRDV;
                txtCompanyResult.Text = action.ResultCompany;
                txtCandidateResult.Text = action.ResultCandidate;
                txtDescription.Text = action.DescrAction;
                ddlResponsible.SelectedValue = action.Responsable;

                //Company dropdownlist
                if (action.CompanyID.HasValue)
                {
                    ddlCompany.Items.Add(new RadComboBoxItem(action.CompanyName, action.CompanyID.ToString()));
                    ddlCompany.SelectedIndex = 0;
                }
                //candidate dropdownlist
                if (action.CandidateID.HasValue)
                {
                    ddlCandidate.Items.Add(new RadComboBoxItem(action.CandidateFullName, action.CandidateID.ToString()));
                    ddlCandidate.SelectedIndex = 0;
                }
            }
        }

        string script = "<script type='text/javascript'>";
        script += "onLoadActionDetailPage();";
        script += "</script>";
        if (!ClientScript.IsClientScriptBlockRegistered("LoadActionDetailPage"))
            ClientScript.RegisterStartupScript(this.GetType(), "LoadActionDetailPage", script);
    }
    protected void OnTypeActionDeleteClicked(object sender, EventArgs e)
    {
        LinkButton lnkItem = (LinkButton)sender;
        int typeActionID = int.Parse(lnkItem.CommandArgument);

        ParamTypeAction deleteItem = new ParamTypeAction(typeActionID);
        ParamTypeActionRepository repo = new ParamTypeActionRepository();
        repo.Delete(deleteItem);

        BindGridData();
        gridTypeAction.DataBind();
    }
 private void BindGridData()
 {
     ParamTypeActionRepository repo = new ParamTypeActionRepository();
     gridTypeAction.DataSource = repo.GetAllParamTypeActions();
 }
 private void CreateAction()
 {
     if (SessionManager.PresentationEmailObject != null)
     {
         PresentationEmailObject emailObject = SessionManager.PresentationEmailObject;
         Neos.Data.Action newAction = new Neos.Data.Action();
         newAction.CandidateID = emailObject.CandidateId;
         newAction.CompanyID = emailObject.CompanyId;
         if(emailObject.ContactId > 0)
             newAction.ContactID = emailObject.ContactId;
         newAction.Responsable = SessionManager.CurrentUser.UserID;
         newAction.DateCreation = DateTime.Today;
         newAction.DateAction = DateTime.Today;
         newAction.Hour = DateTime.Now;
         newAction.Actif = true;
         //action type="CV envoyé"
         ParamTypeAction typeAction = new ParamTypeActionRepository().GetParamTypeActionByLibelle("CV envoyé");
         if(typeAction != null)
             newAction.TypeAction = typeAction.ParamActionID;
         new ActionRepository().Insert(newAction);
     }
 }