private void GetRiDgData(int id) { DataTable dt = new DataTable(); RIDGBll obj = new RIDGBll(); obj.Id = id; dt = obj.GetRiDgData(); if (dt.Rows.Count > 0) { DDLYears.SelectedItem.Text = dt.Rows[0]["year"].ToString(); txtRotarian.Text = dt.Rows[0]["name"].ToString(); txtClubName.Text = dt.Rows[0]["club_name"].ToString(); ddlDesignation.SelectedItem.Text = dt.Rows[0]["designation"].ToString(); txtClassification.Text = dt.Rows[0]["classification"].ToString(); txtDescription.Content = dt.Rows[0]["description"].ToString(); string strImg = dt.Rows[0]["image"].ToString(); if (strImg != "") { Session["RIDGImages"] = strImg; memImg.Visible = true; memImg.ImageUrl = "../RIDGImages/" + strImg; } } }
private void AddRiDgData() { try { /************Code for find IP address of user's machine**********/ string ipaddress; ipaddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (ipaddress == "" || ipaddress == null) { ipaddress = Request.ServerVariables["REMOTE_ADDR"]; } /***************************************************************/ RIDGBll obj = new RIDGBll(); obj.Year = DDLYears.SelectedItem.Text.ToString(); obj.Name = txtRotarian.Text.ToString(); obj.ClubName = txtClubName.Text.ToString(); obj.Designation = ddlDesignation.SelectedItem.Text.ToString(); obj.Classfication = txtClassification.Text.ToString(); obj.Description = txtDescription.Content.ToString(); obj.Ipaddress = ipaddress; if (Session["RIDGImages"] != null) { obj.Image = Session["RIDGImages"].ToString(); } else { obj.Image = ""; } int exe = obj.AddRiDgData(); if (exe > 0) { clear(); string jv = "<script>alert('Record Added Successfully');</script>"; ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "alert", jv, false); } } catch { } }
private void UpdateRiDgData(int id) { try { RIDGBll obj = new RIDGBll(); obj.Id = id; obj.Year = DDLYears.SelectedItem.Text.ToString(); obj.Name = txtRotarian.Text.ToString(); obj.ClubName = txtClubName.Text.ToString(); obj.Designation = ddlDesignation.SelectedItem.Text.ToString(); obj.Classfication = txtClassification.Text.ToString(); obj.Description = txtDescription.Content.ToString(); if (Session["RIDGImages"] != null) { obj.Image = Session["RIDGImages"].ToString(); } else { obj.Image = ""; } int exe = obj.UpdateRiDgData(); if (exe > 0) { clear(); showmsg("Record Updated Successfully", "view_ri_dg_data.aspx"); //string jv = "<script>alert('Record Updated Successfully');</script>"; //ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "alert", jv, false); } } catch { } }