using Newtonsoft.Json; using Swift.DAL.BL.System.GeneralSettings; using Swift.DAL.SwiftDAL; using Swift.web.Component.Grid; using Swift.web.Component.Grid.gridHelper; using Swift.web.Library; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace Swift.web.Remit.Administration.ReferralSetup { public partial class ReferPointMasterSetup : System.Web.UI.Page { private const string ViewFunctionId = "90400000"; private const string GridName = "grd_bldom"; private readonly SwiftGrid grid = new SwiftGrid(); private readonly RemittanceLibrary swiftLibrary = new RemittanceLibrary(); private readonly StaticDataDao _obj = new StaticDataDao(); protected void Page_Load(object sender, EventArgs e) { //Authenticate(); var methodName = Request.Form["MethodName"]; if (!IsPostBack) { if (methodName == "ConfirmSave") { UpdateRewardAmount(); } GetStatic.PrintMessage(Page); } LoadGrid(); } private void LoadGrid() { grid.FilterList = new List { new GridFilter("Points", "Reward Points", "LT"), // new GridFilter("is_Active","Active","T") }; grid.ColumnList = new List { new GridColumn("RowId", "Id", "", "T"), new GridColumn("Points", "Reward Value", "", "T"), new GridColumn("isActive", "Is Active", "", "T") }; grid.GridDataSource = SwiftGrid.GridDS.RemittanceDB; grid.GridName = GridName; grid.GridType = 1; grid.ShowAddButton = true; grid.ShowFilterForm = true; grid.ShowPagingBar = true; grid.AllowEdit = false; grid.SortOrder = "ASC"; grid.CustomLinkColumnHeader = "Action"; grid.AddButtonTitleText = "Add New"; grid.RowIdField = "RowId"; grid.ThisPage = "ReferPointMasterSetup.aspx"; grid.InputPerRow = 5; grid.AllowCustomLink = true; grid.AlwaysShowFilterForm = true; grid.AllowEdit = false; grid.AllowDelete = false; //grid.EditText = "" + "Edit"; //grid.AddPage = "manage.aspx?Id=" + (GetId() == 0 ? Id() : GetId()) + ""; var link = " Edit"; grid.CustomLinkText = link; grid.CustomLinkVariables = "Points,RowId"; string sql = "EXEC proc_InsertRewardPoints @flag = 'GET-MASTER'"; DataTable gridData = new DataTable(); grid.SetComma(); rpt_grid.InnerHtml = grid.CreateGrid(sql); } private void Authenticate() { swiftLibrary.CheckAuthentication(ViewFunctionId); } protected void UpdateRewardAmount() { var newPts = Request.Form["rewardAmount"]; var oldPts = Request.Form["oldRewardAmt"]; var id = Request.Form["rowId"]; DbResult _res = new DbResult(); if (!string.IsNullOrEmpty(newPts)) { _res = _obj.UpdateById(GetStatic.GetUser(), id, newPts, oldPts); } else { GetStatic.AlertMessage(this, "Please enter email address to update!!"); } Response.ContentType = "text/plain"; Response.Write(JsonConvert.SerializeObject(_res)); Response.End(); } } }