Beispiel #1
0
        // GET: api/UrgentIssue
        public HttpResponseMessage Get(string Company = null, string JobNum = null, string PartNum = null, string LotNum = null)
        {
            if (Company == null || Company == "")
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, $"Company is Null!"));
            }
            if (JobNum == null || JobNum == "")
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, $"JobNum is Null!"));
            }
            if (PartNum == null || PartNum == "")
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, $"PartNum is Null!"));
            }
            try
            {
                BusinessLayer   BL     = new BusinessLayer();
                UrgentIssueList entity = BL.GetUrgentIssueList(Company, JobNum, PartNum, LotNum);

                return(Request.CreateResponse(HttpStatusCode.OK, entity));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message.ToString()));
            }
            //return new string[] { "value1", "value2" };
        }
Beispiel #2
0
        public string UpdateUrgentIssueList(UrgentIssueList objUrgentIssueList)
        {
            string msg    = string.Empty;
            DAL    objDAL = new DAL();

            msg = objDAL.UpdateUrgentIssueList(objUrgentIssueList);
            return(msg);
        }
Beispiel #3
0
        public UrgentIssueList GetUrgentIssueList(string Company, string JobNum, string PartNum, string LotNum)
        {
            UrgentIssueList objUrgentIssueList = new UrgentIssueList();
            DAL             objDAL             = new DAL();

            objUrgentIssueList = objDAL.GetUrgentIssueListData(Company, JobNum, PartNum, LotNum);

            return(objUrgentIssueList);
        }
Beispiel #4
0
        public HttpResponseMessage Post([FromBody] UrgentIssueList urgentIssueList)
        {
            try
            {
                if (urgentIssueList != null)
                {
                    if (string.IsNullOrEmpty(urgentIssueList.Company))
                    {
                        return(Request.CreateErrorResponse(HttpStatusCode.NotFound, $"Company is Null!"));
                    }
                    if (string.IsNullOrEmpty(urgentIssueList.JobNum))
                    {
                        return(Request.CreateErrorResponse(HttpStatusCode.NotFound, $"JobNum is Null!"));
                    }
                    if (string.IsNullOrEmpty(urgentIssueList.PartNum))
                    {
                        return(Request.CreateErrorResponse(HttpStatusCode.NotFound, $"PartNum is Null!"));
                    }
                    //if (string.IsNullOrEmpty(urgentIssueList.LotNum))
                    //{
                    //    return Request.CreateErrorResponse(HttpStatusCode.NotFound, $"LotNum is Null!");
                    //}
                    if (string.IsNullOrEmpty(urgentIssueList.IUM))
                    {
                        return(Request.CreateErrorResponse(HttpStatusCode.NotFound, $"IUM is Null!"));
                    }
                    if (Convert.ToDecimal(urgentIssueList.Qty) <= 0)
                    {
                        return(Request.CreateErrorResponse(HttpStatusCode.NotAcceptable, $"Qty is Null!"));
                    }
                    if (Convert.ToString(urgentIssueList.AssemblySeq) == null || Convert.ToString(urgentIssueList.AssemblySeq) == "")
                    {
                        return(Request.CreateErrorResponse(HttpStatusCode.NotAcceptable, $"AssemblySeq is Null!"));
                    }
                    if (Convert.ToString(urgentIssueList.MtlSeq) == null || Convert.ToString(urgentIssueList.MtlSeq) == "")
                    {
                        return(Request.CreateErrorResponse(HttpStatusCode.NotAcceptable, $"MtlSeq is Null!"));
                    }
                    if (string.IsNullOrEmpty(urgentIssueList.FromWH))
                    {
                        return(Request.CreateErrorResponse(HttpStatusCode.NotFound, $"FromWH is Null!"));
                    }
                    if (string.IsNullOrEmpty(urgentIssueList.FromBin))
                    {
                        return(Request.CreateErrorResponse(HttpStatusCode.NotFound, $"FromBin is Null!"));
                    }
                    if (string.IsNullOrEmpty(urgentIssueList.ToWH))
                    {
                        return(Request.CreateErrorResponse(HttpStatusCode.NotFound, $"ToWH is Null!"));
                    }
                    if (string.IsNullOrEmpty(urgentIssueList.ToBin))
                    {
                        return(Request.CreateErrorResponse(HttpStatusCode.NotFound, $"ToBin is Null!"));
                    }

                    BusinessLayer BL  = new BusinessLayer();
                    string        msg = BL.UpdateUrgentIssueList(urgentIssueList);
                    return(Request.CreateResponse(HttpStatusCode.OK, msg));
                }
                else
                {
                    throw new Exception("Object is Null!");
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message.ToString()));
            }
        }