using System;
using System.Data;
using System.Globalization;
using System.Resources;
using System.Threading;
/****************************************************************************************************************************
* Project Name    : TimeCheck                                        Started Date  : 30-July-2007
* Module          : Terminal Datatype Master                         Last Modified : 03-Aug-2007
* Programmer      : Kumuthini.L
* Current Storage : \\Angler56\Projects\Inprogress\SCREEN1206\code\Time_AttendanceApp
* BackUp          : \\windev\Projects\Inprogress\SCREEN1206\code\Time_AttendanceApp
****************************************************************************************************************************/
public partial class Masters_TA_UI_Master_TerminalDatatypeView : Base.BasePage
{
    #region "Variable Declaration"
    ResourceManager rm;
    CultureInfo ci;
    TerminalDatatypeEventData objTerminalDatatype = new TerminalDatatypeEventData();
    TerminalEventData objTerminalEventData = new TerminalEventData();
    Cls_CheckUser objCheckUser = new Cls_CheckUser();
    DataSet ds_Checkuser = new DataSet();
    cls_Common objCommon = new cls_Common();
    DataSet dsTerminalDataType = new DataSet();
    DataTable dtTerminalDataType = new DataTable();
    int gintTerminalDatatypeID;
    string strRawdataFormat;
    string gstrUserGroupName = string.Empty;
    int gintUserId;
    #endregion
    #region PageLoad
    protected override void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);
        string source_Language;
        source_Language = Convert.ToString(Session["Session_ActiveLanguage"]);
        rm = new ResourceManager(source_Language, System.Reflection.Assembly.Load("App_GlobalResources"));
        ci = Thread.CurrentThread.CurrentCulture;
        LoadStrings(ci);
        gintUserId = Convert.ToInt32(Session["EmpAutoID"]);
        UserRights();
        loadcss();
        if (Session["UserGroupName"] != null)
        {
            gstrUserGroupName = Convert.ToString(Session["UserGroupName"]);
        }
        btn_PermanentDelete.Attributes.Add("onclick", "return confirm('" + rm.GetString("Alert_AreyouwantDeleteRecordPermanently", ci) + "')");
        gintTerminalDatatypeID = Convert.ToInt16(Request.QueryString["TerminalDatatype_ID"]);
        if (gstrUserGroupName != "SuperAdmin")
        {
            lbl_DeleteStatusMain.Visible = false;
            lbl_DeleteStatus.Visible = false;
            btn_Restore.Visible = false;
            btn_PermanentDelete.Visible = false;
        }
        if (!IsPostBack)
        {
            GetTerminalDatatypeDetails(gintTerminalDatatypeID);
            btnDelete.OnClientClick = "return confirm('" + rm.GetString("Alert_ConfirmDelete", ci) + "')";
            btn_Restore.OnClientClick = "return confirm('" + rm.GetString("Alert_Areyousuretorestore", ci) + "')";
            btn_PermanentDelete.OnClientClick = "return confirm('" + rm.GetString("Alert_AreyouwantDeleteRecordPermanently", ci) + "')";
            objCommon.menu("Terminal", "223");
        }
    }
    #endregion
    #region UserDefinedFunctions
    // **********************************************************************************************************************
    // Function Name : GetTerminalDatatypeDetails
    // Purpose :
    //     The GetTerminalDatatypeDetails Method is used to get the Details of the Terminal Datatype for a particular 
    //     Terminal Datatype ID and the details are assigned to the appropriate Labels
    // Inputs  :
    //     TerminalDatatypeID : Terminal Datatype ID
    // **********************************************************************************************************************
    private void GetTerminalDatatypeDetails(int gintTerminalDatatypeID)
    {
        dsTerminalDataType = objTerminalDatatype.Select_TerminalDatatypebyId(gintTerminalDatatypeID, gstrUserGroupName);
        dtTerminalDataType = dsTerminalDataType.Tables[0];
        if (dtTerminalDataType.Rows.Count > 0)
        {
            if (dtTerminalDataType.Rows[0]["DisplayName"] != DBNull.Value)
            {
                lblBrandType.Text = Convert.ToString(dtTerminalDataType.Rows[0]["DisplayName"]);
            }
            if (dtTerminalDataType.Rows[0]["Raw_Data_Format"] != DBNull.Value)
            {
                lbl_RawDataFormat.Text = Convert.ToString(dtTerminalDataType.Rows[0]["Raw_Data_Format"]);
            }
            if (dtTerminalDataType.Rows[0]["FileType"] != DBNull.Value)
            {
                lbl_FileType.Text = Convert.ToString(dtTerminalDataType.Rows[0]["FileType"]);
            }
            if (dtTerminalDataType.Rows[0]["IsFreeScan"] != DBNull.Value)
            {
                if (Convert.ToInt32(dtTerminalDataType.Rows[0]["IsFreeScan"]) == 1)
                {
                    lbl_TerminalType.Text = rm.GetString("ShiftSetting_Yes", ci);
                }
                else
                {
                    lbl_TerminalType.Text = rm.GetString("ShiftSetting_No", ci);
                }               
            }
            if (lbl_FileType.Text == "Delimiter")
            {
                if (dtTerminalDataType.Rows[0]["File_SourcePath"] != DBNull.Value)
                {
                    lbl_DelFileSourcePath.Text = Convert.ToString(dtTerminalDataType.Rows[0]["File_SourcePath"]);
                }
                if (dtTerminalDataType.Rows[0]["File_BackupPath"] != DBNull.Value)
                {
                    lbl_DelFileBackupPath.Text = Convert.ToString(dtTerminalDataType.Rows[0]["File_BackupPath"]);
                }
                if (dtTerminalDataType.Rows[0]["File_BackupType"] != DBNull.Value)
                {
                    if (Convert.ToString(dtTerminalDataType.Rows[0]["File_BackupType"]) == "MF")
                    {
                        lbl_DelFileBackupType.Text = rm.GetString("rbtn_TerminalDataType_Move", ci);
                    }
                    else if (Convert.ToString(dtTerminalDataType.Rows[0]["File_BackupType"]) == "SF")
                    {
                        lbl_DelFileBackupType.Text = rm.GetString("rbtn_TerminalDataType_Rename", ci);
                    }
                }
                if (dtTerminalDataType.Rows[0]["Delimiter_NoOfFields"] != DBNull.Value)
                {
                    lbl_NoOfFields.Text = Convert.ToString(dtTerminalDataType.Rows[0]["Delimiter_NoOfFields"]);
                }
                if (dtTerminalDataType.Rows[0]["Delimiter_Delimiter"] != DBNull.Value)
                {
                    lbl_Delimiter.Text = Convert.ToString(dtTerminalDataType.Rows[0]["Delimiter_Delimiter"]);
                }
                if (dtTerminalDataType.Rows[0]["Delimiter_StringEnclosedBy"] != DBNull.Value)
                {
                    lbl_StringEnclosedBy.Text = Convert.ToString(dtTerminalDataType.Rows[0]["Delimiter_StringEnclosedBy"]);
                }
                if (dtTerminalDataType.Rows[0]["Delimiter_ReaderNo"] != DBNull.Value)
                {
                    lbl_DelReaderNo.Text = Convert.ToString(dtTerminalDataType.Rows[0]["Delimiter_ReaderNo"]);
                }
                if (dtTerminalDataType.Rows[0]["Delimiter_CardNo"] != DBNull.Value)
                {
                    lbl_DelCardNo.Text = Convert.ToString(dtTerminalDataType.Rows[0]["Delimiter_CardNo"]);
                }
                if (dtTerminalDataType.Rows[0]["Delimiter_Date"] != DBNull.Value)
                {
                    lbl_DelDate.Text = Convert.ToString(dtTerminalDataType.Rows[0]["Delimiter_Date"]);
                }
                if (dtTerminalDataType.Rows[0]["DateFormat"] != DBNull.Value)
                {
                    lbl_DelDateFormat.Text = Convert.ToString(dtTerminalDataType.Rows[0]["DateFormat"]);
                }
                if (dtTerminalDataType.Rows[0]["Delimiter_Time"] != DBNull.Value)
                {
                    lbl_DelTime.Text = Convert.ToString(dtTerminalDataType.Rows[0]["Delimiter_Time"]);
                }
                if (dtTerminalDataType.Rows[0]["TimeFormat"] != DBNull.Value)
                {
                    lbl_DelTimeFormat.Text = Convert.ToString(dtTerminalDataType.Rows[0]["TimeFormat"]);
                }
                if (dtTerminalDataType.Rows[0]["Delimiter_DateTime"] != DBNull.Value)
                {
                    lbl_DelDateTime.Text = Convert.ToString(dtTerminalDataType.Rows[0]["Delimiter_DateTime"]);
                }
                if (dtTerminalDataType.Rows[0]["DateTimeFormat"] != DBNull.Value)
                {
                    lbl_DelDateTimeFormat.Text = Convert.ToString(dtTerminalDataType.Rows[0]["DateTimeFormat"]);
                }
                if (dtTerminalDataType.Rows[0]["Delimiter_Type"] != DBNull.Value)
                {
                    lbl_DelType.Text = Convert.ToString(dtTerminalDataType.Rows[0]["Delimiter_Type"]);
                }
                if (dtTerminalDataType.Rows[0]["Delimiter_TransactionIdentifier"] != DBNull.Value)
                {
                    lbl_DelTransIdentifier.Text = Convert.ToString(dtTerminalDataType.Rows[0]["Delimiter_TransactionIdentifier"]);
                }
                if (dtTerminalDataType.Rows[0]["TransactionIdentifierValue"] != DBNull.Value)
                {
                    lbl_DelTIValue.Text = Convert.ToString(dtTerminalDataType.Rows[0]["TransactionIdentifierValue"]);
                }
            }
            else if (lbl_FileType.Text == "Fixed Length")
            {
                if (dtTerminalDataType.Rows[0]["File_SourcePath"] != DBNull.Value)
                {
                    lbl_FLFileSourcePath.Text = Convert.ToString(dtTerminalDataType.Rows[0]["File_SourcePath"]);
                }
                if (dtTerminalDataType.Rows[0]["File_BackupPath"] != DBNull.Value)
                {
                    lbl_FLFileBackupPath.Text = Convert.ToString(dtTerminalDataType.Rows[0]["File_BackupPath"]);
                }
                if (dtTerminalDataType.Rows[0]["File_BackupType"] != DBNull.Value)
                {
                    if (Convert.ToString(dtTerminalDataType.Rows[0]["File_BackupType"]) == "MF")
                    {
                        lbl_FLFileBackupType.Text = rm.GetString("rbtn_TerminalDataType_Move", ci);
                    }
                    else if (Convert.ToString(dtTerminalDataType.Rows[0]["File_BackupType"]) == "SF")
                    {
                        lbl_FLFileBackupType.Text = rm.GetString("rbtn_TerminalDataType_Rename", ci);
                    }
                }
                if (dtTerminalDataType.Rows[0]["FixedLength_ReaderNoFrom"] != DBNull.Value)
                {
                    lbl_FLReaderNoFrom.Text = Convert.ToString(dtTerminalDataType.Rows[0]["FixedLength_ReaderNoFrom"]);
                }
                if (dtTerminalDataType.Rows[0]["FixedLength_ReaderNoTo"] != DBNull.Value)
                {
                    lbl_FLReaderNoTo.Text = Convert.ToString(dtTerminalDataType.Rows[0]["FixedLength_ReaderNoTo"]);
                }
                if (dtTerminalDataType.Rows[0]["FixedLength_CardNoFrom"] != DBNull.Value)
                {
                    lbl_FLCardNoFrom.Text = Convert.ToString(dtTerminalDataType.Rows[0]["FixedLength_CardNoFrom"]);
                }
                if (dtTerminalDataType.Rows[0]["FixedLength_CardNoTo"] != DBNull.Value)
                {
                    lbl_FLCardNoTo.Text = Convert.ToString(dtTerminalDataType.Rows[0]["FixedLength_CardNoTo"]);
                }
                if (dtTerminalDataType.Rows[0]["FixedLength_DateFrom"] != DBNull.Value)
                {
                    lbl_FLDateFrom.Text = Convert.ToString(dtTerminalDataType.Rows[0]["FixedLength_DateFrom"]);
                }
                if (dtTerminalDataType.Rows[0]["FixedLength_DateTo"] != DBNull.Value)
                {
                    lbl_FLDateTo.Text = Convert.ToString(dtTerminalDataType.Rows[0]["FixedLength_DateTo"]);
                }
                if (dtTerminalDataType.Rows[0]["DateFormat"] != DBNull.Value)
                {
                    lbl_FLDateFormat.Text = Convert.ToString(dtTerminalDataType.Rows[0]["DateFormat"]);
                }
                if (dtTerminalDataType.Rows[0]["FixedLength_TimeFrom"] != DBNull.Value)
                {
                    lbl_FLTimeFrom.Text = Convert.ToString(dtTerminalDataType.Rows[0]["FixedLength_TimeFrom"]);
                }
                if (dtTerminalDataType.Rows[0]["FixedLength_TimeTo"] != DBNull.Value)
                {
                    lbl_FLTimeTo.Text = Convert.ToString(dtTerminalDataType.Rows[0]["FixedLength_TimeTo"]);
                }
                if (dtTerminalDataType.Rows[0]["TimeFormat"] != DBNull.Value)
                {
                    lbl_FLTimeFormat.Text = Convert.ToString(dtTerminalDataType.Rows[0]["TimeFormat"]);
                }
                if (dtTerminalDataType.Rows[0]["FixedLength_DateTimeFrom"] != DBNull.Value)
                {
                    lbl_FLDateTimeFrom.Text = Convert.ToString(dtTerminalDataType.Rows[0]["FixedLength_DateTimeFrom"]);
                }
                if (dtTerminalDataType.Rows[0]["FixedLength_DateTimeTo"] != DBNull.Value)
                {
                    lbl_FLDateTimeTo.Text = Convert.ToString(dtTerminalDataType.Rows[0]["FixedLength_DateTimeTo"]);
                }
                if (dtTerminalDataType.Rows[0]["DateTimeFormat"] != DBNull.Value)
                {
                    lbl_FLDateTimeFormat.Text = Convert.ToString(dtTerminalDataType.Rows[0]["DateTimeFormat"]);
                }
                if (dtTerminalDataType.Rows[0]["FixedLength_TypeFrom"] != DBNull.Value)
                {
                    lbl_FLTypeFrom.Text = Convert.ToString(dtTerminalDataType.Rows[0]["FixedLength_TypeFrom"]);
                }
                if (dtTerminalDataType.Rows[0]["FixedLength_TypeTo"] != DBNull.Value)
                {
                    lbl_FLTypeTo.Text = Convert.ToString(dtTerminalDataType.Rows[0]["FixedLength_TypeTo"]);
                }
                if (dtTerminalDataType.Rows[0]["FixedLength_TransactionIdentifierFrom"] != DBNull.Value)
                {
                    lbl_FLTransIdentifierFrom.Text = Convert.ToString(dtTerminalDataType.Rows[0]["FixedLength_TransactionIdentifierFrom"]);
                }
                if (dtTerminalDataType.Rows[0]["FixedLength_TransactionIdentifierTo"] != DBNull.Value)
                {
                    lbl_FLTransIdentifierTo.Text = Convert.ToString(dtTerminalDataType.Rows[0]["FixedLength_TransactionIdentifierTo"]);
                }
                if (dtTerminalDataType.Rows[0]["TransactionIdentifierValue"] != DBNull.Value)
                {
                    lbl_FLTIValue.Text = Convert.ToString(dtTerminalDataType.Rows[0]["TransactionIdentifierValue"]);
                }
            }
            else if (lbl_FileType.Text == "RDBMS")
            {
                if (dtTerminalDataType.Rows[0]["RDBMS_ReaderNo"] != DBNull.Value)
                {
                    lbl_RDBMSReaderNo.Text = Convert.ToString(dtTerminalDataType.Rows[0]["RDBMS_ReaderNo"]);
                }
                if (dtTerminalDataType.Rows[0]["RDBMS_CardNo"] != DBNull.Value)
                {
                    lbl_RDBMSCardNo.Text = Convert.ToString(dtTerminalDataType.Rows[0]["RDBMS_CardNo"]);
                }
                if (dtTerminalDataType.Rows[0]["RDBMS_Date"] != DBNull.Value)
                {
                    lbl_RDBMSDate.Text = Convert.ToString(dtTerminalDataType.Rows[0]["RDBMS_Date"]);
                }
                if (dtTerminalDataType.Rows[0]["RDBMS_Time"] != DBNull.Value)
                {
                    lbl_RDBMSTime.Text = Convert.ToString(dtTerminalDataType.Rows[0]["RDBMS_Time"]);
                }
                if (dtTerminalDataType.Rows[0]["RDBMS_DateTime"] != DBNull.Value)
                {
                    lbl_RDBMSDateTime.Text = Convert.ToString(dtTerminalDataType.Rows[0]["RDBMS_DateTime"]);
                }
                if (dtTerminalDataType.Rows[0]["RDBMS_Type"] != DBNull.Value)
                {
                    lbl_RDBMSType.Text = Convert.ToString(dtTerminalDataType.Rows[0]["RDBMS_Type"]);
                }
                if (dtTerminalDataType.Rows[0]["RDBMS_TransactionIdentifier"] != DBNull.Value)
                {
                    lbl_RDBMSTransIdentifier.Text = Convert.ToString(dtTerminalDataType.Rows[0]["RDBMS_TransactionIdentifier"]);
                }
            }
            else if (lbl_FileType.Text == "MDB")
            {
                if (dtTerminalDataType.Rows[0]["MDB_ReaderNo"] != DBNull.Value)
                {
                    lbl_RDBMSReaderNo.Text = Convert.ToString(dtTerminalDataType.Rows[0]["MDB_ReaderNo"]);
                }
                if (dtTerminalDataType.Rows[0]["MDB_CardNo"] != DBNull.Value)
                {
                    lbl_RDBMSCardNo.Text = Convert.ToString(dtTerminalDataType.Rows[0]["MDB_CardNo"]);
                }
                if (dtTerminalDataType.Rows[0]["MDB_Date"] != DBNull.Value)
                {
                    lbl_RDBMSDate.Text = Convert.ToString(dtTerminalDataType.Rows[0]["MDB_Date"]);
                }
                if (dtTerminalDataType.Rows[0]["MDB_Time"] != DBNull.Value)
                {
                    lbl_RDBMSTime.Text = Convert.ToString(dtTerminalDataType.Rows[0]["MDB_Time"]);
                }
                if (dtTerminalDataType.Rows[0]["MDB_DateTime"] != DBNull.Value)
                {
                    lbl_RDBMSDateTime.Text = Convert.ToString(dtTerminalDataType.Rows[0]["MDB_DateTime"]);
                }
                if (dtTerminalDataType.Rows[0]["MDB_Type"] != DBNull.Value)
                {
                    lbl_RDBMSType.Text = Convert.ToString(dtTerminalDataType.Rows[0]["MDB_Type"]);
                }
                if (dtTerminalDataType.Rows[0]["MDB_TransactionIdentifier"] != DBNull.Value)
                {
                    lbl_RDBMSTransIdentifier.Text = Convert.ToString(dtTerminalDataType.Rows[0]["MDB_TransactionIdentifier"]);
                }
            }
            if (lbl_FileType.Text == "RDBMS" || lbl_FileType.Text == "MDB")
            {
                if (dtTerminalDataType.Rows[0]["ConnectionString"] != DBNull.Value)
                {
                    char[] split = { ';' };
                    string strSpt = "";
                    string sptChr = Convert.ToString(dtTerminalDataType.Rows[0]["ConnectionString"]);
                    if (sptChr != "")
                    {
                        string[] strFilters = sptChr.Split(split);
                        if (strFilters.Length > 1)
                            lbl_ConnectionString.Text = Convert.ToString(dtTerminalDataType.Rows[0]["ConnectionString"]);
                        else
                            lbl_ConnectionString.Text = Encryption.Decrypt(Convert.ToString(dtTerminalDataType.Rows[0]["ConnectionString"]), "");
                    }
                    if (lbl_FileType.Text == "RDBMS")
                    {
                        strSpt = "";
                        string strSpt1 = "";
                        strSpt = splitstring(';', lbl_ConnectionString.Text, 1);
                        strSpt1 = splitstring('=', strSpt, 1);
                        lbl_DBServerName.Text = strSpt1;
                        strSpt = "";
                        strSpt1 = "";
                        strSpt = splitstring(';', lbl_ConnectionString.Text, 2);
                        strSpt1 = splitstring('=', strSpt, 1);
                        lbl_DBDatabaseName.Text = strSpt1;
                        strSpt = "";
                        strSpt1 = "";
                        strSpt = splitstring(';', lbl_ConnectionString.Text, 3);
                        strSpt1 = splitstring('=', strSpt, 1);
                        lbl_DBUserName.Text = strSpt1;
                        strSpt = "";
                        strSpt1 = "";
                        strSpt = splitstring(';', lbl_ConnectionString.Text, 4);
                        strSpt1 = splitstring('=', strSpt, 1);
                        if (strSpt1 == "")
                            lbl_DBPassword.Text = "";
                        else
                            lbl_DBPassword.Text = "**********";
                    }
                    else
                    {
                        strSpt = "";
                        string strSpt1 = "";
                        strSpt = splitstring(';', lbl_ConnectionString.Text, 1);
                        strSpt1 = splitstring('=', strSpt, 1);
                        lbl_MDBDataSource.Text = strSpt1;
                        strSpt = "";
                        strSpt1 = "";
                        strSpt = splitstring(';', lbl_ConnectionString.Text, 2);
                        strSpt1 = splitstring('=', strSpt, 1);
                        lbl_MDBUserName.Text = strSpt1;
                        strSpt = "";
                        strSpt1 = "";
                        strSpt = splitstring(';', lbl_ConnectionString.Text, 3);
                        strSpt1 = splitstring('=', strSpt, 1);
                        lbl_MDBPassword.Text = strSpt1;
                    }
                }
                if (dtTerminalDataType.Rows[0]["TableName"] != DBNull.Value)
                {
                    lbl_TableName.Text = Convert.ToString(dtTerminalDataType.Rows[0]["TableName"]);
                }
                if (dtTerminalDataType.Rows[0]["DateFormat"] != DBNull.Value)
                {
                    lbl_RDBMSDateFormat.Text = Convert.ToString(dtTerminalDataType.Rows[0]["DateFormat"]);
                }
                if (dtTerminalDataType.Rows[0]["TimeFormat"] != DBNull.Value)
                {
                    lbl_RDBMSTimeFormat.Text = Convert.ToString(dtTerminalDataType.Rows[0]["TimeFormat"]);
                }
                if (dtTerminalDataType.Rows[0]["DateTimeFormat"] != DBNull.Value)
                {
                    lbl_RDBMSDateTimeFormat.Text = Convert.ToString(dtTerminalDataType.Rows[0]["DateTimeFormat"]);
                }
                if (dtTerminalDataType.Rows[0]["TransactionIdentifierValue"] != DBNull.Value)
                {
                    lbl_RDBMSTIValue.Text = Convert.ToString(dtTerminalDataType.Rows[0]["TransactionIdentifierValue"]);
                }
                if (dtTerminalDataType.Rows[0]["RDBMS_MDB_Flag"] != DBNull.Value)
                {
                    lbl_FlagField.Text = Convert.ToString(dtTerminalDataType.Rows[0]["RDBMS_MDB_Flag"]);
                }
            }
            if (dtTerminalDataType.Rows[0]["IsDeleted"] != DBNull.Value)
            {
                lbl_DeleteStatus.Text = Convert.ToString(dtTerminalDataType.Rows[0]["IsDeleted"]);
                if (lbl_DeleteStatus.Text == "True" || lbl_DeleteStatus.Text == rm.GetString("Grid_True", ci))
                {
                    btnDelete.Visible = false;
                }
                else if (lbl_DeleteStatus.Text == "False" || lbl_DeleteStatus.Text == rm.GetString("Grid_False", ci))
                {
                    btn_Restore.Visible = false;
                }
            }
            if (lbl_DeleteStatus.Text == "True")
            {
                lbl_DeleteStatus.Text = rm.GetString("Grid_True", ci);
            }
            else if (lbl_DeleteStatus.Text == "False")
            {
                lbl_DeleteStatus.Text = rm.GetString("Grid_False", ci);
            }
        }
    }
    protected string splitstring(char chrStr, string sptChr, int sptCount)
    {
        char[] split = { chrStr };
        string strSpt = "";
        if (sptChr != "")
        {
            string[] strFilters = sptChr.Split(split);
            strSpt = "";
            strSpt = strFilters[sptCount];
        }
        return strSpt;
    }
    private void LoadStrings(CultureInfo ci)
    {
        lbl_Rawformat.Text = rm.GetString("TerminalDataType_RawDataFormat", ci);
        lbl_FileType1.Text = rm.GetString("TerminalDataType_FileType", ci);
        lbl_FileSourcePath1.Text = rm.GetString("TerminalDataType_File_Src_Path", ci);
        lbl_FileBackupPath1.Text = rm.GetString("TerminalDataType_File_Backup_Path", ci);
        lbl_FileBackupType1.Text = rm.GetString("TerminalDataType_BackupType", ci);
        lbl_NumberofFields.Text = rm.GetString("TerminalDataType_No_Of_Fields", ci);
        lbl_Delimiter1.Text = rm.GetString("TerminalDataType_Delimiter", ci);
        lbl_StringEnclosedBy1.Text = rm.GetString("TerminalDataType_Str_Enclosed_By", ci);
        lbl_OurFormat1.Text = rm.GetString("TerminalDataType_OurFormat", ci);
        lbl_RawFileFields1.Text = rm.GetString("TerminalDataType_RawFileFields", ci);
        lbl_ReaderNo1.Text = rm.GetString("TerminalDataType_Reader_No", ci);
        lbl_CardNo1.Text = rm.GetString("TerminalDataType_Card_No", ci);
        lbl_DateandTime1.Text = rm.GetString("TerminalDataType_Date_And_Time", ci);
        lbl_DateandTime2.Text = rm.GetString("TerminalDataType_Date_And_Time", ci);
        lbl_Date4.Text = rm.GetString("Reports_Date", ci);
        lbl_Time4.Text = rm.GetString("TerminalDataType_Time", ci);
        lbl_DateTimeFormat1.Text = rm.GetString("TerminalDataType_DateTimeFormat", ci);
        lbl_DateFormat1.Text = rm.GetString("DateandTimeFormat_DateFormat", ci);
        lbl_TimeFormat1.Text = rm.GetString("DateandTimeFormat_TimeFormat", ci);
        lbl_Type1.Text = rm.GetString("PunchTypes_PunchTypes", ci);
        lbl_TransIdentifier1.Text = rm.GetString("TerminalDataType_TransactionIdentifier", ci);
        lbl_TransIdentifierValue1.Text = rm.GetString("TerminalDataType_TransactionIdentifier_Value", ci);
        lbl_FileSourcePath2.Text = rm.GetString("TerminalDataType_File_Src_Path", ci);
        lbl_FileBackupPath2.Text = rm.GetString("TerminalDataType_File_Backup_Path", ci);
        lbl_FileBackupType2.Text = rm.GetString("TerminalDataType_BackupType", ci);
        lbl_OurFormat2.Text = rm.GetString("TerminalDataType_OurFormat", ci);
        lbl_RawFileFields2.Text = rm.GetString("TerminalDataType_RawFileFields", ci);
        lbl_ReaderNo2.Text = rm.GetString("TerminalDataType_Reader_No", ci);
        lbl_CardNo2.Text = rm.GetString("TerminalDataType_Card_No", ci);
        lbl_Date2.Text = rm.GetString("Reports_Date", ci);
        lbl_Time2.Text = rm.GetString("TerminalDataType_Time", ci);
        lbl_DateandTime3.Text = rm.GetString("TerminalDataType_Date_And_Time", ci);
        lbl_DateTimeFormat2.Text = rm.GetString("TerminalDataType_DateTimeFormat", ci);
        lbl_DateFormat2.Text = rm.GetString("DateandTimeFormat_DateFormat", ci);
        lbl_TimeFormat2.Text = rm.GetString("DateandTimeFormat_TimeFormat", ci);
        lbl_Type2.Text = rm.GetString("PunchTypes_PunchTypes", ci);
        lbl_From1.Text = rm.GetString("email_FromDate", ci);
        lbl_From2.Text = rm.GetString("email_FromDate", ci);
        lbl_From3.Text = rm.GetString("email_FromDate", ci);
        lbl_From4.Text = rm.GetString("email_FromDate", ci);
        lbl_From5.Text = rm.GetString("email_FromDate", ci);
        lbl_From6.Text = rm.GetString("email_FromDate", ci);
        lbl_From7.Text = rm.GetString("email_FromDate", ci);
        lbl_To1.Text = rm.GetString("email_ToDate", ci);
        lbl_To2.Text = rm.GetString("email_ToDate", ci);
        lbl_To3.Text = rm.GetString("email_ToDate", ci);
        lbl_To4.Text = rm.GetString("email_ToDate", ci);
        lbl_To5.Text = rm.GetString("email_ToDate", ci);
        lbl_To6.Text = rm.GetString("email_ToDate", ci);
        lbl_To7.Text = rm.GetString("email_ToDate", ci);
        lbl_TransIdentifier2.Text = rm.GetString("TerminalDataType_TransactionIdentifier", ci);
        lbl_TransIdentifierValue2.Text = rm.GetString("TerminalDataType_TransactionIdentifier_Value", ci);
        lbl_ConnectionString1.Text = rm.GetString("TerminalDataType_Con_string", ci);
        lbl_TableName1.Text = rm.GetString("TerminalDataType_Table_Name", ci);
        lbl_OurFormat3.Text = rm.GetString("TerminalDataType_OurFormat", ci);
        lbl_RawFileFields3.Text = rm.GetString("TerminalDataType_RawFileFields", ci);
        lbl_ReaderNo3.Text = rm.GetString("TerminalDataType_Reader_No", ci);
        lbl_CardNo3.Text = rm.GetString("TerminalDataType_Card_No", ci);
        lbl_DateandTime4.Text = rm.GetString("TerminalDataType_Date_And_Time", ci);
        lbl_DateandTime5.Text = rm.GetString("TerminalDataType_Date_And_Time", ci);
        lbl_Date3.Text = rm.GetString("Reports_Date", ci);
        lbl_Time3.Text = rm.GetString("TerminalDataType_Time", ci);
        lbl_Type3.Text = rm.GetString("PunchTypes_PunchTypes", ci);
        lbl_DateTimeFormat3.Text = rm.GetString("TerminalDataType_DateTimeFormat", ci);
        lbl_DateFormat3.Text = rm.GetString("DateandTimeFormat_DateFormat", ci);
        lbl_TimeFormat3.Text = rm.GetString("DateandTimeFormat_TimeFormat", ci);
        lbl_TransIdentifier3.Text = rm.GetString("TerminalDataType_TransactionIdentifier", ci);
        lbl_TransIdentifierValue3.Text = rm.GetString("TerminalDataType_TransactionIdentifier_Value", ci);
        lbl_HeaderTerminalDatatype.Text = rm.GetString("Masters_Terminal_TerminalDataType", ci);
        lbl_FlagField1.Text = rm.GetString("TerminalDatatype_FlagField", ci);
        lbl_DeleteStatusMain.Text = rm.GetString("DeleteStatus", ci);
        btnModify.Text = rm.GetString("btn_Modify", ci);
        btnDelete.Text = "&nbsp;&nbsp;" + rm.GetString("btn_Delete", ci);
        btnCancel.Text = "&nbsp;&nbsp;" + rm.GetString("btn_Back", ci);
        btn_Restore.Text = "&nbsp;&nbsp;" + rm.GetString("btn_Restore", ci);
        btn_PermanentDelete.Text = "&nbsp;&nbsp;" + rm.GetString("btn_PermanentDelete", ci);
        lbl_BrandType.Text = rm.GetString("BrandType", ci);
        lbl_DBServerName1.Text = rm.GetString("Server_Name", ci);
        lbl_DBDatabaseName1.Text = rm.GetString("DBDatabaseName", ci);
        lbl_DBUserName1.Text = rm.GetString("DBUserID", ci);
        lbl_DBPassword1.Text = rm.GetString("Caption_Password", ci);
        lbl_MDBDataSource1.Text = rm.GetString("MDBDataSource", ci);
        lbl_MDBUserName1.Text = rm.GetString("DBUserID", ci);
        lbl_MDBPassword1.Text = rm.GetString("Caption_Password", ci);
        lbl_DateTimeSeparate.Text = rm.GetString("DateTimeSeparate", ci);
        lbl_DateTimeSeparate1.Text = rm.GetString("DateTimeSeparate", ci);
        lbl_DateTimeCombine.Text = rm.GetString("DateTimeCombine", ci);
        lbl_DateTimeCombine1.Text = rm.GetString("DateTimeCombine", ci);
        lbl_Trans_Identifier.Text = rm.GetString("TerminalDataType_TransactionIdentifier", ci);
        lbl_Trans_Identifier1.Text = rm.GetString("TerminalDataType_TransactionIdentifier", ci);
        lbl_Conn_File_Path.Text = rm.GetString("lbl_ConnectionFilePath", ci);
        lbl_Conn_File_Path1.Text = rm.GetString("lbl_ConnectionFilePath", ci);
        lblTerminalType.Text = rm.GetString("lbl_IsFreeScandevice", ci);
    }
    private void UserRights()
    {
        ds_Checkuser = objCheckUser.checkRights(10, Convert.ToInt32(Session["userGroup_Id"]), "");
        if (ds_Checkuser.Tables[0].Rows.Count > 0)
        {
            if (ds_Checkuser.Tables[0].Rows[0]["viewPrv"] == DBNull.Value || Convert.ToInt32(ds_Checkuser.Tables[0].Rows[0]["viewPrv"]) != 1)
            {
                Response.Redirect("TA_UI_Master_TerminalDatatype.aspx");
            }
            if (ds_Checkuser.Tables[0].Rows[0]["modifyPrv"] != DBNull.Value && Convert.ToInt32(ds_Checkuser.Tables[0].Rows[0]["modifyPrv"]) == 1)
            {
                this.btnModify.Visible = true;
            }
            else
            {
                this.btnModify.Visible = false;
            }
            if (ds_Checkuser.Tables[0].Rows[0]["deletePrv"] != DBNull.Value && Convert.ToInt32(ds_Checkuser.Tables[0].Rows[0]["deletePrv"]) == 1)
            {
                this.btnDelete.Visible = true;
                this.btn_PermanentDelete.Visible = true;
                this.btn_Restore.Visible = true;
            }
            else
            {
                this.btnDelete.Visible = false;
                this.btn_PermanentDelete.Visible = false;
                this.btn_Restore.Visible = false;
            }
        }
        else
        {
            Response.Redirect("MasterLandingPage.aspx");
        }
    }
    #endregion
    #region ButtonEvents
    protected void btnModify_Click(object sender, EventArgs e)
    {
        Response.Redirect("TA_UI_Master_TerminalDatatypeModify.aspx?TerminalDatatype_ID=" + gintTerminalDatatypeID);
    }
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        strRawdataFormat = lbl_RawDataFormat.Text;
        string userGroupName = string.Empty;
        int Count = objTerminalEventData.GetCountTerminal(gintTerminalDatatypeID, userGroupName);
        if (Count > 0)
        {
            base.Message(rm.GetString("Master_Terminal_DataType_Delete", ci));
            return;
        }
        objTerminalDatatype.PermanentDeleteTerminalDataTypes(Convert.ToString(gintTerminalDatatypeID), gintUserId, "TemporaryDelete");
        base.MessageWithRedirect(rm.GetString("Alert_TerminalDataTypedeletedsuccessfully", ci), "TA_UI_Master_TerminalDatatype.aspx");
    }
    protected void btn_Restore_Click(object sender, EventArgs e)
    {
        int intCount = objTerminalDatatype.CheckRestoreTerminalDataType(gintTerminalDatatypeID);
        if (intCount > 0)
        {
            base.Message(rm.GetString("Message_Cannot_Restore", ci));
            return;
        }
        objTerminalDatatype.PermanentDeleteTerminalDataTypes(Convert.ToString(gintTerminalDatatypeID), gintUserId, "Restore");
        base.MessageWithRedirect(rm.GetString("Alert_TerminalDataTyperestoredsuccessfully", ci), "TA_UI_Master_TerminalDatatype.aspx");
    }
    protected void btn_PermanentDelete_Click(object sender, EventArgs e)
    {
        strRawdataFormat = lbl_RawDataFormat.Text;
        string UserGroupName = string.Empty;
        int Count = objTerminalEventData.GetCountTerminal(gintTerminalDatatypeID, UserGroupName);
        if (Count > 0)
        {
            base.Message(rm.GetString("Master_Terminal_DataType_Delete", ci));
            return;
        }
        objTerminalDatatype.PermanentDeleteTerminalDataTypes(Convert.ToString(gintTerminalDatatypeID), gintUserId, "PermanentDelete");
        base.MessageWithRedirect(rm.GetString("Alert_TerminalDataTypedeletedsuccessfully", ci), "TA_UI_Master_TerminalDatatype.aspx");
    }
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("TA_UI_Master_TerminalDatatype.aspx");
    }
    #endregion
    private void loadcss()
    {
        CultureInfo ci;
        string source_Language;
        source_Language = Convert.ToString(Session["Session_ActiveLanguage"]);
        rm = new ResourceManager(source_Language, System.Reflection.Assembly.Load("App_GlobalResources"));
        ci = Thread.CurrentThread.CurrentCulture;
        HtmlTerminalDataType.Attributes.Add("dir", rm.GetString("Direction", ci));
        if (source_Language == "Resources.Resource_AR")
        {
            stylebootstrap.Href = "../bootstrap/css/bootstrap-rtl.min.css";
            stylefontawesome.Href = "../bootstrap/font-awesome/css/font-awesome-rtl.css";
            styleAdminLTE.Href = "../dist/css/AdminLTE.min-rtl.css";
            stylecustom.Href = "../dist/css/custom-rtl.css";
            stylefonts.Href = "../dist/css/fonts.css";
        }
        else
        {
            stylebootstrap.Href = "../bootstrap/css/bootstrap.min.css";
            stylefontawesome.Href = "../bootstrap/font-awesome/css/font-awesome.css";
            styleAdminLTE.Href = "../dist/css/AdminLTE.min.css";
            stylecustom.Href = "../dist/css/custom.css";
            stylefonts.Href = "../dist/css/fonts.css";
        }
    }
}
