public ActionResult UpdateBlock(BlockMaster model)
 {
     db.BlockMasters.Add(model);
     db.SaveChanges();
     TempData[Constants.SuccessAlert] = "Block Updated Successfully";
     return(RedirectToAction(nameof(UpdateBlock)));
 }
Ejemplo n.º 2
0
 public ActionResult CreateAndAddBlockUsage(BlockMaster blockmaster)
 {
     if (ModelState.IsValid)
     {
         blockmaster.COMPANYSITE = int.Parse(Session["companysite"].ToString());
         BlockMaster blo   = BM.Add(blockmaster, Session["userid"].ToString());
         var         model = BM.Find(blo.SID);
         Session["SID_BLOCKMASTER"]           = blo.SID;
         model.GetSelectListLandConcession    = GetSelectListLandConcession(model.LANDCONCESSION);
         model.GetSelectListBlockOrganization = GetSelectListBlockOrganization(model.BLOCKORGANIZATION);
         model.GetSelectListSoilType          = GetSelectListSoilType(model.SOILTYPE);
         model.GetSelectListVegetation        = GetSelectListVegetation(model.VEGETATION);
         model.GetSelectListTopograph         = GetSelectListTopograph(model.TOPOGRAPH);
         return(View("Edit", model));
     }
     else
     {
         blockmaster.GetSelectListLandConcession    = GetSelectListLandConcession();
         blockmaster.GetSelectListBlockOrganization = GetSelectListBlockOrganization();
         blockmaster.GetSelectListSoilType          = GetSelectListSoilType();
         blockmaster.GetSelectListVegetation        = GetSelectListVegetation();
         blockmaster.GetSelectListTopograph         = GetSelectListTopograph();
         return(View(blockmaster));
     }
 }
        public BlockMaster Add(BlockMaster BLO, string userid)
        {
            var sqlQuery = @"INSERT INTO BLOCKMASTER (IDBLOCKMASTER, BLOCKMASTERNAME, LANDCONCESSION, BLOCKORGANIZATION, SOILTYPE, VEGETATION, TOPOGRAPH, HECTARAGE, COMPANYSITE, INPUTBY, INPUTDATE, UPDATEBY, UPDATEDATE) VALUES
                           ('" + BLO.IDBLOCKMASTER + @"', '" + BLO.BLOCKMASTERNAME + "', '" + BLO.LANDCONCESSION + "', '" + BLO.BLOCKORGANIZATION + "', '" + BLO.SOILTYPE + "', '" + BLO.VEGETATION + "', '" + BLO.TOPOGRAPH + "', '" + BLO.HECTARAGE + "', '" + BLO.COMPANYSITE + @"', " + Convert.ToInt32(userid) + ", '" + DateTime.Now + @"', " + Convert.ToInt32(userid) + ", '" + DateTime.Now + @"'); " + "SELECT CAST(SCOPE_IDENTITY() as int)";
            var SID      = _db.Query <int>(sqlQuery, BLO).Single();

            BLO.SID = SID;
            return(BLO);
        }
Ejemplo n.º 4
0
        //
        // GET: /BlockMaster/Create
        public ActionResult Create()
        {
            var model = new BlockMaster();

            model.GetSelectListLandConcession    = GetSelectListLandConcession();
            model.GetSelectListBlockOrganization = GetSelectListBlockOrganization();
            model.GetSelectListSoilType          = GetSelectListSoilType();
            model.GetSelectListVegetation        = GetSelectListVegetation();
            model.GetSelectListTopograph         = GetSelectListTopograph();
            return(View(model));
        }
Ejemplo n.º 5
0
 public ActionResult Create(BlockMaster blockmaster)
 {
     if (ModelState.IsValid)
     {
         blockmaster.COMPANYSITE = int.Parse(Session["companysite"].ToString());
         BM.Add(blockmaster, Session["userid"].ToString());
         TempData["successmessage"] = "Saved successfully";
         return(RedirectToAction("Create"));
     }
     else
     {
         blockmaster.GetSelectListLandConcession    = GetSelectListLandConcession();
         blockmaster.GetSelectListBlockOrganization = GetSelectListBlockOrganization();
         blockmaster.GetSelectListSoilType          = GetSelectListSoilType();
         blockmaster.GetSelectListVegetation        = GetSelectListVegetation();
         blockmaster.GetSelectListTopograph         = GetSelectListTopograph();
         return(View(blockmaster));
     }
 }
        public BlockMaster Update(BlockMaster BLO)
        {
            var sqlQuery =
                "UPDATE BLOCKMASTER " +
                "SET IDBLOCKMASTER    = '" + BLO.IDBLOCKMASTER + "', " +
                "    BLOCKMASTERNAME  = '" + BLO.BLOCKMASTERNAME + "', " +
                "    LANDCONCESSION   = '" + BLO.LANDCONCESSION + "', " +
                "    BLOCKORGANIZATION   = '" + BLO.BLOCKORGANIZATION + "', " +
                "    SOILTYPE   = '" + BLO.SOILTYPE + "', " +
                "    VEGETATION   = '" + BLO.VEGETATION + "', " +
                "    TOPOGRAPH   = '" + BLO.TOPOGRAPH + "', " +
                "    HECTARAGE   = '" + BLO.HECTARAGE + "', " +
                "    COMPANYSITE   = '" + BLO.COMPANYSITE + "', " +
                "    UPDATEBY      = '" + Convert.ToInt32(BLO.UPDATEBY) + "', " +
                "    UPDATEDATE    = '" + BLO.UPDATEDATE + "' " +
                "WHERE SID = " + BLO.SID + "";

            this._db.Execute(sqlQuery, BLO);
            return(BLO);
        }
Ejemplo n.º 7
0
 public ActionResult Edit(BlockMaster blockmaster, int id)
 {
     if (ModelState.IsValid)
     {
         blockmaster.SID         = id;
         blockmaster.COMPANYSITE = int.Parse(Session["companysite"].ToString());
         blockmaster.UPDATEBY    = int.Parse(Session["userid"].ToString());
         blockmaster.UPDATEDATE  = DateTime.Now;
         BM.Update(blockmaster);
         return(View("Index", BM.GetAllByCompanySite(int.Parse(Session["companysite"].ToString()))));
     }
     else
     {
         blockmaster.GetSelectListLandConcession    = GetSelectListLandConcession(blockmaster.LANDCONCESSION);
         blockmaster.GetSelectListBlockOrganization = GetSelectListBlockOrganization(blockmaster.BLOCKORGANIZATION);
         blockmaster.GetSelectListSoilType          = GetSelectListSoilType(blockmaster.SOILTYPE);
         blockmaster.GetSelectListVegetation        = GetSelectListVegetation(blockmaster.VEGETATION);
         blockmaster.GetSelectListTopograph         = GetSelectListTopograph(blockmaster.TOPOGRAPH);
         return(View(blockmaster));
     }
 }
Ejemplo n.º 8
0
 // Use this for initialization
 void Awake()
 {
     s = this;
     justCreatedBlockTypes = new List <string> ();
 }