예제 #1
0
 protected void txtRfid_TextChanged(object sender, EventArgs e)
 {
     try
     {
         if (txtRfid.Text == "")
         {
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "err_msg", "MessageBox('Error','Please Enter Rfid Number')", true);
         }
         else
         {
             Membership objMember = ProductSalesController.GetMembersByRfid(txtRfid.Text);
             if (objMember != null)
             {
                 MemberId = objMember.ID;
                 List <MemberJuiceMaster> lstRecharge = JuiceRechargeController.GetRechargesByMemberId(MemberId);
                 MemberJuiceMaster        obj         = new MemberJuiceMaster();
                 foreach (var objRecharge in lstRecharge)
                 {
                     obj = objRecharge;
                 }
                 if (obj != null && obj.isPaid)
                 {
                     if (obj.availableAmount == 0)
                     {
                         ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "err_msg", "MessageBox('Error','No Balance left for this Member')", true);
                         ClearMemberValues();
                     }
                     else if (DateTime.Now.CompareTo(obj.endDate) > 0)
                     {
                         ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "err_msg", "MessageBox('Error','Validity Expires for this Member')", true);
                         ClearMemberValues();
                     }
                     else
                     {
                         pnlMember.Visible = true;
                         txtMemName.Text   = objMember.Lead.firstName + " " + objMember.Lead.lastName;
                         txtMemCnt.Text    = objMember.Lead.mobileNumber;
                         txtMemDOB.Text    = ((DateTime)objMember.Lead.dateOfBirth).ToString("dd/MM/yyyy");
                         lblAvailable.Text = "Available Amount: " + GetAvailableAmount();
                         lblTotal.Text     = "Total Amount: " + ShowTotal();
                     }
                 }
                 else
                 {
                     ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "err_msg", "MessageBox('Error','No Balance or No Payment Done by this Member')", true);
                     ClearMemberValues();
                 }
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "err_msg", "MessageBox('Error','Incorrect Rfid Number or Member is Deactivated')", true);
                 ClearMemberValues();
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 protected void txtRfid_TextChanged(object sender, EventArgs e)
 {
     try
     {
         if (txtRfid.Text == "")
         {
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "err_msg", "MessageBox('Error','Please Enter Rfid Number')", true);
         }
         else
         {
             Membership objMember = ProductSalesController.GetMembersByRfid(txtRfid.Text);
             if (objMember != null)
             {
                 pnlMember.Visible = true;
                 MemberId          = objMember.ID;
                 MemberItemTotalSale objTotalsale = ProductSalesController.GetTotalSalesbyMemberId(MemberId);
                 if (objTotalsale == null)
                 {
                     txtMemName.Text = objMember.Lead.firstName + " " + objMember.Lead.lastName;
                     txtMemCnt.Text  = objMember.Lead.mobileNumber;
                     txtMemDOB.Text  = ((DateTime)objMember.Lead.dateOfBirth).ToString("dd/MM/yyyy");
                 }
                 else if (objTotalsale != null && objTotalsale.isPaid)
                 {
                     txtMemName.Text = objMember.Lead.firstName + " " + objMember.Lead.lastName;
                     txtMemCnt.Text  = objMember.Lead.mobileNumber;
                     txtMemDOB.Text  = ((DateTime)objMember.Lead.dateOfBirth).ToString("dd/MM/yyyy");
                 }
                 else
                 {
                     ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "err_msg", "MessageBox('Error','Previous Payment of this Member is not paid. No more sales Possible')", true);
                     ClearMemberValues();
                 }
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "err_msg", "MessageBox('Error','Incorrect Rfid Number or Member is Deactivated')", true);
                 ClearMemberValues();
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }