public Int32 UpdateStatus(int intDistIdno, bool Status, Int32 empIdno)
        {
            int value = 0;

            try
            {
                using (TransportMandiEntities db = new TransportMandiEntities(MultipleDBDAL.strDynamicConString()))
                {
                    DistanceMast objDistMast = (from mast in db.DistanceMasts
                                                where mast.Distance_Idno == intDistIdno
                                                select mast).FirstOrDefault();
                    if (objDistMast != null)
                    {
                        objDistMast.Emp_Idno = empIdno;
                        objDistMast.Status   = Status;
                        db.SaveChanges();
                        value = 1;
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(value);
        }
        public int Insert(Int64 FrmCity, Int64 ToCity, Int64 KMS, bool status, Int64 ViA, Int32 empIdno)
        {
            int value = 0;

            try
            {
                using (TransportMandiEntities db = new TransportMandiEntities(MultipleDBDAL.strDynamicConString()))
                {
                    DistanceMast Dist = db.DistanceMasts.Where(r => r.FrmCity_Idno == FrmCity && r.ViaCity_Idno == ViA && r.ToCity_Idno == ToCity).FirstOrDefault();
                    if (Dist == null)
                    {
                        DistanceMast ObjDistance = new DistanceMast();
                        ObjDistance.Emp_Idno     = empIdno;
                        ObjDistance.FrmCity_Idno = FrmCity;
                        ObjDistance.ToCity_Idno  = ToCity;
                        ObjDistance.KMs          = KMS;
                        ObjDistance.Status       = status;
                        ObjDistance.ViaCity_Idno = ViA;
                        db.DistanceMasts.AddObject(ObjDistance);
                        db.SaveChanges();
                        value = 1;
                    }
                    else
                    {
                        value = -1;
                    }
                }
            }
            catch (Exception ex)
            {
                value = 0;
            }
            return(value);
        }
        public int Delete(int intDistIdno)
        {
            int intValue = 0;

            try
            {
                using (TransportMandiEntities db = new TransportMandiEntities(MultipleDBDAL.strDynamicConString()))
                {
                    DistanceMast objDistMast = (from mast in db.DistanceMasts
                                                where mast.Distance_Idno == intDistIdno
                                                select mast).FirstOrDefault();
                    if (objDistMast != null)
                    {
                        db.DistanceMasts.DeleteObject(objDistMast);
                        db.SaveChanges();
                        intValue = 1;
                    }
                }
            }
            catch (Exception Ex)
            {
                if (Convert.ToBoolean(Ex.InnerException.Message.Contains("The DELETE statement conflicted with the REFERENCE constraint")) == true)
                {
                    intValue = -1;
                }
            }
            return(intValue);
        }