/// <summary> /// Method use to validate at beginning of Introduce friend. /// </summary> /// <returns></returns> public string IntroduceFriendValidation(string strMembershipID, bool hasIntroRight) { TblMember sqlMember = new TblMember(); sqlMember.StrMembershipID = strMembershipID; DataTable myTable = sqlMember.SelectOne(); sqlMember.Dispose(); if (ACMS.Convert.ToDateTime(myTable.Rows[0]["dtSignupDate"]).Date != DateTime.Now.Date) { if (!hasIntroRight) { return("This member is not signup today. Therefore, can't introduce by anyone."); } } if (myTable.Rows[0]["strIntroducerMembershipID"] != DBNull.Value) { return("This member already been introduced."); } return(""); }
private void sbtnIntroduce_Click(object sender, System.EventArgs e) { //0506 if ((lkpEdtLoyalPoint.EditValue != null || lkFreebie.EditValue != null || lkTreatment.EditValue != null) && ucMemberID1.EditValue.ToString().Length != 0) { if (string.Compare(strMembershipID.Trim(), ucMemberID1.EditValue.ToString().Trim(), true) == 0) { UI.ShowErrorMessage(this, "Member introduce him/herself is not allow."); ucMemberID1.Focus(); DialogResult = DialogResult.None; return; } TblMember sqlMember = new TblMember(); sqlMember.StrMembershipID = ucMemberID1.EditValue.ToString(); DataTable memberTable = sqlMember.SelectOne(); if (memberTable.Rows.Count > 0) { if (string.Compare(memberTable.Rows[0]["strIntroducerMembershipID"].ToString().Trim(), strMembershipID.Trim(), true) == 0) { UI.ShowErrorMessage(this, "Introducer selected was introduced by this member."); ucMemberID1.Focus(); DialogResult = DialogResult.None; return; } } string PointType = lkpEdtLoyalPoint.Text; double point = 0.0; string promoteFreebie = ""; if (lkpEdtLoyalPoint.EditValue != null) { point = System.Convert.ToDouble(lkpEdtLoyalPoint.EditValue); } else if (lkFreebie.EditValue != null) { promoteFreebie = lkFreebie.EditValue.ToString(); } else if (lkTreatment.EditValue != null) { promoteFreebie = lkTreatment.EditValue.ToString(); } string introducerID = ucMemberID1.EditValue.ToString(); if (point > 0) { if (myMemberRecord.SaveIntroduceFriend(strMembershipID, introducerID, point, employeeID)) { this.DialogResult = DialogResult.OK; PrintIntroReceipt(strMembershipID, introducerID, point, PointType); } } //0506 else if (lkTreatment.EditValue != null) { bool success = false; //success = myMemberRecord.SaveIntroduceFriendNew(strMembershipID, introducerID, "BM004(58)", "INTRO " + introducerID, employeeID, 0); //Amended by TBBC on 22 September 2015 for Intro friend package. //success = myMemberRecord.SaveIntroduceFriendNew( introducerID,strMembershipID, "BM004(58)", "INTRO " + strMembershipID, employeeID, 0); success = myMemberRecord.SaveIntroduceFriend(strMembershipID, introducerID, 0, employeeID); success = myMemberRecord.SaveIntroduceFriendforPackage(strMembershipID, introducerID, lkTreatment.EditValue.ToString(), employeeID); if (success) { this.DialogResult = DialogResult.OK; //PrintIntroReceipt(strMembershipID, introducerID, PrintIntroReceiptServices); PrintIntroReceiptServices(strMembershipID, introducerID, lkTreatment.Text); } } else if (promoteFreebie != "") { DataTable IntroFriendFreebie = myMemberRecord.SaveIntroduceFriend(strMembershipID, introducerID, promoteFreebie, User.BranchCode, employeeID); if (IntroFriendFreebie.Rows.Count > 0) { this.DialogResult = DialogResult.OK; PrintIntroReceipt(strMembershipID, introducerID, IntroFriendFreebie); } } } else { ACMS.Utils.UI.ShowErrorMessage(this, "Please fill in all field.", "Error"); lkpEdtLoyalPoint.Focus(); DialogResult = DialogResult.None; } }