示例#1
0
        protected void btn_AddRow_Click(object sender, EventArgs e)
        {
            _listStructureAndLocationDto = (List <StructureAndLocationDto>)Session[SessionVariables.listStructureAndLocationCoefficient];
            var newValue = new StructureAndLocationDto();

            _listStructureAndLocationDto.Add(newValue);

            this.gv_Coefficients.DataSource = _listStructureAndLocationDto;
            this.gv_Coefficients.DataBind();
        }
示例#2
0
        public StructureAndLocationResultDto DeleteCoefficients(StructureAndLocationDto structureAndLocationDto)
        {
            EmployeeMembershipCoefficientsRepository.Delete(structureAndLocationDto.Id, structureAndLocationDto.UserId);

            var result = new StructureAndLocationResultDto();

            result.Success = true;

            return(result);
        }
示例#3
0
        public Root <StructureAndLocationResultDto> SaveCoefficients([FromUri] StructureAndLocationDto structureAndLocationDto)
        {
            var list = new List <StructureAndLocationResultDto>();

            var result = _structureAndLocationService.SaveCoefficients(structureAndLocationDto);

            list.Add(result);

            return(new Root <StructureAndLocationResultDto> {
                Items = list
            });
        }
示例#4
0
        private void SaveOld()
        {
            var value = new StructureAndLocationDto()
            {
                Id                   = Convert.ToInt32(_id.Text),
                EmployeeId           = GetIdFromUrl(),
                OrganizationalUnitId = Convert.ToInt32(_ddl_OrganizationalUnit.Text),
                OrganizationalCellId = Convert.ToInt32(_ddl_OrganizationalCell.Text),
                SiloId               = Convert.ToInt32(_ddl_Silo.Text),
                Coefficient          = Convert.ToDouble(_tb_Coefficient.Text)
            };

            var v = PageMethodsHelper.InvokeWebAPI <StructureAndLocationResultDto>(
                WebAPIVariables.saveCoefficients,
                PageMethodsHelper.ObjectToUrlParam(value)
                ).FirstOrDefault();
        }
示例#5
0
        public StructureAndLocationResultDto SaveCoefficients(StructureAndLocationDto structureAndLocationDto)
        {
            B_EmployeeMembershipCoefficients coefficients;
            B_OrganizationalUnit             organizationalUnit = new B_OrganizationalUnit();
            B_OrganizationalCell             organizationalCell = new B_OrganizationalCell();
            B_Silo silo = new B_Silo();

            organizationalUnit.SetId(structureAndLocationDto.OrganizationalUnitId);
            organizationalCell.SetId(structureAndLocationDto.OrganizationalCellId);
            silo.SetId(structureAndLocationDto.SiloId);

            if (structureAndLocationDto.Id == 0)
            {
                var employee = new B_Employee();
                employee.SetId(structureAndLocationDto.EmployeeId);

                coefficients = new B_EmployeeMembershipCoefficients()
                {
                    Employee = employee,
                    FromDate = DateTime.Now,
                };
            }
            else
            {
                coefficients = EmployeeMembershipCoefficientsRepository.Load(structureAndLocationDto.Id);
            }

            coefficients.OrganizationalUnit = organizationalUnit;
            coefficients.OrganizationalCell = organizationalCell;
            coefficients.Silo        = silo;
            coefficients.Coefficient = (float)structureAndLocationDto.Coefficient;

            EmployeeMembershipCoefficientsRepository.SaveAndFlush(coefficients, structureAndLocationDto.UserId);

            var result = new StructureAndLocationResultDto();

            result.Success = true;
            result.Id      = coefficients.Id;

            return(result);
        }
示例#6
0
        private void CommandDelete(GridViewCommandEventArgs e)
        {
            _rowIndex = int.Parse(e.CommandArgument.ToString());
            _gridView.SelectedIndex = _rowIndex;
            _id = (Label)_gridView.Rows[_rowIndex].FindControl("IdLabel");

            if (!(string.IsNullOrEmpty(_id.Text) || _id.Text.Equals("0")))
            {
                var esc = new StructureAndLocationDto()
                {
                    Id     = Convert.ToInt32(_id.Text),
                    UserId = SessionUser.Id
                };
                PageMethodsHelper.InvokeWebAPI <StructureAndLocationResultDto>(
                    WebAPIVariables.deleteCoefficients, PageMethodsHelper.ObjectToUrlParam(esc)).FirstOrDefault();
            }

            _listStructureAndLocationDto = PageMethodsHelper.InvokeWebAPI <StructureAndLocationDto>(
                WebAPIVariables.structureAndLocation, "?employeeId=" + GetIdFromUrl());

            Session[SessionVariables.listStructureAndLocationCoefficient] = _listStructureAndLocationDto;
            this.gv_Coefficients.DataSource = _listStructureAndLocationDto;
            this.gv_Coefficients.DataBind();
        }