Beispiel #1
0
        public HttpResponseMessage Get(string id)
        {
            try
            {
                iRecruit.Entity.Indent ind = this._repo.GetIndent(id);
                string          user       = iRecruit.Security.Extensions.FetchUserFromRequestHeader(this.ActionContext);
                DepartmentRoles roles      = new MasterRepository().GetDepartmentRoles().Where(f => f.BranchID.Equals(ind.BranchID) && f.DepartmentID.Equals(ind.DepartmentID)).FirstOrDefault();
                IndentModel     model      = new IndentModel()
                {
                    Indent = ind,
                    DisableIndenterAccess = 1,
                    DisableFHAccess       = 1,
                    DisableSVPAccess      = 1
                };

                if ((ind.AssignedTo ?? "").Length == 0 && (ind.CreatedBy ?? "").Equals(user))
                {
                    model.DisableIndenterAccess = 0;
                }
                if (roles != null)
                {
                    if ((roles.FunctionHead ?? "").Equals(user))
                    {
                        model.DisableFHAccess = 0;
                    }
                    if ((roles.SVP ?? "").Equals(user))
                    {
                        model.DisableSVPAccess = 0;
                    }
                }
                // build jd path
                string filePath = ind.UploadFile_Indents ?? "";
                if (!string.IsNullOrWhiteSpace(filePath))
                {
                    string f = filePath.Substring(filePath.LastIndexOf("\\") + 1);
                    model.JDUrl = "/JobDescriptions/" + ind.IndentNumber + "/" + f; //Request.GetRequestContext().VirtualPathRoot +
                }
                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, model);

                return(response);
            }
            catch (Exception ex)
            {
                _tracer.Error(Request, this.ControllerContext.ControllerDescriptor.ControllerType.FullName, ex.StackTrace);
                return(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content = new StringContent(ex.Message)
                });
            }
        }
Beispiel #2
0
        public async Task <List <spGetIndent_Result> > GetIndent(IndentModel obj)
        {
            try
            {
                var sp     = Helpers.StringGenerator.GetProcedureParameter(obj, SPConstants.spGetIndent);
                var result = await _connectContext.spGetIndent
                             .FromSqlRaw(sp, obj.UID_UserId_Owner, obj.LoginId, obj.Roll, obj.SBK_MNS_Id, obj.SBK_SaleType)
                             .ToListAsync();

                return(result);
            }
            catch (Exception ex)
            {
                _ILogger.Log(LogLevel.Critical, "Exception while calling SpRegistrationTeam ", ex);
                return(new List <spGetIndent_Result>());
            }
        }
Beispiel #3
0
        public async Task <IActionResult> GetIndent(long UID_UserId_Owner, long LoginId, string Roll, long SBK_MNS_Id, string SBK_SaleType)
        {
            var obj = new IndentModel
            {
                UID_UserId_Owner = UID_UserId_Owner,
                LoginId          = LoginId,
                Roll             = Roll,
                SBK_MNS_Id       = SBK_MNS_Id,
                SBK_SaleType     = SBK_SaleType,
            };

            if (ModelState.IsValid)
            {
                return(Ok(await _orderService.GetIndent(obj)));
            }
            else
            {
                return(UnprocessableEntity());
            }
        }