protected void btnSave_Click(object sender, EventArgs e) { BusinessLayer.Member ObjMember = new BusinessLayer.Member(); Entity.Member Member = new Entity.Member(); Member.MemberId = MemberId; Member.MemberName = txtMemberName.Text.Trim(); Member.FormNo = txtFormNo.Text.Trim(); Member.FirmName = txtFirmName.Text.Trim(); Member.Address = txtAddress.Text.Trim(); Member.BlockName = txtBlockName.Text; Member.DistrictId = int.Parse(ddlDistrict.SelectedValue.Trim()); Member.Pin = txtPin.Text.Trim(); Member.MobileNo = txtMobileNo.Text.Trim(); Member.LandLine = txtLandLine.Text.Trim(); string[] SDate = txtStartDate.Text.Trim().Split('/'); Member.StartDate = Convert.ToDateTime(SDate[1].Trim() + "/" + SDate[0].Trim() + "/" + SDate[2].Trim() + " 00:00:00"); string[] EDate = txtEndDate.Text.Trim().Split('/'); Member.EndDate = Convert.ToDateTime(EDate[1].Trim() + "/" + EDate[0].Trim() + "/" + EDate[2].Trim() + " 00:00:00"); Member.IsLifeMembership = ChkLifeMemberShip.Checked; Member.IsYearlySMSSubscriber = ChkSMSSubscriber.Checked; Member.LifeMembershipAmt = (txtLifeMembershipAmt.Text.Trim().Length == 0) ? 0 : decimal.Parse(txtLifeMembershipAmt.Text.Trim()); Member.SMSSubscriberAmt = (txtSMSSubscriberAmt.Text.Trim().Length == 0) ? 0 : decimal.Parse(txtSMSSubscriberAmt.Text.Trim()); ObjMember.Save(Member); ClearControls(); ltrMsg.Text = "Member Information Saved/Updated Successfully"; }
protected void LoadMemberDetails() { BusinessLayer.Member ObjMember = new BusinessLayer.Member(); Entity.Member Member = new Entity.Member(); Member = ObjMember.GetAllById(MemberId); if (Member != null) { txtMemberName.Text = Member.MemberName; ddlDistrict.SelectedValue = Member.DistrictId.ToString(); txtBlockName.Text = Member.BlockName; txtMobileNo.Text = Member.MobileNo; txtStartDate.Text = Member.StartDate.ToString("dd/MM/yyyy"); txtEndDate.Text = Member.EndDate.ToString("dd/MM/yyyy"); txtFormNo.Text = Member.FormNo; txtFirmName.Text = Member.FirmName; txtAddress.Text = Member.Address; txtPin.Text = Member.Pin; txtLandLine.Text = Member.LandLine; ChkLifeMemberShip.Checked = Member.IsLifeMembership; ChkSMSSubscriber.Checked = Member.IsYearlySMSSubscriber; txtLifeMembershipAmt.Text = String.Format("{0:0.##}", Member.LifeMembershipAmt); txtSMSSubscriberAmt.Text = String.Format("{0:0.##}", Member.SMSSubscriberAmt); ltrMsg.Text = ""; } }
private DataTable getMobileNumbers() { BusinessLayer.Member ObjMember = new BusinessLayer.Member(); DataTable dtMobileNos = ObjMember.getMobileNumbers(); return(dtMobileNos); }
protected void LoadMemberList() { BusinessLayer.Member ObjMember = new BusinessLayer.Member(); string FormNo = txtFormNo.Text.Trim(); int DistrictId = int.Parse(ddlDistrict.SelectedValue.Trim()); string BlockName = txtBlockName.Text; string MemberName = txtMemberName.Text.Trim(); string MobileNo = txtMobileNo.Text.Trim(); string ExpirationDate = txtExpirationDate.Text.Trim(); string SMSAmt = txtSMSSubscriberAmt.Text.Trim(); if (ExpirationDate.Length != 0) { string[] Arr = ExpirationDate.Split('/'); ExpirationDate = Arr[2].Trim() + "/" + Arr[1].Trim() + "/" + Arr[0].Trim(); } int SearchType = Convert.ToInt32(ddlExpiration.SelectedValue.Trim()); DataTable dt = ObjMember.GetAll(FormNo, DistrictId, BlockName, MemberName, MobileNo, ExpirationDate, SearchType, SMSAmt); if (Session["PageIndex"] == null) { Session["PageIndex"] = 0; } if (dt != null) { dgvMember.PageIndex = int.Parse(Session["PageIndex"].ToString()); dgvMember.DataSource = dt; dgvMember.DataBind(); Session["MemberList"] = dt; } }
protected void btnExport_Click(object sender, EventArgs e) { txtMobNoExport.Text = ""; StringBuilder sb = new StringBuilder(); int count = 0; BusinessLayer.Member ObjMember = new BusinessLayer.Member(); DataTable dt = ObjMember.getMobileNumbers(); for (int i = 0; i < dt.Rows.Count; i++) { count += 1; if (count == 50) { sb.Append(dt.Rows[i][0].ToString() + "\n\n\n"); count = 0; } else { sb.Append(dt.Rows[i][0].ToString() + ","); } } string MobList = sb.ToString(); if (MobList.LastIndexOf(',') == MobList.Length - 1) { MobList = MobList.Trim().Substring(0, MobList.Length - 1); } txtMobNoExport.Text = MobList; }
protected void dgvMember_RowDeleting(object sender, GridViewDeleteEventArgs e) { int Id = Convert.ToInt32(dgvMember.DataKeys[e.RowIndex].Value); BusinessLayer.Member ObjMember = new BusinessLayer.Member(); ObjMember.Delete(Id); LoadMemberList(); }
protected void btnSave_Click(object sender, EventArgs e) { BusinessLayer.Member ObjMember = new BusinessLayer.Member(); Entity.Member Member = new Entity.Member(); Member.MemberId = MemberId; Member.MemberName = txtMemberName.Text.Trim(); Member.FormNo = txtFormNo.Text.Trim(); Member.FirmName = txtFirmName.Text.Trim(); Member.Address = txtAddress.Text.Trim(); Member.BlockName = txtBlockName.Text; Member.DistrictId = int.Parse(ddlDistrict.SelectedValue.Trim()); Member.Pin = txtPin.Text.Trim(); Member.MobileNo = txtMobileNo.Text.Trim(); Member.LandLine = txtLandLine.Text.Trim(); string[] SDate = txtStartDate.Text.Trim().Split('/'); Member.StartDate = Convert.ToDateTime(SDate[1].Trim() + "/" + SDate[0].Trim() + "/" + SDate[2].Trim() + " 00:00:00"); string[] EDate = txtEndDate.Text.Trim().Split('/'); Member.EndDate = Convert.ToDateTime(EDate[1].Trim() + "/" + EDate[0].Trim() + "/" + EDate[2].Trim() + " 00:00:00"); Member.IsLifeMembership = ChkLifeMemberShip.Checked; Member.IsYearlySMSSubscriber = ChkSMSSubscriber.Checked; Member.LifeMembershipAmt = (txtLifeMembershipAmt.Text.Trim().Length == 0) ? 0 : decimal.Parse(txtLifeMembershipAmt.Text.Trim()); Member.SMSSubscriberAmt = (txtSMSSubscriberAmt.Text.Trim().Length == 0) ? 0 : decimal.Parse(txtSMSSubscriberAmt.Text.Trim()); Member.IsPortalMember = chkPortalMember.Checked; Member.PortalMemberAmt = (txtPortalAmount.Text.Trim().Length == 0) ? 0 : decimal.Parse(txtPortalAmount.Text.Trim()); if (chkApprovePayment.Checked == true) { Member.SubscriptionId = SubscriptionId; } else { Member.SubscriptionId = 0; } int rowsaffected = ObjMember.Save(Member); if (rowsaffected > 0) { if (MemberId == 0) { NewMemberJoiningAlert(); } if (chkApprovePayment.Checked == true) { SendNewSubscriptionAlert(txtMemberName.Text.ToString(), txtSMSSubscriberAmt.Text.Trim()); } ClearControls(); lblMessage.Text = "Member Information Saved/Updated Successfully"; lblMessage.BackColor = System.Drawing.Color.Green; } else { lblMessage.Text = "Mobile Number Already Exist"; lblMessage.BackColor = System.Drawing.Color.Red; } }
protected void btnSendNotification_Click(object sender, EventArgs e) { BusinessLayer.Member ObjMember = new BusinessLayer.Member(); DataTable dtMembers = ObjMember.getMembersForNotification(); //int maxNoOfNotification = Convert.ToInt32(BusinessLayer.Common.GetScalarValue("KeyValue", "KeyValueConfig", "KeyCode", "NOOFNOTIFICATION")); var request = WebRequest.Create("https://onesignal.com/api/v1/notifications") as HttpWebRequest; string ImageUrl = "http://api.wbpoultryfederation.org/Images/PBALBS_LargeIcon.jpg"; request.KeepAlive = true; request.Method = "POST"; request.ContentType = "application/json; charset=utf-8"; request.Headers.Add("authorization", "Basic ZGYyY2VlNGYtZDQ5MC00YTIwLWE3YzEtNDdlYTRlZmI3MDBk"); byte[] byteArray = Encoding.UTF8.GetBytes("{" + "\"app_id\": \"03b78b0e-44da-4221-ae8c-31003fbc8a6e\"," + "\"large_icon\" : \" " + ImageUrl + " \", " + "\"data\": {\"NotificationType\": \"Today\"}," + "\"contents\": {\"en\": \"PBPABS Potato rate published for today.Please Login to APP and Check!!\"}," + "\"included_segments\": [\"All\"]}"); //request.Headers.Add("authorization", "Basic ZGYyY2VlNGYtZDQ5MC00YTIwLWE3YzEtNDdlYTRlZmI3MDBk"); //byte[] byteArray = Encoding.UTF8.GetBytes("{" // + "\"app_id\": \"03b78b0e-44da-4221-ae8c-31003fbc8a6e\"," // + "\"contents\": {\"en\": \"PBPABS Potato rate published for " + member["Today"].ToString() + ". Please Login to APP and Check!!\"}," // + "\"include_player_ids\": [\"" + member["DeviceId"].ToString() + "\"]}");//PlayerId is DeviceID string responseContent = null; try { using (var writer = request.GetRequestStream()) { writer.Write(byteArray, 0, byteArray.Length); } using (var response = request.GetResponse() as HttpWebResponse) { using (var reader = new StreamReader(response.GetResponseStream())) { responseContent = reader.ReadToEnd(); } } } catch (WebException ex) { System.Diagnostics.Debug.WriteLine(ex.Message); System.Diagnostics.Debug.WriteLine(new StreamReader(ex.Response.GetResponseStream()).ReadToEnd()); } }
protected void dgvMember_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Activate")) { int Id = Convert.ToInt32(e.CommandArgument.ToString()); BusinessLayer.Member ObjMember = new BusinessLayer.Member(); ObjMember.QuickUpdate(Id); LoadMemberList(); } }
protected string VerifyMobNo() { string result = ""; BusinessLayer.Member ObjMember = new BusinessLayer.Member(); DataTable dt = ObjMember.GetAll("", 0, "", "", MobNo, "", 1, ""); if (dt.Rows.Count > 0) { result = MobNo + " Exists"; } return(result); }
protected void LoadMember() { BusinessLayer.Member ObjMember = new BusinessLayer.Member(); DataTable dt = ObjMember.GetAll("", 0, "", "", "", "", 1, ""); if (dt != null) { ddlMember.DataSource = dt; ddlMember.DataTextField = "MemberFullName"; ddlMember.DataValueField = "MemberId"; ddlMember.DataBind(); } ListItem li = new ListItem("--SELECT--", "0"); ddlMember.Items.Insert(0, li); }
protected void LoadDistrict() { BusinessLayer.Member ObjMember = new BusinessLayer.Member(); DataTable dt = ObjMember.GetDistrict(); if (dt != null) { ddlDistrict.DataSource = dt; ddlDistrict.DataTextField = "DistrictName"; ddlDistrict.DataValueField = "DistrictId"; ddlDistrict.DataBind(); } ListItem li = new ListItem("--SELECT--", "0"); ddlMember.Items.Insert(0, li); }
protected void TEST(object sender, EventArgs e) { BusinessLayer.Member ObjMember = new BusinessLayer.Member(); string ImageUrl = "http://api.wbpoultryfederation.org/Images/PBALBS_LargeIcon.jpg"; var request = WebRequest.Create("https://onesignal.com/api/v1/notifications") as HttpWebRequest; request.KeepAlive = true; request.Method = "POST"; request.ContentType = "application/json; charset=utf-8"; request.Headers.Add("authorization", "Basic ZGYyY2VlNGYtZDQ5MC00YTIwLWE3YzEtNDdlYTRlZmI3MDBk"); byte[] byteArray = Encoding.UTF8.GetBytes("{" + "\"app_id\": \"03b78b0e-44da-4221-ae8c-31003fbc8a6e\"," + "\"large_icon\" : \" " + ImageUrl + " \", " + "\"data\": {\"NotificationType\": \"Circular\"}," + "\"contents\": {\"en\": \"TEST PBPABS new Circular published.Please Login to APP and Check!!\"}," + "\"include_player_ids\": [\"" + "9a9e50a8-e1a0-4c9c-ba32-3efe1831f4d0" + "\"]" + "}");//PlayerId is DeviceID string responseContent = null; try { using (var writer = request.GetRequestStream()) { writer.Write(byteArray, 0, byteArray.Length); } using (var response = request.GetResponse() as HttpWebResponse) { using (var reader = new StreamReader(response.GetResponseStream())) { responseContent = reader.ReadToEnd(); } } } catch (WebException ex) { System.Diagnostics.Debug.WriteLine(ex.Message); System.Diagnostics.Debug.WriteLine(new StreamReader(ex.Response.GetResponseStream()).ReadToEnd()); } }
protected void LoadMember() { int DistrictId = Convert.ToInt32(ddlDistrict.SelectedValue); BusinessLayer.Member ObjMember = new BusinessLayer.Member(); DataTable dt = ObjMember.GetAll("", DistrictId, "", "", "", "", 1, ""); if (dt != null) { ddlMember.DataSource = dt; ddlMember.DataTextField = "MemberFullName"; ddlMember.DataValueField = "MemberId"; ddlMember.DataBind(); } ListItem li = new ListItem("--SELECT--", "0"); ddlMember.Items.Insert(0, li); }
protected void btnSave_Click(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); ValidNo = 0; InValidNo = 0; string MobNoList = txMobNo.Text.Trim(); if (MobNoList.LastIndexOf(',') == MobNoList.Length - 1) { MobNoList = MobNoList.Trim().Substring(0, MobNoList.Length - 1); } string[] arrMob = MobNoList.Split(','); DataTable dt = new DataTable(); dt.Columns.Add("MobileNo"); DataRow dr; for (int i = 0; i < arrMob.Length; i++) { if (arrMob[i].Length == 10) { dr = dt.NewRow(); dr["MobileNo"] = arrMob[i].Trim(); dt.Rows.Add(dr); dt.AcceptChanges(); ValidNo += 1; } else { InValidNo += 1; sb.Append(arrMob[i].Trim() + ","); } } if (dt.Rows.Count > 0) { BusinessLayer.Member ObjMember = new BusinessLayer.Member(); ObjMember.BulkMobNoInsert(dt); } ltrMsg.Text = "Mobile Numbers Imported Successfully <br />Valid Nos: " + ValidNo.ToString() + "<br />Invalid Nos: " + InValidNo.ToString() + " (" + sb.ToString() + ")"; }