public static SiteCreditControlList ViewSiteCreditControlRecord(Int64 CreditId)
        {
            SiteCreditControlList objcredit = new SiteCreditControlList();
            using (var context = new SycousCon())
            {
                try
                {
                    objcredit = (from D in context.SiteCreditControls
                                 join S in context.SiteMasters
                                 on D.SiteID equals S.Id
                                 join C in context.ClientMasters
                                 on S.ClientID equals C.ClientID
                                 where (D.IsDeleted == 0 && S.IsDeleted == 0 && C.DeleteStatus == 0)
                                 orderby D.CreateDate descending, D.ModifyDate descending
                                 select new SiteCreditControlList()
                                 {
                                     ID = SqlFunctions.StringConvert((Double)D.ID).Trim(),
                                     Client = C.Name,
                                     Site = S.SiteName,
                                     Residential = SqlFunctions.StringConvert((Double)D.Residential).Trim(),
                                     Commercial = SqlFunctions.StringConvert((Double)D.Commercial).Trim(),
                                     Residential2 = SqlFunctions.StringConvert((Double)D.Residential2).Trim(),
                                     Commercial2 = SqlFunctions.StringConvert((Double)D.Commercial2).Trim()
                                 }).FirstOrDefault();

                }
                catch (Exception ex)
                {
                    context.Dispose();
                    throw;
                }

                return objcredit;
            }//using
        }
 public ActionResult CView(String CreditID)
 {
     if (Session["Login"] != null)
     {
         LoginSession loginsession = (LoginSession)Session["Login"];
         ViewBag.CompanyLogo = loginsession.CompanyLogo;
         ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType);
         String actionName = this.ControllerContext.RouteData.Values["action"].ToString();
         String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
         ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, actionName, BAL.Common.LayoutType(loginsession.UserType));
         ViewBag.RoleName = loginsession.RoleName;
         if (CreditID != null)
         {
             String DecCreditID = BAL.Security.URLDecrypt(CreditID);
             DAL.SiteCreditControlList credit = new DAL.SiteCreditControlList();
             if ((DecCreditID != "0") && (DecCreditID != null))
             {
                 try
                 {
                     credit = BAL.CreditControlModel.ViewCreditControl(DecCreditID);
                 }
                 catch (Exception ex)
                 {
                     return Content("Execption:" + ex.Message);
                 }
             }
             return View(credit);
         }
         else
         { return RedirectToAction("Index", "Credit"); }
     }
     else
     { return RedirectToAction("Index", "Home"); }
 }
 public Object ViewRecord(Int64 CreditId)
 {
     SiteCreditControlList _control = new SiteCreditControlList();
     try
     {
         _control = DAL.DALCreditControl.ViewSiteCreditControlRecord(Convert.ToInt64(CreditId));
     }
     catch (Exception ex)
     {
         throw;
     }
     return _control;
 }