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);
    }
Exemplo n.º 2
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();
    }