Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //用户ID
            var codeUser = Request.Params["CodeUser"];

            Dictionary <string, string> info = new Dictionary <string, string>();

            try
            {
                if (codeUser == null)
                {
                    info.Add("参加CodeUser", "http://218.92.115.55/MobilePlatform/UserPermission/GetPerContactDetail.aspx?CodeUser=67545");
                    Json = JsonConvert.SerializeObject(info);
                    return;
                }

                string sql = string.Format("select code,Description from gpms2000_nbw..department_sr");
                var    dt0 = new Leo.SqlServer.DataAccess(RegistryKey.KeyPathNbwDept).ExecuteTable(sql);
                if (dt0.Rows.Count == 0)
                {
                    info.Add("IsGet", "No");
                    info.Add("Message", "网络错误,请稍后再试!");
                    Json = JsonConvert.SerializeObject(info);
                    return;
                }

                sql =
                    string.Format(
                        "select t.user_id,t.login_name,t.user_name,t.tel,t.email,t.company_id,t.company_name,t.dept_id,t.tel1,t.duty,t.tel2,t.pemail,t.phone1,t.head_pic from VW_SYS_USER t where t.user_id='{0}'",
                        codeUser);
                var dt1 = new Leo.Oracle.DataAccess(RegistryKey.KeyPathMa).ExecuteTable(sql);
                if (dt1.Rows.Count == 0)
                {
                    info.Add("IsGet", "No");
                    info.Add("Message", "用户ID不存在!");
                    Json = JsonConvert.SerializeObject(info);
                    return;
                }

                string departmentName = "";
                bool   markWeibo      = true;
                var    rows           = dt0.Select(string.Format("CODE='{0}'", Convert.ToString(dt1.Rows[0]["dept_id"])));
                if (rows.Length > 0)
                {
                    departmentName = rows[0]["DESCRIPTION"] as string;
                }
                markWeibo =
                    !(dt1.Rows[0]["EMAIL"] is DBNull) && !string.IsNullOrEmpty(dt1.Rows[0]["EMAIL"] as string) &&
                    !string.IsNullOrWhiteSpace(dt1.Rows[0]["EMAIL"] as string);

                info.Add("姓名", Convert.ToString(dt1.Rows[0]["USER_NAME"]));
                info.Add("机构", Convert.ToString(dt1.Rows[0]["COMPANY_NAME"]));
                info.Add("部门", departmentName);
                info.Add("职务", Convert.ToString(dt1.Rows[0]["DUTY"]));
                info.Add("工作手机", Convert.ToString(dt1.Rows[0]["TEL"]));
                info.Add("备用手机", Convert.ToString(dt1.Rows[0]["PHONE1"]));
                info.Add("办公室电话", Convert.ToString(dt1.Rows[0]["TEL1"]));
                info.Add("备用电话", Convert.ToString(dt1.Rows[0]["TEL2"]));
                info.Add("集团邮箱", Convert.ToString(dt1.Rows[0]["EMAIL"]));
                info.Add("个人邮箱", Convert.ToString(dt1.Rows[0]["PEMAIL"]));
                info.Add("云之家微博", markWeibo == true ? "已开通" : "未开通");

                Json = JsonConvert.SerializeObject(info);
            }
            catch (Exception ex)
            {
                info.Add("IsGet", "No");
                info.Add("Message", ex.Message);
                Json = JsonConvert.SerializeObject(info);
                return;
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string sql = string.Format("select code,Description from gpms2000_nbw..department_sr");
                var    dt0 = new Leo.SqlServer.DataAccess(RegistryKey.KeyPathNbwDept).ExecuteTable(sql);
                if (dt0.Rows.Count == 0)
                {
                    string error = "网络错误,请稍后再试!";
                    Json = JsonConvert.SerializeObject(error);
                    return;
                }

                sql =
                    string.Format(
                        @"select c.id,c.login_name,c.user_name,d.mobile as tel,c.email,c.company_id,c.company_name,c.dept_id,c.tel1,c.duty,c.tel2,c.pemail,c.phone1,c.head_pic 
                          from (select a.id,a.username as login_name,a.truename as user_name,a.email,a.companyid as company_id,b.shortname as company_name,a.bumenid as dept_id,a.tel1,a.duty,a.tel2,a.pemail,a.phone1,a.head_pic 
                          from user_info a, company_name b 
                          where a.companyid='{0}' and substr(a.bumenid,1,4)=b.companyid  order by user_name) c ,awsprod.orguser d 
                          where c.login_name = d.userid",
                        "017929");
                var dt1 = new Leo.Oracle.DataAccess(RegistryKey.KeyPathNbws).ExecuteTable(sql);

                var infoArray = new List <Dictionary <string, string> >();
                for (int iRow = 0; iRow < dt1.Rows.Count; iRow++)
                {
                    string departmentName = "";
                    bool   markWeibo      = true;
                    var    rows           = dt0.Select(string.Format("CODE='{0}'", Convert.ToString(dt1.Rows[iRow]["dept_id"])));
                    if (rows.Length > 0)
                    {
                        departmentName = rows[0]["DESCRIPTION"] as string;
                    }
                    departmentName = departmentName == null ? string.Empty : departmentName;

                    markWeibo =
                        !(dt1.Rows[iRow]["EMAIL"] is DBNull) && !string.IsNullOrEmpty(dt1.Rows[iRow]["EMAIL"] as string) &&
                        !string.IsNullOrWhiteSpace(dt1.Rows[iRow]["EMAIL"] as string);

                    Dictionary <string, string> info = new Dictionary <string, string>();
                    info.Add("userID", Convert.ToString(dt1.Rows[iRow]["ID"]));
                    info.Add("name", Convert.ToString(dt1.Rows[iRow]["USER_NAME"]));
                    info.Add("company", Convert.ToString(dt1.Rows[iRow]["COMPANY_NAME"]));
                    info.Add("department", departmentName);
                    info.Add("duty", Convert.ToString(dt1.Rows[iRow]["DUTY"]));
                    info.Add("mobilephone", Convert.ToString(dt1.Rows[iRow]["TEL"]));
                    info.Add("backupmobilephone", Convert.ToString(dt1.Rows[iRow]["PHONE1"]));
                    info.Add("telephone", Convert.ToString(dt1.Rows[iRow]["TEL1"]));
                    info.Add("backuptelephone", Convert.ToString(dt1.Rows[iRow]["TEL2"]));
                    info.Add("workemail", Convert.ToString(dt1.Rows[iRow]["EMAIL"]));
                    info.Add("personalemail", Convert.ToString(dt1.Rows[iRow]["PEMAIL"]));
                    info.Add("weibo", markWeibo == true ? "已开通" : "未开通");
                    infoArray.Add(info);
                }

                Json = JsonConvert.SerializeObject(infoArray);
            }
            catch (Exception ex)
            {
                Json = JsonConvert.SerializeObject(ex.Message);
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //应用名称
            var appName = Request.Params["AppName"];

            try
            {
                if (appName == null)
                {
                    string warning = "参数AppName不能为null!举例:http://218.92.115.55/MobilePlatform/Contacts/GetPersonContactList.aspx?AppName=WLKG";
                    Json = JsonConvert.SerializeObject(warning);
                    return;
                }

                //获取App应用对应的公司,公司对应的内部网公司ID
                string nbwCompanyId = DictionaryTool.GetNbwCompanyId(appName.ToUpper());
                if (nbwCompanyId == string.Empty)
                {
                    string warning = "应用名称错误!";
                    Json = JsonConvert.SerializeObject(warning);
                    return;
                }

                string sql = string.Format("select code,Description from gpms2000_nbw..department_sr");
                var    dt0 = new Leo.SqlServer.DataAccess(RegistryKey.KeyPathNbwDept).ExecuteTable(sql);
                if (dt0.Rows.Count == 0)
                {
                    string error = "网络错误,请稍后再试!";
                    Json = JsonConvert.SerializeObject(error);
                    return;
                }

                sql =
                    string.Format(
                        "select a.id,a.username as login_name,a.truename as user_name,a.tel,a.email,a.companyid as company_id,b.shortname as company_name,a.bumenid as dept_id,a.tel1,a.duty,a.tel2,a.pemail,a.phone1,a.head_pic from user_info a, company_name b where a.companyid='{0}' and substr(a.bumenid,1,4)=b.companyid  order by user_name",
                        nbwCompanyId);
                var dt1 = new Leo.Oracle.DataAccess(RegistryKey.KeyPathNbw).ExecuteTable(sql);

                var infoArray = new List <Dictionary <string, string> >();
                for (int iRow = 0; iRow < dt1.Rows.Count; iRow++)
                {
                    string departmentName = "";
                    bool   markWeibo      = true;
                    var    rows           = dt0.Select(string.Format("CODE='{0}'", Convert.ToString(dt1.Rows[iRow]["dept_id"])));
                    if (rows.Length > 0)
                    {
                        departmentName = rows[0]["DESCRIPTION"] as string;
                    }
                    departmentName = departmentName == null ? string.Empty : departmentName;

                    markWeibo =
                        !(dt1.Rows[iRow]["EMAIL"] is DBNull) && !string.IsNullOrEmpty(dt1.Rows[iRow]["EMAIL"] as string) &&
                        !string.IsNullOrWhiteSpace(dt1.Rows[iRow]["EMAIL"] as string);

                    Dictionary <string, string> info = new Dictionary <string, string>();
                    info.Add("userID", Convert.ToString(dt1.Rows[iRow]["ID"]));
                    info.Add("name", Convert.ToString(dt1.Rows[iRow]["USER_NAME"]));
                    info.Add("company", Convert.ToString(dt1.Rows[iRow]["COMPANY_NAME"]));
                    info.Add("department", departmentName);
                    info.Add("duty", Convert.ToString(dt1.Rows[iRow]["DUTY"]));
                    info.Add("mobilephone", Convert.ToString(dt1.Rows[iRow]["TEL"]));
                    info.Add("backupmobilephone", Convert.ToString(dt1.Rows[iRow]["PHONE1"]));
                    info.Add("telephone", Convert.ToString(dt1.Rows[iRow]["TEL1"]));
                    info.Add("backuptelephone", Convert.ToString(dt1.Rows[iRow]["TEL2"]));
                    info.Add("workemail", Convert.ToString(dt1.Rows[iRow]["EMAIL"]));
                    info.Add("personalemail", Convert.ToString(dt1.Rows[iRow]["PEMAIL"]));
                    info.Add("weibo", markWeibo == true ? "已开通" : "未开通");
                    infoArray.Add(info);
                }

                Json = JsonConvert.SerializeObject(infoArray);
            }
            catch (Exception ex)
            {
                Json = JsonConvert.SerializeObject(ex.Message);
            }
        }