Ejemplo n.º 1
0
        public void Delete(int Id)
        {
            tbl_Location location = db.tbl_Location.Find(Id);

            db.tbl_Location.Remove(location);
            Save();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get Location details By ID -Srikanth
        /// </summary>
        /// <param name="locationID"></param>
        /// <returns></returns>
        public PartialViewResult GetLocationByID(string locationID)
        {
            LocationModel LM = new LocationModel();

            LM = LocationBL.MLocationModel();
            tbl_Location location;

            LocationBL.EmailID = User.Identity.Name;
            location           = LocationBL.GetByID(locationID.Trim());

            if (location == null)
            {
                location = new tbl_Location();
            }
            LM.LocationID   = location.LocationID;
            LM.LocationDesc = location.LocationDesc;
            LM.Address1     = location.Address1;
            LM.Address2     = location.Address2;
            LM.Address3     = location.Address3;
            LM.POBox        = location.POBox;
            LM.Contact      = location.Contact;
            LM.Phone        = location.Phone;
            LM.Fax          = location.Fax;
            LM.Email        = location.Email;
            LM.City         = location.City;
            LM.Region       = location.Region;
            LM.Country      = location.Country;
            LM.BusinessArea = location.BusinessArea;
            LM.FieldArea    = location.FieldArea;
            LM.CashLoan     = location.CashLoan;

            return(PartialView("~/Views/Location/Partial/_LocationDetailsPartial.cshtml", LM));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Delete location by location model
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        public bool DeleteByLocationDetails(tbl_Location location)
        {
            try
            {
                Context.Location.Delete(location);
                Context.Location.Save();
                return(true);
            }
            catch (Exception ex)
            {
                //POS Log Exception to db table

                return(false);
            }
            finally
            {
                // Context = null;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Update location by location model
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        public string Update(tbl_Location location)
        {
            try
            {
                Context.Location.Update(location);
                Context.Location.Save();
                return(location.LocationDesc + " Updated Successfully!!");
            }
            catch (Exception ex)
            {
                //POS Log Exception to db table

                return("Error in saving details, Please try again!!");
            }
            finally
            {
                // Context = null;
            }
        }
Ejemplo n.º 5
0
    public bool addLocationDetails(string lat, string lon, int id)
    {
        bool _isLocated = false;

        try
        {
            tbl_Location locObj = new tbl_Location();
            locObj.Latitude   = lat;
            locObj.Longitude  = lon;
            locObj.VendorID   = id;
            locObj.CustomerID = 0;

            dbContext.tbl_Locations.InsertOnSubmit(locObj);
            dbContext.SubmitChanges();
            _isLocated = true;
        }
        catch (Exception ex)
        {
        }
        return(_isLocated);
    }
Ejemplo n.º 6
0
        /// <summary>
        /// Insert or Update in tbl_Location table -Srikanth
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        public string InsertOrUpdate(LocationModel LM)
        {
            string       result  = string.Empty;
            bool         isExist = false;
            tbl_Location location;

            location = this.GetByID(LM.LocationID.Trim());
            if (location != null)
            {
                isExist = true;
            }
            else
            {
                location = new tbl_Location();
            }
            location.LocationID   = LM.LocationID;
            location.LocationDesc = LM.LocationDesc;
            location.Address1     = LM.Address1;
            location.Address2     = LM.Address2;
            location.Address3     = LM.Address3;
            location.POBox        = LM.POBox;
            location.Contact      = LM.Contact;
            location.Phone        = LM.Phone;
            location.Fax          = LM.Fax;
            location.Email        = LM.Email;
            location.City         = LM.City;
            location.Region       = LM.Region;
            location.Country      = LM.Country;
            location.FieldArea    = LM.FieldArea;
            location.CashLoan     = LM.CashLoan;
            if (!isExist)
            {
                return(result = this.Insert(location));
            }
            else
            {
                return(result = this.Update(location));
            }
        }
Ejemplo n.º 7
0
    public List <Vendor> getVendor(string lat, string lon, string ServiceType)
    {
        double custlat = Convert.ToDouble(lat);
        double custlon = Convert.ToDouble(lon);

        tbl_Location LocObj = new tbl_Location();

        var query = from l in dbContext.tbl_Locations
                    orderby l.VendorID
                    select l;

        foreach (var vendor in query)
        {
            Vendor ven = new Vendor();
            //var v=vendor.Latitude;
            double venlat = Convert.ToDouble(vendor.Latitude);
            double venlon = Convert.ToDouble(vendor.Longitude);

            double dist = distance(venlon, custlon, venlat, custlat);

            var obj = (from r in vendorcontext.tbl_VendorLogins
                       where r.VendorID == vendor.VendorID
                       where r.MaxServiceDistance > dist
                       where r.VendorProfession.Equals(ServiceType)

                       select r).FirstOrDefault();

            if (obj != null)
            {
                ven.VendorName        = obj.VendorName;
                ven.VendorProfesssion = obj.VendorProfession;
                ven.VendorId          = obj.VendorID;
                ven.Basic             = (int)obj.VisitingCharges;
                vname.Add(ven);
            }
        }

        return(vname);
    }
 public ActionResult Create(tbl_Location location)
 {
     try
     {
         if (ModelState.IsValid)
         {
             objBs.locationBs.Insert(location);
             TempData["Msg"] = "created Succesfully";
             return(RedirectToAction("Index"));
         }
         else
         {
             TempData["Msg"] = "create failed";
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception e1)
     {
         TempData["Msg"] = "create failed: " + e1.Message;
         return(Redirect("Index"));
     }
 }
Ejemplo n.º 9
0
        public string InsertOrUpdateLocation(LocationModel LM)
        {
            string       result   = string.Empty;
            tbl_Location location = new tbl_Location();

            location.LocationID   = LM.LocationID;
            location.LocationDesc = LM.LocationDesc;
            location.Address1     = LM.Address1;
            location.Address2     = LM.Address2;
            location.Address3     = LM.Address3;
            location.POBox        = LM.POBox;
            location.Contact      = LM.Contact;
            location.Phone        = LM.Phone;
            location.Fax          = LM.Fax;
            location.Email        = LM.Email;
            location.City         = LM.City;
            location.Region       = LM.Region;
            location.Country      = LM.Country;
            location.FieldArea    = LM.FieldArea;
            location.CashLoan     = LM.CashLoan;
            result = LocationBL.InsertOrUpdate(LM);
            return(result);
        }
Ejemplo n.º 10
0
 public void Insert(tbl_Location location)
 {
     objdb.Insert(location);
 }
Ejemplo n.º 11
0
        //public void ReturnToSupplierDetails(string LocationID, string VendorID, string StorageID, string DocID, decimal? Quantity, string MaterialID, string UOM)
        //{
        //    try
        //    {
        //        int Increment = Convert.ToInt32(DocID) + 1;
        //        string DocumentID = LocationID + Increment;
        //        Context.Proc_InsertRetunToSupplier(DocumentID, LocationID, MaterialID, UOM, "VInod", StorageID, VendorID, Quantity ?? 0);
        //    }
        //    catch (Exception ex)
        //    {

        //    }
        //}

        public void UpdateDocId(tbl_Location Location)
        {
            Context.Location.Update(Location);
            Context.Location.Save();
        }
Ejemplo n.º 12
0
 public void Update(tbl_Location location)
 {
     db.Entry(location).State = EntityState.Modified;
 }
Ejemplo n.º 13
0
 partial void Inserttbl_Location(tbl_Location instance);
Ejemplo n.º 14
0
 public void Insert(tbl_Location location)
 {
     db.tbl_Location.Add(location);
     Save();
 }
Ejemplo n.º 15
0
        public string InsertTempMaterProductionOrder(string MaterialID, string UOM, string Qty, string LocationID, string UserName, string StorageID)
        {
            tbl_Location       Location   = LocationBL.GetByID(LocationID.Trim());
            int                Docid      = Convert.ToInt32(Location.Prod_Order);
            int                cnt        = Docid + 1;
            string             DocumentID = (LocationID + cnt).ToString().Trim();
            List <tbl_Company> Company    = Context.Company.Get().ToList();
            string             CompanyID  = Company.FirstOrDefault().CompanyID;

            string TempMasterID = null;

            try
            {
                tbl_TempMaster TempMasterHeader = new tbl_TempMaster();

                TempMasterHeader = Context.TempMaster.Get(e => e.LocationID == LocationID && e.DocumentID == DocumentID).FirstOrDefault();
                if (TempMasterHeader != null)
                {
                    TempMasterID = TempMasterHeader.TempMasterID.ToString();
                }
                else
                {
                    TempMasterHeader = new tbl_TempMaster();
                }

                if (TempMasterID == string.Empty || TempMasterID == null)
                {
                    TempMasterHeader.DocumentID   = DocumentID;
                    TempMasterHeader.PONumber     = DocumentID;
                    TempMasterHeader.AddDate      = DateTime.Now;
                    TempMasterHeader.CompanyID    = CompanyID;
                    TempMasterHeader.DocumentDate = DateTime.Now;
                    TempMasterHeader.Filter       = "";
                    TempMasterHeader.Filter_Id    = "";
                    TempMasterHeader.LocationID   = LocationID;
                    TempMasterHeader.PostingDate  = DateTime.Now;
                    TempMasterHeader.StorageID    = StorageID;
                    TempMasterHeader.Type         = "PDO";
                    TempMasterHeader.UserID       = UserName;
                    TempMasterHeader.DocDetail    = "Production Order";
                    Context.TempMaster.Insert(TempMasterHeader);
                    Context.TempMaster.Save();
                }

                TempMasterHeader = Context.TempMaster.Get(e => e.LocationID == LocationID && e.DocumentID == DocumentID).FirstOrDefault();
                if (TempMasterHeader != null)
                {
                    TempMasterID = TempMasterHeader.TempMasterID.ToString();
                    StorageID    = TempMasterHeader.StorageID.ToString();
                }

                tbl_TempDetail TempDetail = new tbl_TempDetail();
                TempDetail.MaterialID   = MaterialID;
                TempDetail.UOM          = UOM;
                TempDetail.AddDate      = DateTime.Now;
                TempDetail.BaseQty      = Convert.ToDecimal(Qty);
                TempDetail.CategoryID   = "";
                TempDetail.CompanyID    = CompanyID;
                TempDetail.DocumentDate = DateTime.Now;
                TempDetail.DocumentID   = DocumentID;
                TempDetail.LocationID   = LocationID;
                TempDetail.PostingDate  = DateTime.Now;
                if (StorageID == null)
                {
                }
                else
                {
                    TempDetail.StorageID = StorageID;
                }

                TempDetail.TranQty      = Convert.ToDecimal(Qty);
                TempDetail.UpdDate      = DateTime.Now;
                TempDetail.UserID       = UserName;
                TempDetail.TempMasterID = Convert.ToInt32(TempMasterID);
                TempDetail.CreditQty    = 0.00M;
                TempDetail.Cost         = 0.00M;
                TempDetail.DiscountRate = 0.00M;
                TempDetail.Amount       = 0.00M;
                TempDetail.CreditAmount = 0.00M;
                TempDetail.OrderQty     = 0.00M;
                TempDetail.Type         = "PDO";

                List <tbl_TempDetail> CheckTempDetails = Context.TempDetail.Get(e => e.LocationID == LocationID && e.MaterialID == MaterialID && e.UOM == UOM).ToList();

                if (CheckTempDetails.Count >= 1)
                {
                    TempDetail         = CheckTempDetails.FirstOrDefault();
                    TempDetail.TranQty = Convert.ToDecimal(Qty) + CheckTempDetails.FirstOrDefault().TranQty;
                    TempDetail.BaseQty = TempDetail.TranQty;

                    Context.TempDetail.Update(TempDetail);
                    Context.tempDetail.Save();
                }
                else
                {
                    Context.TempDetail.Insert(TempDetail);
                    Context.TempDetail.Save();
                }
            }
            catch (Exception ex)
            {
            }
            return(TempMasterID);
        }
Ejemplo n.º 16
0
 public void Update(tbl_Location location)
 {
     objdb.Update(location);
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Get all location from POS database
        /// </summary>
        /// <returns></returns>
        public List <tbl_Location> GetAll()
        {
            AuthenticationBL    AuthenticationBL = new AuthenticationBL();
            List <tbl_Location> Locations        = new List <tbl_Location>();

            try
            {
                EmailID = System.Web.HttpContext.Current.User.Identity.Name.ToString();
                if (EmailID == "*****@*****.**")
                {
                    if (Locations == null)
                    {
                        if (Locations.Count == 0)
                        {
                            Locations = Context.Location.Get().ToList();
                        }
                    }
                    else
                    {
                        Locations = new List <tbl_Location>();
                        Locations = Context.Location.Get().ToList();
                    }
                }
                else
                {
                    if (UserAuthentication == "UserAuthentication")
                    {
                        List <Proc_AspNetManagerLocations_Result> Proc_AspNetManagerLocations_Result = new List <Entity.Entities.Proc_AspNetManagerLocations_Result>();
                        Proc_AspNetManagerLocations_Result = AuthenticationBL.AspNetManagerLocationAuthentication(EmailID);

                        foreach (Proc_AspNetManagerLocations_Result item in Proc_AspNetManagerLocations_Result)
                        {
                            tbl_Location UserLocation = new tbl_Location();
                            UserLocation.LocationID   = item.LocationID;
                            UserLocation.LocationDesc = item.LocationDesc;
                            Locations.Add(UserLocation);
                        }
                    }
                    else
                    {
                        List <Proc_AspNetUsersLocations_Result> Proc_AspNetUsersLocations_Result = new List <Entity.Entities.Proc_AspNetUsersLocations_Result>();
                        Proc_AspNetUsersLocations_Result = AuthenticationBL.AspNetUserLocationAuthentication(EmailID);

                        foreach (Proc_AspNetUsersLocations_Result item in Proc_AspNetUsersLocations_Result)
                        {
                            tbl_Location UserLocation = new tbl_Location();
                            UserLocation.LocationID   = item.LocationID;
                            UserLocation.LocationDesc = item.LocationDesc;
                            Locations.Add(UserLocation);
                        }
                    }
                }


                return(Locations);
            }
            catch (Exception ex)
            {
                //POS Log Exception to db table

                return(null);
            }
            finally
            {
                Locations = null;
            }
        }
Ejemplo n.º 18
0
 partial void Updatetbl_Location(tbl_Location instance);
Ejemplo n.º 19
0
 partial void Deletetbl_Location(tbl_Location instance);