Ejemplo n.º 1
0
        public int SaveorsubmitCombi(CombiPackRequest cmbSave)
        {
            try
            {
                CombiReqService = new CombiPackRequestService();

                int iUserAdd = 0;
                if (!string.IsNullOrEmpty(cmbSave.Email))
                {
                    admUser.FirstName = cmbSave.FirstName;
                    admUser.LastName  = cmbSave.LastName;
                    admUser.UserId    = cmbSave.UserId;
                    admUser.Email     = cmbSave.Email;
                    iUserAdd          = admService.AddUserData(admUser);
                }
                if (!string.IsNullOrEmpty(cmbSave.SecondUserEmail))
                {
                    admUser.FirstName = cmbSave.SecondUserFirstName;
                    admUser.LastName  = cmbSave.SecondUserLastName;
                    admUser.UserId    = cmbSave.SecondUserId;
                    admUser.Email     = cmbSave.SecondUserEmail;
                    iUserAdd          = admService.AddUserData(admUser);
                }
                //SOCB - LRMS change - Submit Request to procurement Manager
                if (!string.IsNullOrEmpty(cmbSave.SecondUserEmail))
                {
                    admUser.FirstName = cmbSave.ProcMgrFirstName;
                    admUser.LastName  = cmbSave.ProcMgrLastName;
                    admUser.UserId    = cmbSave.ProcMgrUserId;
                    admUser.Email     = cmbSave.ProcMgrEmail;
                    iUserAdd          = admService.AddUserData(admUser);
                }
                //EOCB - LRMS change - Submit Request to procurement Manager
                int i = 0;
                i = CombiReqService.SaveCombiDetails(cmbSave);
                return(i);
            }
            catch (Exception ex)
            {
                NameValueCollection additionalInfo = new NameValueCollection();
                additionalInfo.Add("PageName", "CombiPackFormD");
                ExceptionManager.Publish(ex, additionalInfo);
                return(0);
            }
        }
Ejemplo n.º 2
0
        public HttpResponseMessage GetNewPackDetails(GetReqParam temp)
        {
            NewPackReqService = new NewPackRequestService();
            npReqVM           = new NewPackRequestViewModel();
            cmbService        = new CombiPackRequestService();
            DateTime dtFirstSaleCheck = new DateTime();

            //npReqVM = NewPackReqService.GetNewRequestDetails(Convert.ToInt32(reqID), Convert.ToInt32(reqType));
            try
            {
                if (temp.RequestID != string.Empty)
                {
                    npReqVM = NewPackReqService.GetNewRequestDetails(Convert.ToInt32(temp.RequestID), Convert.ToInt32(temp.ReqType));
                }
                else
                {
                    npReqVM = NewPackReqService.GetNewRequestDetails(0, Convert.ToInt32(temp.ReqType));
                }


                if (npReqVM.NewPackRequest != null && npReqVM.NewPackRequest.GetReactivation_Request == "1")
                {
                    HttpContext.Current.Session["ifshow"] = "Yes";
                }
                else
                {
                    HttpContext.Current.Session["ifshow"] = "No";
                }

                if (Convert.ToInt32(temp.ReqType) == 2)
                {
                    int ret = cmbService.GetNumberofDays("New Pack");
                    dtFirstSaleCheck = DateTime.Now.AddDays(ret);
                    npReqVM.NPCAPresonSynBrandPack = true;
                }
                else if (Convert.ToInt32(temp.ReqType) == 3)
                {
                    int ret = cmbService.GetNumberofDays("Country Add");
                    dtFirstSaleCheck = DateTime.Now.AddDays(ret);
                    npReqVM.NPCAPresonSynBrandPack = false;
                }

                //SOCB - LRMS change - Added Procurement Manager
                npReqVM.ProcurementManager = HttpContext.Current.Session[Constants.USER_REGION].ToString().Equals(Constants.REGION_LATAM) ? true : false;
                //EOCB - LRMS change - Added Procurement Manager

                DisplayTypeSpecificFields(Convert.ToInt32(temp.ReqType), 0);
                if (npReqVM.NewPackRequest != null)
                {
                    isChild = Convert.IsDBNull(npReqVM.NewPackRequest.GetIsChild) ? 0 : npReqVM.NewPackRequest.GetIsChild;
                    if (Convert.ToInt32(temp.ReqType) == 2 && isChild != 1)
                    {
                        //check with team
                    }

                    DisplayTypeSpecificFields(Convert.ToInt32(temp.ReqType), isChild);
                    string strOther = string.IsNullOrEmpty(npReqVM.NewPackRequest.GetOtherData) ? string.Empty : npReqVM.NewPackRequest.GetOtherData;
                    if (strOther != string.Empty)
                    {
                        if (strOther.Split(',')[0] != string.Empty)
                        {
                            if (Convert.ToInt32(temp.ReqType) == 3)
                            {
                                if (base.PageDisable("CA", Convert.ToInt32(strOther.Split(',')[0])) == 1)
                                {
                                    DisableControls();
                                }
                                else if (base.PageDisable("CA", Convert.ToInt32(strOther.Split(',')[0])) == 2)
                                {
                                    npReqVM.SubmitEnabledNPR = true;
                                }
                            }
                            else if (Convert.ToInt32(temp.ReqType) == 2)
                            {
                                if (base.PageDisable("NP", Convert.ToInt32(strOther.Split(',')[0])) == 1)
                                {
                                    DisableControls();
                                }
                                else if (base.PageDisable("NP", Convert.ToInt32(strOther.Split(',')[0])) == 2)
                                {
                                    npReqVM.SubmitEnabledNPR = true;
                                }
                            }
                        }
                    }
                }
                npReqVM.Region = HttpContext.Current.Session["Region"] != null ? HttpContext.Current.Session["Region"].ToString() : string.Empty;
                return(Request.CreateResponse(HttpStatusCode.OK, npReqVM));
            }
            catch (Exception ex)
            {
                NameValueCollection additionalInfo = new NameValueCollection();
                additionalInfo.Add("PageName", "NewPackRequest");
                ExceptionManager.Publish(ex, additionalInfo);
                //Message = errMessages.GetString("Error in loading Other Range request data from Controller");
                errEntity.ErrorNumber = 420;
                errEntity.ErrorMess   = "Error in GetNewPackDetails method of NewPackRequest controller." + ex.InnerException;
                npReqVM.ErrorBE       = errEntity;
                return(Request.CreateResponse(HttpStatusCode.OK, npReqVM));
            }
        }
