protected void btnUpdate_Click(object sender, EventArgs e) { try { // labelMessage.Text = string.Empty; using (AddGiverTracingRT receiverTransfer = new AddGiverTracingRT()) { hdIsEdit.Value = "true"; AdGiverTracing adGiverTracing = CreateadGiverTracing(); if (adGiverTracing != null) { receiverTransfer.UpdateadGiverTracing(adGiverTracing); labelMessageUpdateAddGiverTracing.Text = "Data successfully updated..."; labelMessageUpdateAddGiverTracing.ForeColor = System.Drawing.Color.Green; } else { labelMessageUpdateAddGiverTracing.Text = "Data not updated..."; labelMessageUpdateAddGiverTracing.ForeColor = System.Drawing.Color.Red; } } ClearField(); LoadAdGiverTracingUpdate(); } catch (Exception ex) { labelMessageUpdateAddGiverTracing.Text = "Error : " + ex.Message; labelMessageUpdateAddGiverTracing.ForeColor = System.Drawing.Color.Red; } }
public void RegisteredUserListView() { try { using (AddGiverTracingRT receiverTransfer = new AddGiverTracingRT()) { Int64 userId = Convert.ToInt64(Session["RegistereduserID"]); List <AdGiverTracing> adgivertracing = receiverTransfer.GetAdGiverTracingByIID(userId); if (adgivertracing != null && adgivertracing.Count > 0) { lvRegisteredUserAddGiverTracing.DataSource = receiverTransfer.GetAdGiverTracingListViewByIID(Convert.ToInt64(userId)); lvRegisteredUserAddGiverTracing.DataBind(); using (AdGiverRT receiverTransferAdgiver = new AdGiverRT()) { AdGiver e = receiverTransferAdgiver.GetAdGiverByIID(Convert.ToInt64(userId)); labelDisplayName.Text = "Welcome " + e.Name; labelDisplayEmail.Text = "Your Email Address : " + e.EmailID; labellistview.Text = e.Name + "'s Add Giver Tracing Information"; } } } } catch (Exception ex) { labelMessageRegisteredUserAddGiverTracing.Text = "Error : " + ex.Message; labelMessageRegisteredUserAddGiverTracing.ForeColor = System.Drawing.Color.Red; } }
protected void lvUpdateAdGiver_ItemCommand(object sender, ListViewCommandEventArgs e) { if (e.CommandName == "EditUpdateAdGiver") { try { labelMessageUpdateAddGiverTracing.Text = string.Empty; labelVisibility(); TextBoxVisibility(); panelVisibility(); btnUpdate.Visible = true; btnCancel.Visible = true; int AddGiverTracingID = Convert.ToInt32(e.CommandArgument); hdUpdateAdGiverID.Value = AddGiverTracingID.ToString(); using (AddGiverTracingRT receiverTransfer = new AddGiverTracingRT()) { AdGiverTracing adgivrtracing = receiverTransfer.GetAddGiverTracingIID(AddGiverTracingID); FillAddGiverTracingForEdit(adgivrtracing); } } catch (Exception ex) { labelMessageUpdateAddGiverTracing.Text = "Error : " + ex.Message; labelMessageUpdateAddGiverTracing.ForeColor = System.Drawing.Color.Red; } } }
/// <summary> /// method to get Client ip address /// </summary> /// <param name="GetLan"> set to true if want to get local(LAN) Connected ip address</param> /// <returns></returns> //public string GetVisitorIPAddress(bool GetLan = false) //{ // string visitorIPAddress = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; // if (String.IsNullOrEmpty(visitorIPAddress)) // visitorIPAddress = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; // if (string.IsNullOrEmpty(visitorIPAddress)) // visitorIPAddress = HttpContext.Current.Request.UserHostAddress; // if (string.IsNullOrEmpty(visitorIPAddress) || visitorIPAddress.Trim() == "::1") // { // GetLan = true; // visitorIPAddress = string.Empty; // } // if (GetLan && string.IsNullOrEmpty(visitorIPAddress)) // { // //This is for Local(LAN) Connected ID Address // string stringHostName = Dns.GetHostName(); // //Get Ip Host Entry // IPHostEntry ipHostEntries = Dns.GetHostEntry(stringHostName); // //Get Ip Address From The Ip Host Entry Address List // IPAddress[] arrIpAddress = ipHostEntries.AddressList; // try // { // visitorIPAddress = arrIpAddress[arrIpAddress.Length - 2].ToString(); // } // catch // { // try // { // visitorIPAddress = arrIpAddress[0].ToString(); // } // catch // { // try // { // arrIpAddress = Dns.GetHostAddresses(stringHostName); // visitorIPAddress = arrIpAddress[0].ToString(); // } // catch // { // visitorIPAddress = "127.0.0.1"; // } // } // } // } // txtIPAddress.Text = visitorIPAddress.ToString(); // return visitorIPAddress; //} protected void btnSave_Click(object sender, EventArgs e) { try { labelMessageAddGiverTracing.Text = string.Empty; using (AddGiverTracingRT receiverTransfer = new AddGiverTracingRT()) { AdGiverTracing addGivrTrc = CreateAdGiverTracing(); receiverTransfer.InsertAdGiverTracing(addGivrTrc); if (addGivrTrc.IID > 0) { labelMessageAddGiverTracing.Text = "Data successfully saved..."; labelMessageAddGiverTracing.ForeColor = System.Drawing.Color.Green; } else { labelMessageAddGiverTracing.Text = "Data not saved..."; labelMessageAddGiverTracing.ForeColor = System.Drawing.Color.Red; } } ClearField(); //LoadUserGrp(); } catch (Exception ex) { labelMessageAddGiverTracing.Text = "Error : " + ex.Message; labelMessageAddGiverTracing.ForeColor = System.Drawing.Color.Red; } }
private void LoadAdGiverTracingUpdate() { try { using (AddGiverTracingRT receiverTransfer = new AddGiverTracingRT()) { lvUpdateAdGiver.DataSource = receiverTransfer.GetAdGiverTracingAllForListView(); lvUpdateAdGiver.DataBind(); } } catch (Exception ex) { labelMessageUpdateAddGiverTracing.Text = "Error : " + ex.Message; labelMessageUpdateAddGiverTracing.ForeColor = System.Drawing.Color.Red; } }