Esempio n. 1
0
    private void BindControl()
    {
        CollegeMsts msts    = new CollegeMsts();
        CollegeMst  collmst = msts.Details(Convert.ToInt32(Request.QueryString["EID"].ToString()));

        txtCollName.Text       = collmst.CollegeName;
        txtDetails.Text        = collmst.CollegeDesc;
        ddlstate.SelectedValue = collmst.StateID.ToString();
    }
 public String EditColl(CollegeMst objMst)
 {
     try
     {
         db.Entry(objMst).State = EntityState.Modified;
         db.SaveChanges();
         return("0");
     }
     catch (Exception ex)
     {
         return("1");
     }
     finally
     {
         db.Dispose();
     }
 }
 public String CreateColl(CollegeMst objMst)
 {
     try
     {
         db.CollegeMsts.Add(objMst);
         db.SaveChanges();
         return("0");
     }
     catch (Exception ex)
     {
         return("1");
     }
     finally
     {
         db.Dispose();
     }
 }
 public CollegeMst Details(int?id)
 {
     try
     {
         CollegeMst CollMst = db.CollegeMsts.Find(id);
         return(CollMst);
     }
     catch (Exception ex)
     {
         CollegeMst CollMst = null;
         return(CollMst);
     }
     finally
     {
         db.Dispose();
     }
 }
 public String DeleteColl(int id)
 {
     try
     {
         CollegeMst CollMst = db.CollegeMsts.Find(id);
         db.CollegeMsts.Remove(CollMst);
         db.SaveChanges();
         return("0");
     }
     catch (Exception ex)
     {
         return("1");
     }
     finally
     {
         db.Dispose();
     }
 }
Esempio n. 6
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        try
        {
            CollegeMst mst = new CollegeMst();
            mst.CollegeID   = Convert.ToInt32(Request.QueryString["EID"].ToString());
            mst.CollegeName = txtCollName.Text.Trim();
            mst.CollegeDesc = txtDetails.Text.Trim();
            mst.StateID     = Convert.ToInt32(ddlstate.SelectedValue.Trim());


            CollegeMsts cooldata = new CollegeMsts();
            String      strerr   = cooldata.EditColl(mst);
            if (strerr == "0")
            {
                Response.Redirect("~/College/CollegeDetails", false);
            }
        }
        catch (Exception ex)
        {
        }
    }
Esempio n. 7
0
    protected void btnCreate_Click(object sender, EventArgs e)
    {
        try
        {
            CollegeMst mst = new CollegeMst();

            mst.CollegeName = txtCollege.Text.Trim();
            mst.CollegeDesc = txtDetails.Text.Trim();

            mst.StateID = Convert.ToInt32(ddlstate.SelectedValue.Trim());


            CollegeMsts Colldata = new CollegeMsts();
            String      strerr   = Colldata.CreateColl(mst);
            if (strerr == "0")
            {
                Response.Redirect("~/CollegeJoining/CJDetails", false);
            }
        }
        catch (Exception ex)
        {
        }
    }