Пример #1
0
    protected void GetDeptAndStaffTableFangAnItems(ref ListItem[] dept, ref ListItem[] staff)
    {
        List <ListItem> deptList = new List <ListItem>();

        deptList.Add(new ListItem("δÅäÖÃ", ""));
        List <ListItem> staffList = new List <ListItem>();

        staffList.Add(new ListItem("δÅäÖÃ", ""));
        try
        {
            //path = HttpContext.Current.Server.MapPath("~" + path);
            DirectoryInfo di = new DirectoryInfo(path);
            if (di != null && di.Exists)
            {
                List <FileInfo> dbFileInfosNoSort = new List <FileInfo>(di.EnumerateFiles("*.xml", SearchOption.TopDirectoryOnly));
                foreach (FileInfo file in dbFileInfosNoSort)
                {
                    if (!file.Exists || file.Name.Contains("~"))
                    {
                        continue;
                    }
                    if (OtherDeviceHelper.CheckTableFangAn(file.FullName, new HR_DEPT()))
                    {
                        deptList.Add(new ListItem(file.Name, file.Name));
                    }
                    else if (OtherDeviceHelper.CheckTableFangAn(file.FullName, new HR_STAFF()))
                    {
                        staffList.Add(new ListItem(file.Name, file.Name));
                    }
                }
            }
        }
        catch { }
        dept  = deptList.ToArray();
        staff = staffList.ToArray();
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        title      = "É豸±à¼­";
        Page.Title = title;
        if (!string.IsNullOrEmpty(Request["DeviceID"]))
        {
            keyid = Request["DeviceID"];
        }

        if (!string.IsNullOrEmpty(Request["KeyID"]))
        {
            keyid = Request["KeyID"];
        }
        if (!IsPostBack)
        {
            OtherDeviceHelper.GetTableDataSet(path, new HR_DEPT());
            OtherDeviceHelper.GetTableDataSet(path, new HR_STAFF());
            txtUSE_FLAG.Items.AddRange(FormHelper.GetListItem(HR_CHECKWORKDEVICE.Attribute.USE_FLAG));
            txtUSE_FLAG.Items.RemoveAt(0);

            ListItem[] deptTables  = new ListItem[0];
            ListItem[] staffTables = new ListItem[0];
            GetDeptAndStaffTableFangAnItems(ref deptTables, ref staffTables);
            txtDeptTable.Items.AddRange(deptTables);
            txtStaffTable.Items.AddRange(staffTables);

            this.txtDeviceID.Disabled            = true;
            this.txtDeviceID.Attributes["class"] = "dis";
            try
            {
                if (keyid != "")
                {
                    HR_CHECKWORKDEVICE val = new HR_CHECKWORKDEVICE();
                    HR_CHECKWORKDEVICE con = new HR_CHECKWORKDEVICE();
                    con._DeviceID = keyid;
                    HR_ORG pyVal = new HR_ORG();
                    pyVal._ORG_NAME = "";
                    Relation rt = new Relation(HR_CHECKWORKDEVICE.Attribute.ORG_ID, HR_ORG.Attribute.ORG_ID);
                    List <HR_CHECKWORKDEVICE> devList = BLLTable <HR_CHECKWORKDEVICE> .Factory(conn).Select(val, rt, pyVal, con);

                    if (devList == null || devList.Count < 1)
                    {
                        return;
                    }
                    txtDeviceID.Value   = Convert.ToString(devList[0].DeviceID); //Convert.ToString
                    txtDeviceName.Value = devList[0].DeviceName;
                    wucSelORG1.ORG_ID   = Convert.ToString(devList[0].ORG_ID);   //Convert.ToString
                    wucSelORG1.ORG_NAME = Convert.ToString(devList[0].GetValue(HR_ORG.Attribute.ORG_NAME));
                    txtUSE_FLAG.Value   = devList[0].USE_FLAG.ToString();
                    string file = devList[0].DeptTable;
                    file = string.IsNullOrEmpty(file) ? "" : file;
                    if (txtDeptTable.Items.FindByValue(file) != null)
                    {
                        txtDeptTable.Value = file;
                    }
                    else
                    {
                        if (txtDeptTable.Items.FindByValue("-1") == null)
                        {
                            txtDeptTable.Items.Add(new ListItem("´íÎó·½°¸", "-1"));
                        }
                        txtDeptTable.Value = "-1";
                    }
                    file = devList[0].StaffTable;
                    file = string.IsNullOrEmpty(file) ? "" : file;
                    if (txtStaffTable.Items.FindByValue(file) != null)
                    {
                        txtStaffTable.Value = file;
                    }
                    else
                    {
                        if (txtStaffTable.Items.FindByValue("-1") == null)
                        {
                            txtStaffTable.Items.Add(new ListItem("´íÎó·½°¸", "-1"));
                        }
                        txtStaffTable.Value = "-1";
                    }
                }
            }
            catch (Exception ex)
            {
                litWarn.Text = ex.Message;
            }
        }
    }