Example #1
0
        public ActionResult Create()
        {
            try
            {
                sc.CheckSecurity(AppRoles.All, Session[SessionName.UserName.ToString()].ToString());
            }
            catch
            {
                return(RedirectToAction("Login", "Home"));
            }

            ViewBag.ShowPrice         = "none";
            ViewBag.ShowLineItemPrice = "none";

            MasterRequisition mr = new MasterRequisition();

            mr.MasterReqID           = 0;
            mr.MasterReqNbrSpecified = true;
            mr.RequestID             = "MReq".ToUniqueID();
            mr.RequestMode           = "MReqMode".ToUniqueID();
            mr.Description3          = "Status, Inwork";
            mr.CMSDatabase           = Properties.Settings.Default.DB2Database;
            //mr.Requisitioner = "1295";
            mr.Buyer = "SYS";


            mr.VendorList.Clear();
            mr.VendorList = vnRepository.GetVendorList(string.Empty);


            Requisitioner rq = new Requisitioner();
            string        u  = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString().ToUserIDWithoutDomain().ToUpper(); //In case we ever want to use Windows Login ID

            u  = Session[SessionName.UserName.ToString()].ToString().ToUpper();                                                          //Use the CMS User name
            rq = repository.GetRequisitionerByID(u);

            mr.Requisitioner = rq.ID;

            try
            {
                Session[SessionName.ProjectCode.ToString()] = mr.ProjectCodeSummary;
            }
            catch
            {
                Session[SessionName.ProjectCode.ToString()] = "";
            }
            return(View(mr));
        }
Example #2
0
        public ActionResult SubmitReqSupervisor()
        {
            try
            {
                sc.CheckSecurity(AppRoles.All, Session[SessionName.UserName.ToString()].ToString());
            }
            catch
            {
                return(RedirectToAction("Login", "Home"));
            }

            string MasterReqID = Session[SessionName.MReqID.ToString()].ToString();
            string SupID       = string.Empty;

            MasterRequisition mReq   = masterRepository.GetMasterRequisitionByID(MasterReqID);
            List <ReqDetail>  reqDet = reqDetRepository.GetRequisitionsByMasterReqID(MasterReqID);
            Requisitioner     reqr   = reqRepository.GetRequisitionerByUserName(Session[SessionName.UserName.ToString()].ToString());

            foreach (ReqDetail req in reqDet)
            {
                Approval routeApproval = new Approval();

                routeApproval.RequisitionNumber = Convert.ToInt32(req.RequestID.ToString());
                routeApproval.SupervisorID      = GetRequisitionerManager(reqr.ID);
                routeApproval.Level             = 1;
                routeApproval.Pass              = 1;
                routeApproval.Status            = "P";
                routeApproval.SubmittedUserName = reqr.UserName;

                Int32 returnValue = approvalRepository.InsertApprovalRoute(routeApproval);
                SupID = routeApproval.SupervisorID;
            }
            SendEmailNotice(SupID, reqDet, MasterReqID, mReq.Description1);

            return(RedirectToAction("Index", "Home"));
        }
Example #3
0
        public ActionResult Create()
        {
            try
            {
                sc.CheckSecurity(AppRoles.All, Session[SessionName.UserName.ToString()].ToString());
            }
            catch
            {
                return(RedirectToAction("Login", "Home"));
            }


            ReqDetail rd = new ReqDetail();

            rd.RequisitionNumber = 0;

            rd.RequestID          = "ReqID".ToUniqueID();
            rd.RequestMode        = "ReqModeID".ToUniqueID();
            rd.CMSDatabase        = Properties.Settings.Default.DB2Database.ToString();
            rd.Qty                = 1;
            rd.UnitOfMeasure      = "EA";
            rd.OrderUnit          = "EA";
            rd.RequiredDate       = DateTime.Now.AddDays(30);
            rd.InventoryStockroom = "DFTSTK";
            rd.Buyer              = "SYS";

            ViewBag.ShowPrice         = "block";
            ViewBag.ShowLineItemPrice = "none";
            //rd.GlAccount = 86833430;

            Requisitioner rq = new Requisitioner();
            string        u  = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString().ToUserIDWithoutDomain().ToUpper(); //In case we ever want to use Windows Login ID

            u  = Session[SessionName.UserName.ToString()].ToString().ToUpper();                                                          //Use the CMS User name
            rq = reqRepository.GetRequisitionerByID(u);
            rd.Requisitioner = rq.ID;

            rd.GLAccountList.Clear();
            rd.GLAccountList = glRepository.GetGLAccountList(u);

            rd.UoMList.Clear();
            rd.UoMList = uomRepository.GetUoMList();

            rd.TaxGroupList.Clear();
            rd.TaxGroupList = tgRepository.GetTaxGroupList();

            rd.ProjectList.Clear();
            rd.ProjectList = prjRepository.GetProjectList(u);


            try
            {
                if (!(Session[SessionName.GLAccount.ToString()] is null))
                {
                    rd.GlAccount = Convert.ToDecimal(Session[SessionName.GLAccount.ToString()].ToString());
                    rd.DeptCode  = GetDeptCode(rd.GlAccount);
                }
                else
                {
                    var item = rd.GLAccountList.FirstOrDefault();
                    rd.GlAccount = item.Number;
                    rd.DeptCode  = GetDeptCode(rd.GlAccount);
                }

                if (!(Session[SessionName.DateRequired.ToString()] is null))
                {
                    rd.RequiredDate = Convert.ToDateTime(Session[SessionName.DateRequired.ToString()].ToString());
                }

                if (!(Session[SessionName.Dept.ToString()] is null))
                {
                    rd.DeptCode = Session[SessionName.Dept.ToString()].ToString();
                }

                if (!(Session[SessionName.VendorCode.ToString()] is null))
                {
                    rd.VendorCode = Session[SessionName.VendorCode.ToString()].ToString();

                    Vendor vndr = vnRepository.GetVendorByID(rd.VendorCode);
                    rd.VendorName   = vndr.VendorName;
                    rd.TaxGroupCode = vndr.TaxGroupCode;

                    if (rd.TaxGroupCode.Length > 0)
                    {
                        rd.TaxRateList.Clear();
                        rd.TaxRateList = trRepository.GetTaxRateList(rd.TaxGroupCode);
                    }
                    else
                    {
                        rd.TaxRateList.Clear();
                    }

                    rd.VendorPartList.Clear();
                    rd.VendorPartList = vpRepository.GetVendorPartList(string.Empty, rd.VendorCode);
                }
                if (!(Session[SessionName.ProjectCode.ToString()] is null))
                {
                    rd.ProjectCode = Session[SessionName.ProjectCode.ToString()].ToString();
                }
            }