コード例 #1
0
    protected void lnkConnect_Click(object sender, ImageClickEventArgs e)
    {
        int    errorcode = 0;
        int    index     = ((GridViewRow)((ImageButton)sender).Parent.Parent).RowIndex;
        string port      = gvDevice.DataKeys[index]["Port"].ToString();
        string IP        = gvDevice.DataKeys[index]["IP_Address"].ToString();
        string DeviceId  = gvDevice.DataKeys[index]["Device_Id"].ToString();

        Device_Operation_Lan objDeviceOp = new Device_Operation_Lan();


        bool b = false;

        b = objDeviceOp.Device_Connection(IP, Convert.ToInt32(port), 0);


        if (b == true)
        {
            DisplayMessage("Device Is Functional");
        }
        else
        {
            DisplayMessage("Unable to connect the device");
        }
    }
コード例 #2
0
    protected void LnkDeviceOp_Click(object sender, ImageClickEventArgs e)
    {
        int    index    = ((GridViewRow)((ImageButton)sender).Parent.Parent).RowIndex;
        string ip       = gvDevice.DataKeys[index]["IP_Address"].ToString();
        string deviceid = gvDevice.DataKeys[index]["Device_Id"].ToString();
        string port     = gvDevice.DataKeys[index]["Port"].ToString();

        Session["DevId"] = deviceid;

        bool b = false;

        b = objDeviceOp.Device_Connection(ip, Convert.ToInt32(port), 0);



        if (b == true)
        {
            lblDeviceId.Text     = deviceid;
            lblDeviceWithId.Text = gvDevice.DataKeys[index]["Device_Name"].ToString();

            DataTable dtLog = new DataTable();

            dtLog = objDeviceOp.GetUserLog(ip, Convert.ToInt32(port));

            dtLog = FilterLog(dtLog);

            if (dtLog.Rows.Count > 0)
            {
                gvLog.DataSource = dtLog;
                gvLog.DataBind();
                Session["dtDownloadLog"] = dtLog;
            }
            else
            {
                DisplayMessage("No Log Data Exists");
                return;
            }
        }
        else
        {
            DisplayMessage("Unable to connect the device");
            return;
        }
        pnlList.Visible          = false;
        pnlDeviceOp.Visible      = true;
        Session["IPForOp"]       = ip;
        Session["PortForOp"]     = port;
        Session["DeviceIdForOp"] = gvDevice.DataKeys[index]["Device_Id"].ToString();
    }
コード例 #3
0
    protected void LnkDeviceOp_Click(object sender, ImageClickEventArgs e)
    {
        int    index    = ((GridViewRow)((ImageButton)sender).Parent.Parent).RowIndex;
        string ip       = gvDevice.DataKeys[index]["IP_Address"].ToString();
        string deviceid = gvDevice.DataKeys[index]["Device_Id"].ToString();
        string port     = gvDevice.DataKeys[index]["Port"].ToString();


        bool b = false;



        b = objDeviceOp.Device_Connection(ip, Convert.ToInt32(port), 0);



        if (b == true)
        {
            DisplayMessage("Device Is Functional");



            pnlList.Visible      = false;
            pnlDeviceOp.Visible  = true;
            lblDeviceId.Text     = deviceid;
            lblDeviceWithId.Text = gvDevice.DataKeys[index]["Device_Name"].ToString();
        }
        else
        {
            DisplayMessage("Unable to connect the device");
        }

        Session["IPForOp"]       = ip;
        Session["PortForOp"]     = port;
        Session["DeviceIdForOp"] = gvDevice.DataKeys[index]["Device_Id"].ToString();
    }
