Ejemplo n.º 1
0
        public ActionResult CreateNotes(String pConsumerID, String pOwnerID, String ppropertyID, String pSiteID, String pClientID, String pMeterID)
        {
            if (Session["Login"] != null)
             {
                 try
                 {
                     LoginSession loginsession = (LoginSession)Session["Login"];
                     if ((pClientID != null) && (!String.IsNullOrEmpty(pClientID)) && (pSiteID != null) && (!String.IsNullOrEmpty(pSiteID)) && (ppropertyID != null) && (!String.IsNullOrEmpty(ppropertyID)) && (pConsumerID != null) && (!String.IsNullOrEmpty(pConsumerID)) && (pMeterID != null) && (!String.IsNullOrEmpty(pMeterID)) && (pMeterID != null) && (!String.IsNullOrEmpty(pMeterID)))
                     {
                         CorrespondenceNotesMaster corres = new CorrespondenceNotesMaster();
                         corres.ClientID = pClientID;
                         corres.SiteID = pSiteID;
                         corres.PropertyID = ppropertyID;
                         corres.MeterID = pMeterID;
                         corres.OwnerID = pOwnerID;
                         corres.ConsumerID = pConsumerID;
                         UserInformation userinfo = new UserInformation();
                         userinfo.UserID = Convert.ToInt64(loginsession.UserID);
                         if (userinfo.GetUserFirstname() != null)
                         {
                         corres.Author = userinfo.GetUserFirstname();
                         }

                         return PartialView("AddNotes", corres);
                     }
                     else { return Content(" Try Again"); }
                 }
                 catch (Exception ex)
                 { return Content("Error:" + ex.StackTrace.ToString()); }
             }
             else
             { return RedirectToAction("Index", "Home"); }
        }
Ejemplo n.º 2
0
        public ActionResult InsertRecord(CorrespondenceNotesMaster model)
        {
            if (Session["Login"] != null)
             {
                 LoginSession loginsession = (LoginSession)Session["Login"];

                 //if (String.IsNullOrEmpty(model.Notes.ToString()))
                 //{
                 //    ModelState.AddModelError("Notes ", "Please Select  Date ");
                 //}

                 try
                 {
                     if (ModelState.IsValid)
                     {
                         SearchConsumer Consumerobj = new SearchConsumer();
                         Consumerobj.ClientID = model.ClientID;
                         Consumerobj.SiteID = model.SiteID;
                         Consumerobj.PropertyID = model.PropertyID;
                         Consumerobj.MeterID = model.MeterID;
                         Consumerobj.OwnerID = model.OwnerID;
                         Consumerobj.ConsumerID = model.ConsumerID;

                         UserInformation userinfo = new UserInformation();
                         userinfo.UserID = Convert.ToInt64(loginsession.UserID);
                         if (userinfo.GetUserFirstname() != null)
                         {
                             model.Author =  userinfo.GetUserFirstname();
                         }

                         model.CreateBy = Convert.ToInt64(loginsession.UserID);
                         if (BAL.CorrespondenceModel.CreateCorrespondenceNotes(model))
                         {
                             TempData["SearchParamList"] = Consumerobj;
                             return Json(new { result = 1, message = "Record was successfully Saved!" });
                         }
                         else
                         {
                             TempData["SearchParamList"] = Consumerobj;
                             return Json(new { result = 0, message = "Try again " });
                         }
                     }
                     else
                     {
                         String errorMessage = String.Empty;
                         String exception = String.Empty;
                         foreach (var modelStateVal in ViewData.ModelState.Values)
                         {
                             foreach (var error in modelStateVal.Errors)
                             {
                                 errorMessage = error.ErrorMessage;
                                 exception = error.Exception.ToString();
                             }
                         }
                         return Content("ErrorMessage" + ":" + exception);
                     }
                 }
                 catch (Exception ex)
                 { return Content("ErrorMessage" + ":" + ex.Message); }

             }
             else
             { return RedirectToAction("Index", "Home"); }
        }
Ejemplo n.º 3
0
 public static Boolean CreateCorrespondenceNotes(CorrespondenceNotesMaster Correspondence)
 {
     Boolean flag = false;
        try
        {
        IRecordInsert objtext = new BALCorrespondence();
        flag = objtext.AddRecord(Correspondence);
        }
        catch (Exception ex)
        {
        throw;
        }
        return flag;
 }