Beispiel #1
0
        private void CreateRecord(int formId)
        {
            int?nrTotalHorasFormacao     = GetIntValueFromInput(NrTotalHorasFormacaoInput.Text);
            int?nrDiasAusenciaTrabalho   = GetIntValueFromInput(NrDiasAusenciaTrabalhoInput.Text);
            int?nrDiasUteisPeriodo       = GetIntValueFromInput(NrDiasUteisPeriodoInput.Text);
            int?nrColaboradoresAdmitidos = GetIntValueFromInput(NrColaboradoresAdmitidosInput.Text);
            int?nrSaidas = GetIntValueFromInput(NrSaidasInput.Text);

            using (var db = new Models.SmizeeContext())
            {
                HumanResourceForm entity = new HumanResourceForm();
                entity.StateID             = 1;
                entity.FormID              = formId;
                entity.EmployeesHired      = nrColaboradoresAdmitidos;
                entity.EmployeesLeft       = nrSaidas;
                entity.TrainingTotalHours  = nrTotalHorasFormacao;
                entity.WorkingDaysInPeriod = nrDiasUteisPeriodo;
                entity.WorkMissingDays     = nrDiasAusenciaTrabalho;
                entity.SubmitDate          = DateTime.Now;
                entity.ApprovalDate        = DateTime.Parse("01/01/2000 00:00:00");
                entity.SubmitUserName      = User.Identity.Name;

                db.HumanResourceForms.Add(entity);
                db.SaveChanges();
            }
            BackPanel.Visible          = true;
            ConfirmButtonPanel.Visible = false;
            DetailPanel.Visible        = false;
            ShowInfo(MessagePanel, Resources.Resource.mCreateOK);
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SetTransactionOptions(Options, true, false, false, false, false, false, false);
                SetPageDescription(Resources.MainMenu.IM_03_05);
                currentOption = Options.SelectedValue;

                string pu      = Request.QueryString["PU"];
                string fefid   = Request.QueryString["FID"];
                string stateid = Request.QueryString["ST"];
                if (fefid != null)
                {
                    CompanyFormID.Value        = fefid;
                    currentOption              = "UPD";
                    OptionsPanel.Visible       = false;
                    SearchPanel.Visible        = false;
                    DetailPanel.Visible        = true;
                    ConfirmButtonPanel.Visible = true;
                    HumanResourceForm entity = CxHumanResourceForm.GetFormById(int.Parse(fefid));
                    FormMessageLiteral.Text = GetPeriodMessage(Resources.Resource.lForm2Message, entity.PeriodNumber, entity.Form.Periodicity.Code, entity.FormDate);
                    if (stateid == "3")
                    {
                        DetailPanel.Enabled        = false;
                        ApprovePanel.Visible       = true;
                        ConfirmButtonPanel.Visible = false;
                        FormMessageLiteral.Text    = "";
                    }

                    ProductionUnitLiteral.Text = pu;
                    FillDateLiteral.Text       = DateTime.Now.ToShortDateString();
                    ShowCurrentForm(int.Parse(fefid));
                }
            }
            else
            {
                currentOption = Options.SelectedValue;
                User user      = WebSecurity.GetUserInfo(Page.User.Identity.Name);
                int? companyId = user.CompanyID;

                if (companyId != null && companyId != 0)
                {
                    ddlCompany.SelectedValue = companyId.ToString();
                    ddlCompany.Enabled       = false;
                }
            }
        }