Ejemplo n.º 3
0
        public HttpResponseMessage GetNewPackDetails(int requestID)
        {
            cprVM = new CombiPackRequestViewModel();
            try
            {
                CombiReqService = new CombiPackRequestService();
                cprVM           = CombiReqService.GetCombiDetails(requestID);
                if (cprVM.CombiPackRequest.IsSynBrdPack1 != null && cprVM.CombiPackRequest.IsSynBrdPack2 != null)
                {
                    if (cprVM.CombiPackRequest.IsSynBrdPack1.Trim().ToLower() == "yes" || cprVM.CombiPackRequest.IsSynBrdPack2.Trim().ToLower() == "yes")
                    {
                        cprVM.CombiPackRequest.IsSynBrdPack = "Yes";
                    }
                    else if (cprVM.CombiPackRequest.IsSynBrdPack3 != null)
                    {
                        if (cprVM.CombiPackRequest.IsSynBrdPack3.Trim().ToLower() == "yes")
                        {
                            cprVM.CombiPackRequest.IsSynBrdPack = "Yes";
                        }
                        else if (cprVM.CombiPackRequest.IsSynBrdPack4 != null)
                        {
                            if (cprVM.CombiPackRequest.IsSynBrdPack4.Trim().ToLower() == "yes")
                            {
                                cprVM.CombiPackRequest.IsSynBrdPack = "Yes";
                            }
                            else
                            {
                                cprVM.CombiPackRequest.IsSynBrdPack = "No";
                            }
                        }
                        else
                        {
                            cprVM.CombiPackRequest.IsSynBrdPack = "No";
                        }
                    }
                    else
                    {
                        cprVM.CombiPackRequest.IsSynBrdPack = "No";
                    }
                }

                DateTime dtFirstSaleCheck = new DateTime();
                int      ret = CombiReqService.GetNumberofDays("Combi Pack");
                dtFirstSaleCheck = DateTime.Now.AddDays(ret);

                int iIsPresent = 0;
                if (cprVM.CombiPackRequest != null)
                {
                    iIsPresent = Convert.IsDBNull(cprVM.CombiPackRequest.isSucess) ? 0 : cprVM.CombiPackRequest.isSucess;
                }
                if (iIsPresent == 3 || iIsPresent == 1)
                {
                    if (cprVM.CombiPackRequest.SourceLocally)
                    {
                        cprVM.CPSourceLocallyDetailsEnable = false;
                    }
                    else
                    {
                        cprVM.CPSourceLocallyDetailsEnable = true;
                    }
                }

                string strOther = string.Empty;
                if (cprVM.CombiPackRequest != null)
                {
                    strOther = string.IsNullOrEmpty(cprVM.CombiPackRequest.OtherData) ? string.Empty : cprVM.CombiPackRequest.OtherData;
                }
                if (strOther != string.Empty)
                {
                    if (base.PageDisable("CMBI", Convert.ToInt32(strOther.Split(',')[0])) == 1)
                    {
                        DisableControls();
                    }
                    else if (base.PageDisable("CMBI", Convert.ToInt32(strOther.Split(',')[0])) == 2)
                    {
                        cprVM.SubmitEnableCP = false;
                    }
                }
                cprVM.Region = HttpContext.Current.Session[Constants.USER_REGION] != null ? HttpContext.Current.Session[Constants.USER_REGION].ToString() : string.Empty;
                return(Request.CreateResponse(HttpStatusCode.OK, cprVM));
            }
            catch (Exception ex)
            {
                NameValueCollection additionalInfo = new NameValueCollection();
                additionalInfo.Add("PageName", "CombiPackFormD");
                ExceptionManager.Publish(ex, additionalInfo);
                //Message = errMessages.GetString("Admin - To get new pack details");
                errEntity.ErrorNumber = 420;
                errEntity.ErrorMess   = "Error in GetNewPackDetails method of combipackformD controller";
                cprVM.ErrorBE         = errEntity;
                return(Request.CreateResponse(HttpStatusCode.OK, cprVM));
            }
        }