コード例 #4
0
    protected void btnDownload_Click(object sender, EventArgs e)
    {
        bool bIs = false;
        bool IsDeviceSelected = false;

        DataTable dtEmp = objEmp.GetEmployeeMaster(Session["CompId"].ToString());

        dtEmp = new DataView(dtEmp, "Brand_Id='" + Session["BrandId"].ToString() + "'  and Location_Id='" + Session["LocId"].ToString() + "'", "", DataViewRowState.CurrentRows).ToTable();
        DataTable dtUser = new DataTable();

        foreach (GridViewRow gvdevicerow in gvDevice.Rows)
        {
            if (((CheckBox)gvdevicerow.FindControl("chkSelectDevice")).Checked)
            {
                IsDeviceSelected = true;
                IsDeviceSelected = true;
                int    index    = gvdevicerow.RowIndex;
                string port     = gvDevice.DataKeys[index]["Port"].ToString();
                string IP       = gvDevice.DataKeys[index]["IP_Address"].ToString();
                string DeviceId = gvDevice.DataKeys[index]["Device_Id"].ToString();

                bIs = objDeviceOp.Device_Connection(IP, Convert.ToInt32(port), 0);

                if (bIs)
                {
                    DataTable dtUserTemp = new DataTable();

                    dtUserTemp = objDeviceOp.GetUser(IP, Convert.ToInt32(port));
                    if (dtUserTemp.Rows.Count > 0)
                    {
                        dtUserTemp.Columns.Add("Device_Id");
                        dtUserTemp.Columns.Add("IP");
                        dtUserTemp.Columns.Add("Port");
                        dtUserTemp.Columns.Add("Emp_Id");
                        for (int userrowid = 0; userrowid < dtUserTemp.Rows.Count; userrowid++)
                        {
                            DataTable dtEmpTemp = new DataTable();
                            dtUserTemp.Rows[userrowid]["Device_Id"] = DeviceId;
                            dtUserTemp.Rows[userrowid]["IP"]        = IP;
                            dtUserTemp.Rows[userrowid]["Port"]      = port;
                            if ((!Convert.IsDBNull(dtUserTemp.Rows[userrowid]["sdwEnrollNumber"])) && dtUserTemp.Rows[userrowid]["sdwEnrollNumber"].ToString() != "")
                            {
                                dtEmpTemp = new DataView(dtEmp, "Emp_Code='" + dtUserTemp.Rows[userrowid]["sdwEnrollNumber"] + "'", "", DataViewRowState.CurrentRows).ToTable();
                            }



                            if (dtEmpTemp.Rows.Count > 0)
                            {
                                dtUserTemp.Rows[userrowid]["sdwEnrollNumber"] = dtUserTemp.Rows[userrowid]["sdwEnrollNumber"].ToString();

                                dtUserTemp.Rows[userrowid]["Emp_Id"] = dtUserTemp.Rows[userrowid]["sdwEnrollNumber"];
                            }
                            else
                            {
                                dtUserTemp.Rows[userrowid]["Emp_Id"] = dtUserTemp.Rows[userrowid]["sdwEnrollNumber"];

                                dtUserTemp.Rows[userrowid]["sdwEnrollNumber"] = "";
                            }
                        }

                        //now merge it to User table
                        if (dtUser.Rows.Count == 0)
                        {
                            dtUser = dtUserTemp;
                        }
                        else
                        {
                            dtUser.Merge(dtUserTemp);
                        }
                    }
                }
            }
        }

        if (rbtnNew.Checked)
        {
            try
            {
                dtUser = new DataView(dtUser, "sdwEnrollNumber=''", "", DataViewRowState.CurrentRows).ToTable();
            }
            catch
            {
                dtUser = null;
            }
        }
        if (dtUser != null && dtUser.Rows.Count > 0)
        {
            Session["DtDeviceUser"] = dtUser;


            gvUser.DataSource = dtUser;
            gvUser.DataBind();
            lblUserCount.Text = dtUser.Rows.Count.ToString();


            DisplayMessage(dtUser.Rows.Count.ToString() + " " + "Users Downloaded");

            pnlDeviceOp.Visible = true;
            pnlList.Visible     = false;
        }
        else
        {
            if (!IsDeviceSelected)
            {
                DisplayMessage("Please Select Device");
            }
            else
            {
                DisplayMessage("User does not exists");
            }
        }
    }