public List <Regioninfo> SelectallRegioninfo()
 {
     try
     {
         List <Regioninfo> lstinfo = new List <Regioninfo>();
         using (RMSDataContext db = new RMSDataContext())
         {
             Regioninfo rinfo;
             var        a = (from o in db.Regions select o).ToList();
             foreach (var obj in a)
             {
                 rinfo                    = new Regioninfo();
                 rinfo.RegionID           = obj.RegionID;
                 rinfo.Region_Name        = obj.Region_Name;
                 rinfo.Region_Description = obj.Region_Description;
                 lstinfo.Add(rinfo);
             }
             return(lstinfo);
         }
     }
     catch (Exception ex)
     {
         return(new List <Regioninfo>());
     }
 }
        protected void btnSaveRegion_Click(object sender, EventArgs e)
        {
            Regioninfo Regiinfo = new Regioninfo();

            //  Regiinfo.RegionID=txtRegionID.Text;
            Regiinfo.Region_Name        = txtRegionName.Text;
            Regiinfo.Region_Description = txtRegionDescription.Text;
            RegionController RegiController = new RegionController();

            RegiController.InsertRegion(Regiinfo);
            gridviewcall();
        }
 public void DeleteRegioinByRegionID(Regioninfo regioninfo)
 {
     try
     {
         using (RMSDataContext db = new RMSDataContext())
         {
             var obj = (from a in db.Regions where a.RegionID == regioninfo.RegionID select a).First();
             db.Regions.DeleteOnSubmit(obj);
             db.SubmitChanges();
         }
     }
     catch (Exception ex)
     {
         Region Region = new Region();
     }
 }
 public void UpdateRegionByRegionID(Regioninfo regioninfo)
 {
     try
     {
         using (RMSDataContext db = new RMSDataContext())
         {
             var obj = (from a in db.Regions where a.RegionID == regioninfo.RegionID select a).First();
             obj.RegionID           = regioninfo.RegionID;
             obj.Region_Name        = regioninfo.Region_Name;
             obj.Region_Description = regioninfo.Region_Description;
             db.SubmitChanges();
         }
     }
     catch (Exception ex)
     {
         Region Region = new Region();
     }
 }
示例#5
0
 public void DeleteRegion(Regioninfo Regioninfo)
 {
     Regdao.DeleteRegioinByRegionID(Regioninfo);
 }
示例#6
0
 public void UpdateRegion(Regioninfo Regioninfo)
 {
     Regdao.UpdateRegionByRegionID(Regioninfo);
 }
示例#7
0
 public void InsertRegion(Regioninfo Regioninfo)
 {
     // Regdao.InsertRegion(Regioninfo);
 }