You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.3 KiB

  1. using Swift.DAL.Remittance.Partner;
  2. using Swift.DAL.SwiftDAL;
  3. using Swift.web.Library;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Web;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. namespace Swift.web.Remit.Administration.PartnerSetup
  11. {
  12. public partial class Manage : System.Web.UI.Page
  13. {
  14. private readonly RemittanceLibrary _sl = new RemittanceLibrary();
  15. private readonly PartnerDao _partnerDao = new PartnerDao();
  16. protected void Page_Load(object sender, EventArgs e)
  17. {
  18. _sl.CheckSession();
  19. if (!IsPostBack)
  20. {
  21. PopulateDDL();
  22. GetStatic.PrintMessage(Page);
  23. if (GetId() != "")
  24. {
  25. PopulateForm();
  26. }
  27. }
  28. }
  29. protected void PopulateDDL()
  30. {
  31. _sl.SetDDL(ref partnerCountryDDL, "EXEC proc_online_dropDownList @flag='allCountrylist'", "countryId", "countryName", "", "Select Partner Country");
  32. }
  33. protected string GetId()
  34. {
  35. return GetStatic.ReadQueryString("id", "");
  36. }
  37. protected void PopulateForm()
  38. {
  39. var dr = _partnerDao.GetPartnerDetails(GetId(), GetStatic.GetUser());
  40. if (null != dr)
  41. {
  42. partnerName.Text = dr["partnerName"].ToString();
  43. partnerAddress.Text = dr["partnerAddress"].ToString();
  44. partnerCountryDDL.SelectedValue = dr["partnerCountryId"].ToString();
  45. partnerContact.Text = dr["partnerContact"].ToString();
  46. isActive.SelectedValue = dr["isActive"].ToString();
  47. }
  48. }
  49. protected void saveData_Click(object sender, EventArgs e)
  50. {
  51. DbResult dbResult = _partnerDao.RegisterPartner(partnerName.Text, partnerAddress.Text, partnerCountryDDL.SelectedValue, partnerContact.Text, isActive.SelectedValue, GetId(), GetStatic.GetUser());
  52. if (dbResult.ErrorCode == "0")
  53. {
  54. GetStatic.SetMessage(dbResult);
  55. Response.Redirect("List.aspx");
  56. return;
  57. }
  58. else
  59. {
  60. GetStatic.AlertMessage(this, dbResult.Msg);
  61. return;
  62. }
  63. }
  64. }
  65. }