예제 #1
0
        protected void btn_release_Click(object sender, EventArgs e)
        {
            int facility_id = Convert.ToInt32((sender as LinkButton).CommandArgument);

            BllProxyFacility.SetCommand(facility_id, 0, null);
            Refresh();
        }
        protected void btn_release_Click(object sender, EventArgs e)
        {
            int facility_id = Convert.ToInt32((sender as LinkButton).CommandArgument);

            FacilityDS.FacilityDSDataTable dt = BllProxyFacility.SelectFacility(facility_id);
            if (dt.Rows.Count == 0 || agent_id != dt[0].agent_id)
            {
                showErrorMessage("Failed to release facility");
                return;
            }

            BllProxyFacility.SetCommand(facility_id, 0, null);
        }
        int SetCommand(object sender, string command, string error)
        {
            int facility_id = Convert.ToInt32((sender as LinkButton).CommandArgument);

            FacilityDS.FacilityDSDataTable dt = BllProxyFacility.SelectFacility(facility_id);
            if (dt.Rows.Count == 0)
            {
                showErrorMessage(error);
                return(0);
            }

            int id = dt[0].agent_id;

            if (id != 0 && id != agent_id)
            {
                showErrorMessage(error);
                return(0);
            }

            BllProxyFacility.SetCommand(facility_id, agent_id, command);
            return(facility_id);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.IsPostBack)
            {
                return;
            }

            uctx_cab = System.Configuration.ConfigurationManager.AppSettings["uctx.cab"];

            string fid = Request["id"];

            int.TryParse(fid, out facility_id);

            if (Request["release"] != null)
            {
                BllProxyFacility.SetCommand(facility_id, 0, null);
                Response.Redirect("../close.htm");
                return;
            }

            int agent_id = ProxyHelper.GetUserAgentId(this.UserId);

            FacilityDS.FacilityDSDataTable dt = BllProxyFacility.SelectFacility(facility_id);
            if (dt.Rows.Count == 0)
            {
                error = "Failed to view facility screen";
                return;
            }

            FacilityDS.FacilityDSRow row = dt[0];

            int id = row.agent_id;

            if (id != 0 && id != agent_id)
            {
                error = "Failed to view facility screen";
                return;
            }

            name = row.facility_name;

            settings[1] = fid;

            string server = ProxyHelper.GetSettingValueString("Server", "CTX_SERVER");

            if (string.IsNullOrEmpty(server))
            {
                error = "Configuration failed";
                return;
            }

            string[] ss = server.Split(':');
            if (ss.Length != 4)
            {
                error = "Configuration failed";
                return;
            }

            settings[3] = ss[0];
            settings[5] = ss[1];
            settings[7] = ss[2];
            settings[9] = ss[3];

            BllProxyFacility.SetCommand(facility_id, agent_id, "rscr\n" + server);
        }