Beispiel #1
0
        /// <summary>
        /// insertHeadCountHR
        /// </summary>
        /// <param name="headcount"></param>
        /// <param name="itemCatalog"></param>
        /// <param name="newEmployee"></param>
        private void insertHeadCountHR(Headcount headcount, List <ItemCatalog> itemCatalog, string newEmployee)
        {
            string             _JobFunction        = base.Factory == "LT" ? "JobFunction" : "JobFunctionKSZ";
            string             _Title              = base.Factory == "LT" ? "Title" : "TitleKSZ";
            Budget_HeadCountHR _Budget_HeadCountHR = this._budget_HeadCountHRService.GetByName(headcount.AltwName);

            if (_Budget_HeadCountHR == null)
            {
                _Budget_HeadCountHR = new Budget_HeadCountHR();
            }
            string _FactoryType = base.Factory == "LT" ? "L" : "K";

            _Budget_HeadCountHR.Account = this._budget_HeadCountHRService.GetAll().Where(x => x.AltwName == headcount.AltwName).ToList().Count > 0 ? this._budget_HeadCountHRService.GetAll().Where(x => x.AltwName == headcount.AltwName).First().Account : newEmployee;

            _Budget_HeadCountHR.AltwName           = headcount.AltwName;
            _Budget_HeadCountHR.ItemId_DirectType  = itemCatalog.Where(x => x.ClassName == "DirectType" && x.Name.Trim() == headcount.DirectType.Trim()).ToList().Count > 0 ? itemCatalog.Where(x => x.ClassName == "DirectType" && x.Name.Trim() == headcount.DirectType.Trim()).First().ItemId : "";
            _Budget_HeadCountHR.ItemId_JobFunction = itemCatalog.Where(x => x.ClassName == _JobFunction && x.Name.Trim() == headcount.JobFunction.Trim()).ToList().Count > 0 ? itemCatalog.Where(x => x.ClassName == _JobFunction && x.Name.Trim() == headcount.JobFunction.Trim()).First().ItemId : "";
            _Budget_HeadCountHR.ItemId_Title       = itemCatalog.Where(x => x.ClassName == _Title && x.Name.Trim().ToLower() == headcount.Title.Trim().ToLower()).ToList().Count > 0 ? itemCatalog.Where(x => x.ClassName == _Title && x.Name.Trim().ToLower() == headcount.Title.Trim().ToLower()).First().ItemId : "";
            _Budget_HeadCountHR.IsDel = false;
            if (_Budget_HeadCountHR.Id == 0)
            {
                this._budget_HeadCountHRService.Create(_Budget_HeadCountHR);
            }
            else
            {
                this._budget_HeadCountHRService.Update(_Budget_HeadCountHR);
            }
        }
Beispiel #2
0
        public HttpResponseMessage Headcount(string userName)
        {
            Headcount report = new Headcount(userName)
            {
                loggedUser = loggedUser
            };

            HttpResponseMessage result = null;

            try
            {
                result         = Request.CreateResponse(HttpStatusCode.OK);
                result.Content = new StreamContent(new MemoryStream(report.generate()));
                result.Content.Headers.ContentDisposition          = new ContentDispositionHeaderValue("attachment");
                result.Content.Headers.ContentDisposition.FileName = report.fileName;
                result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
                return(result);
            }
            catch (Exception ex)
            {
                HttpError err = new HttpError("Helper: " + report.DebugErrorHelper + " " + ex.ToString());
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, err));
            }
        }