Beispiel #1
0
        public ActionResult GetCropListArea(watershed_policy vil)
        {
            List <watershed_crop>  clist = DAL.CropDal.GetListCrop();
            watershed_village_data data  = this.Session["villagedata"] as watershed_village_data;
            String str  = "<option value=''>select</option>";
            double area = vil.cultivated_area;

            if (area < data.watershed_village.Area)
            {
                foreach (watershed_crop cr in clist)
                {
                    double waterreq = (cr.waterreq * area * 1000);
                    if (waterreq < data.waterreq)
                    {
                        str += "<option value='" + cr.crop_id + "'>" + cr.cname + waterreq + "</option>";
                    }
                }
            }
            try
            {
                return(Json(new
                {
                    msg = "success ",
                    list = str
                }));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool AddPolicy(watershed_policy policy)
        {
            watershedEntities db = new watershedEntities();
            watershed_policy  p  = db.watershed_policy.Add(policy);

            db.SaveChanges();
            if (null != p)
            {
                return(true);
            }
            return(false);
        }
 public ActionResult SelectCrop(watershed_policy crop)
 {
     WaterShed.WaterShedservice.Service1Client sc = new WaterShed.WaterShedservice.Service1Client();
     if (sc.AddPolicy(crop))
     {
         ViewData.Add("SelectCrop", "success");
     }
     else
     {
         ViewData.Add("SelectCrop", "fail");
     }
     return(View());
 }
Beispiel #4
0
 bool IService1.AddPolicy(watershed_policy policy)
 {
     return(BOL.VillageBOL.AddPolicy(policy));
 }