Exemple #1
0
        public DataTable GetOrgInfo(string userid, string billno)
        {
            DataTable dt = new DataTable();

            dt.TableName = "OrgInfo";

            dt.Columns.Add(new DataColumn("select", Type.GetType("System.Boolean")));
            dt.Columns.Add(new DataColumn("orgid", Type.GetType("System.String")));
            dt.Columns.Add(new DataColumn("orgname", Type.GetType("System.String")));
            dt.Columns.Add(new DataColumn("fillpsnorg", Type.GetType("System.String")));
            dt.Columns.Add(new DataColumn("applicantorg", Type.GetType("System.String")));

            if (!string.IsNullOrEmpty(billno))
            {
                DataTable orgDt = dac.GetOrgDt(userid, billno);
                for (int i = 0; i < orgDt.Rows.Count; i++)
                {
                    DataRow dr = dt.NewRow();
                    dr["select"]  = orgDt.Rows[i]["isselect"].ToString() == "1" ? true : false;
                    dr["orgid"]   = orgDt.Rows[i]["orgid"];
                    dr["orgname"] = orgDt.Rows[i]["orgname"];

                    string fillpsnorg = orgDt.Rows[i]["fillpsnorg"].ToString();
                    if (fillpsnorg == "1")
                    {
                        dr["fillpsnorg"] = "登录组织/信息组织";
                    }
                    else if (fillpsnorg == "2")
                    {
                        dr["fillpsnorg"] = "信息组织";
                    }
                    string applicantorg = orgDt.Rows[i]["applicantorg"].ToString();
                    if (applicantorg == "1")
                    {
                        dr["applicantorg"] = "登录组织/信息组织";
                    }
                    else if (applicantorg == "2")
                    {
                        dr["applicantorg"] = "信息组织";
                    }

                    dt.Rows.Add(dr);
                }
            }

            if (string.IsNullOrEmpty(billno) || dt.Rows.Count == 0)
            {
                long      curuserid    = NG3.AppInfoBase.UserID;
                DataTable fillPsnOrgDt = dac.GetOrgIdName(curuserid);
                for (int i = 0; i < fillPsnOrgDt.Rows.Count; i++)
                {
                    DataRow dr = dt.NewRow();
                    dr["select"] = false;
                    string orgid = fillPsnOrgDt.Rows[i]["orgid"].ToString();
                    dr["orgid"]   = orgid;
                    dr["orgname"] = fillPsnOrgDt.Rows[i]["oname"];

                    string userOrgCount = dac.GetUserOrgCount(curuserid.ToString(), orgid);
                    dr["fillpsnorg"] = userOrgCount == "2" ? "登录组织/信息组织" : "信息组织";

                    userOrgCount = dac.GetUserOrgCount(userid, orgid);
                    if (userOrgCount == "2")
                    {
                        dr["select"]       = true;
                        dr["applicantorg"] = "登录组织/信息组织";
                    }
                    else if (userOrgCount == "1")
                    {
                        dr["select"]       = true;
                        dr["applicantorg"] = "信息组织";
                    }

                    dt.Rows.Add(dr);
                }
            }

            return(dt);
        }