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.
113 lines
4.1 KiB
113 lines
4.1 KiB
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<GridFilter>
|
|
{
|
|
new GridFilter("Points", "Reward Points", "LT"),
|
|
// new GridFilter("is_Active","Active","T")
|
|
};
|
|
|
|
grid.ColumnList = new List<GridColumn>
|
|
{
|
|
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 = "<a href='Manage.aspx?RowId=@detailTitle'>" + "<img src='/images/edit.gif' border='0' alt='Edit' /></a>";
|
|
|
|
//grid.AddPage = "manage.aspx?Id=" + (GetId() == 0 ? Id() : GetId()) + "";
|
|
var link = " <a class=\"btn btn-xs btn-primary\" title=\"Edit\" onclick=\"return editAmount('@Points,@RowId')\">Edit</a>";
|
|
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();
|
|
|
|
}
|
|
}
|
|
}
|