Exemplo n.º 1
0
 public Object ViewRecord(Int64 BulkID)
 {
     BulkMeterList vwBulk = new BulkMeterList();
     try
     {
         vwBulk = DAL.DALBulkMeter.ViewBulkMeterRecord(BulkID.ToString());
     }
     catch (Exception ex)
     {
         throw;
     }
     return vwBulk;
 }
Exemplo n.º 2
0
        public static BulkMeterList ViewBulkMeterRecord(String MeterID)
        {
            BulkMeterList objmeter = new BulkMeterList();
            using (var context = new SycousCon())
            {
                try
                {
                    var parmode = new SqlParameter
                    {
                        ParameterName = "mode",
                        Value = "3",
                        Direction = ParameterDirection.Input
                    };

                    var parField = new SqlParameter
                    {
                        ParameterName = "Field",
                        Value = "",
                        Direction = ParameterDirection.Input
                    };

                    var parFieldValue = new SqlParameter
                    {
                        ParameterName = "FieldValue",
                        Value = "",
                        Direction = ParameterDirection.Input
                    };

                    var parMeter = new SqlParameter
                    {
                        ParameterName = "BulkID",
                        Value = MeterID,
                        Direction = ParameterDirection.Input
                    };
              objmeter = context.ExecuteStoreQuery<BulkMeterList>("exec SYCOUS.BulkMeterList @mode,@Field,@FieldValue ,@BulkID", parmode, parField, parFieldValue, parMeter).FirstOrDefault();
                }
                catch (Exception ex)
                {
                    context.Dispose();
                    throw;
                }
            }
            return objmeter;
        }
Exemplo n.º 3
0
        public JsonResult SaveAllUnAssign(String mBulk)
        {
            if (Session["Login"] != null)
            {
                LoginSession loginsession = (LoginSession)Session["Login"];
                if (!String.IsNullOrEmpty(mBulk))
                {
                    try
                    {
                        DAL.BulkMeterList Bulkmeter = new DAL.BulkMeterList();
                        Bulkmeter = BAL.BulkMeterModel.ViewBulkMeter(mBulk);
                        IEnumerable<DAL.MeterDetails> MeterList = null;
                        MeterList = BAL.BulkMeterModel.GetMeterDeatailsRecordList(Bulkmeter.ClientID, Bulkmeter.SiteID, Bulkmeter.SupplyID, Bulkmeter.ID);
                        List<BulkMeterInproperty> BulkMeterList = new List<BulkMeterInproperty>();
                        foreach (var Item in MeterList)
                        {
                            BulkMeterList.Add(new BulkMeterInproperty { Property = Item.PropertyID, Meter = Item.ID, BulkID = Bulkmeter.ID, CreateBy = Convert.ToInt64(loginsession.UserID), SupplyID = Bulkmeter.SupplyID });

                        }

                        if (BAL.BulkMeterModel.SaveUnAssignBulkMeterInProperty(BulkMeterList.Cast<Object>().ToList()))
                        {

                            return Json(new { Result = "true" }, JsonRequestBehavior.AllowGet);
                        }
                        else
                        {
                            return Json(new { Result = "false" }, JsonRequestBehavior.AllowGet);
                        }
                    }
                    catch (Exception ex)
                    {
                        return Json(new { Result = "false", Message = ex.Message.ToString() }, JsonRequestBehavior.AllowGet);
                    }

                }
                else
                { return Json(new { Result = "false", Message = "Enter Start Date" }, JsonRequestBehavior.AllowGet); }//if
            }
            else {
                return Json(new { Result = "false"}, JsonRequestBehavior.AllowGet);
            }
        }
Exemplo n.º 4
0
        public ActionResult SaveUnAssign(List<BulkMeterInproperty> BulkMeter)
        {
            if (Session["Login"] != null)
             {
                 LoginSession loginsession = (LoginSession)Session["Login"];
                 try
                 {
                     List<BulkMeterInproperty> BulkMeterList = new List<BulkMeterInproperty>();
                     BulkMeterList = BulkMeter;
                     BulkMeterList.Select(c => { c.CreateBy = Convert.ToInt64(loginsession.UserID); return c; }).ToList();
                     var bulkmeterID = BulkMeterList.Select(a => a.BulkID).FirstOrDefault();
                     DAL.BulkMeterList meter = new DAL.BulkMeterList();
                     meter = BAL.BulkMeterModel.ViewBulkMeter(bulkmeterID.ToString());
                     BulkMeterList.Select(c => { c.SupplyID = meter.SupplyID.ToString(); return c; }).ToList();

                    // if (BAL.BulkMeterModel.SaveUnAssignBulkMeterInProperty(BulkMeter.Cast<Object>().ToList()))
                     if (BAL.BulkMeterModel.SaveUnAssignBulkMeterInProperty(BulkMeterList.Cast<Object>().ToList()))
                     {

                         return Json(new { Result = "true" }, JsonRequestBehavior.AllowGet);
                     }
                     else
                     {
                         return Json(new { Result = "false" }, JsonRequestBehavior.AllowGet);
                     }

                 }
                 catch (Exception ex)
                 {
                     return Content("Error:" + ex.StackTrace.ToString());
                 }

             }
            // return Json(new { Result = false }, JsonRequestBehavior.AllowGet);
             return View();
        }
Exemplo n.º 5
0
 public ActionResult DView(String MeterID)
 {
     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 (MeterID != null)
         {
             String DecMeterID = BAL.Security.URLDecrypt(MeterID);
             DAL.BulkMeterList meter = new DAL.BulkMeterList();
             if ((DecMeterID != "0") && (DecMeterID != null))
             {
                 meter = BAL.BulkMeterModel.ViewBulkMeter(DecMeterID);
                 ViewBag.MeterID = meter.ID;
             }
             return View(meter);
         }
         else
         { return RedirectToAction("Index", "BulkMeter"); }
     }
     else
     { return RedirectToAction("Index", "Home"); }
 }