コード例 #1
0
        public ActionResult Create()
        {
            int depotid  = Convert.ToInt32(Session["CurrentDepotID"].ToString());
            int branchid = Convert.ToInt32(Session["CurrentBranchID"].ToString());
            int userId   = Convert.ToInt32(Session["UserID"].ToString());

            ViewBag.depot = db.tblDepots.ToList();
            //ViewBag.depot = (from c in db.tblDepots where c.ID == depotid select c).ToList();
            ViewBag.employee           = db.EmployeeMasters.ToList();
            ViewBag.employeerec        = db.EmployeeMasters.ToList();
            ViewBag.Customer           = db.CustomerMasters.ToList();
            ViewBag.Movement           = db.CourierMovements.ToList();
            ViewBag.Employee           = db.EmployeeMasters.ToList();
            ViewBag.FAgent             = db.ForwardingAgentMasters.ToList();
            ViewBag.Movement           = db.CourierMovements.ToList();
            ViewBag.ProductType        = db.ProductTypes.ToList();
            ViewBag.parceltype         = db.ParcelTypes.ToList();
            ViewBag.customerrate       = db.CustomerRates.ToList();
            ViewBag.TypeofGoods        = db.TypeOfGoods.ToList();
            ViewBag.CourierDescription = db.CourierDescriptions.ToList();
            InScanMasterVM   obj   = new InScanMasterVM();
            PickupRequestDAO _dao  = new PickupRequestDAO();
            string           AWBNo = _dao.GetMaAWBNo(branchid);

            obj.AWBNo       = AWBNo;
            obj.BranchID    = branchid;
            obj.DepotID     = depotid;
            obj.AcCompanyID = Convert.ToInt32(Session["CurrentCompanyID"].ToString());
            obj.DeviceID    = "WebSite";
            int pickedupid = (from e in db.EmployeeMasters where e.UserID == userId select e.EmployeeID).First();

            obj.TransactionDate = DateTime.Now;
            return(View(obj));
        }
コード例 #2
0
        public ActionResult Create(InScanMasterVM v)
        {
            //PickupRequestDAO _dao = new PickupRequestDAO();

            if (ModelState.IsValid)
            {
                int depotid  = Convert.ToInt32(Session["CurrentDepotID"].ToString());
                int branchid = Convert.ToInt32(Session["CurrentBranchID"].ToString());

                int uid = Convert.ToInt32(Session["UserID"].ToString());


                InScanMaster _enquiry = new InScanMaster();

                int id = (from c in db.CustomerEnquiries orderby c.EnquiryID descending select c.EnquiryID).FirstOrDefault();

                PickupRequestDAO _dao  = new PickupRequestDAO();
                string           AWBNo = _dao.GetMaAWBNo(branchid);

                _enquiry.ConsignmentNo   = v.AWBNo;
                _enquiry.TransactionDate = DateTime.Now;

                _enquiry.Consignor                  = v.Consignor;
                _enquiry.ConsignorContact           = v.ConsignorContact;
                _enquiry.ConsignorPhone             = v.ConsignorPhone;
                _enquiry.ConsignorAddress1_Building = v.ConsignorAddress1_Building;
                _enquiry.ConsignorAddress2_Street   = v.ConsignorAddress2_Street;
                _enquiry.ConsignorAddress3_PinCode  = v.ConsignorAddress2_Pincode;
                _enquiry.ConsignorCityName          = v.ConsignorCityName;
                _enquiry.ConsignorCountryName       = v.ConsignorCountryName;
                _enquiry.ConsignorLocationName      = v.ConsignorLocationName;


                _enquiry.Consignee             = v.Consignee;
                _enquiry.ConsigneeContact      = v.ConsigneeContact;
                _enquiry.ConsigneePhone        = v.ConsigneePhone;
                _enquiry.ConsigneeLocationName = v.ConsigneeLocationName;
                _enquiry.ConsigneeCountryName  = v.ConsigneeCountryName;
                _enquiry.ConsigneeCityName     = v.ConsigneeCityName;

                _enquiry.Weight      = v.Weight;
                _enquiry.AcCompanyID = 1;
                _enquiry.CustomerID  = v.CustomerID;


                _enquiry.PickedupDate  = v.PickupDateTime;
                _enquiry.PickedUpEmpID = v.PickupBy;
                _enquiry.Remarks       = v.Remarks;

                _enquiry.DepotReceivedBy = v.ReceivedByID;

                db.InScanMasters.Add(_enquiry);
                db.SaveChanges();

                TempData["SuccessMsg"] = "You have successfully added InScan Master";
                return(RedirectToAction("Index"));
            }
            else
            {
                int depotid = Convert.ToInt32(Session["CurrentDepotID"].ToString());
                int userId  = Convert.ToInt32(Session["CurrentUserID"].ToString());
                ViewBag.depot = db.tblDepots.ToList();
                //ViewBag.depot = (from c in db.tblDepots where c.ID == depotid select c).ToList();
                ViewBag.employee           = db.EmployeeMasters.ToList();
                ViewBag.employeerec        = db.EmployeeMasters.ToList();
                ViewBag.Customer           = db.CustomerMasters.ToList();
                ViewBag.Movement           = db.CourierMovements.ToList();
                ViewBag.Employee           = db.EmployeeMasters.ToList();
                ViewBag.FAgent             = db.ForwardingAgentMasters.ToList();
                ViewBag.Movement           = db.CourierMovements.ToList();
                ViewBag.ProductType        = db.ProductTypes.ToList();
                ViewBag.parceltype         = db.ParcelTypes.ToList();
                ViewBag.customerrate       = db.CustomerRates.ToList();
                ViewBag.TypeofGoods        = db.TypeOfGoods.ToList();
                ViewBag.CourierDescription = db.CourierDescriptions.ToList();
                //InScanMasterVM obj = new InScanMasterVM();
                //obj.BranchID = Convert.ToInt32(Session["CurrentBranchID"].ToString());
                //obj.DepotID = Convert.ToInt32(Session["CurrentDepotID"].ToString());
                //obj.AcCompanyID = Convert.ToInt32(Session["CurrentCompanyID"].ToString());
                //obj.DeviceID = "WebSite";
                //int pickedupid = (from e in db.EmployeeMasters where e.UserID == userId select e.EmployeeID).First();

                //obj.TransactionDate = DateTime.Now;
                return(View(v));
            }
            //else
            //{
            //    int uid = Convert.ToInt32(Session["UserID"].ToString());

            //    UserRegistration u = (from c in db.UserRegistrations where c.UserID == uid select c).FirstOrDefault();
            //    int empid = u.UserID;
            //    string empname = u.UserName;

            //    ViewBag.Country = db.CountryMasters.ToList();
            //    ViewBag.City = db.CityMasters.ToList();
            //    ViewBag.Location = db.LocationMasters.ToList();
            //    ViewBag.Vehicle = db.VehicleMasters.ToList();
            //    ViewBag.Employee = db.EmployeeMasters.ToList();
            //    ViewBag.Customer = db.CustomerMasters.ToList();
            //    ViewBag.RequestType = db.RequestTypes.ToList();
            //    ViewBag.empname = empname;
            //    ViewBag.empid = empid;
            //    PickupRequestDAO doa = new PickupRequestDAO();
            //    ViewBag.RequestNo = doa.GetMaxPickupRequest();
            //    return View();
            //}
        }