示例#1
0
        public string GetOrganization(string dptcd)
        {
            dptmas dept = new dptmas();
            dept.rmode = "SLT";

            return execute(dept);
        }
示例#2
0
        private string execute(dptmas d)
        {
            SqlDbAccess dbAccess = new SqlDbAccess(PKDBHelper.ConnectString);
            string jsonset = string.Empty;

            if (("{SLT}").IndexOf("{" + d.rmode + "}") >= 0)
            {
                string query = @"MBL_DPTMAS_M1";
                SqlParamCollection parameters = new SqlParamCollection();

                PKDBHelper.SqlAddParam(parameters, "@INFDS", SqlDbType.VarChar, 100, d.infds);
                PKDBHelper.SqlAddParam(parameters, "@RTNCD", SqlDbType.VarChar, 100, d.rtncd);
                PKDBHelper.SqlAddParam(parameters, "@RMODE", SqlDbType.VarChar, 20, d.rmode);
                PKDBHelper.SqlAddParam(parameters, "@DPTCD", SqlDbType.VarChar, 10, d.dptcd);

                DataTable  dt = dbAccess.ExecuteSpDataSet(query, parameters).Tables[0];

                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if(dt.Rows[i]["HPTEL"].ToString().Trim()!=string.Empty)
                        {
                            dt.Rows[i]["HPTEL"] = CryptoHelper.DecryptText(dt.Rows[i]["HPTEL"].ToString().Trim());
                        }

                        if (dt.Rows[i]["EMAIL"].ToString().Trim() != string.Empty)
                        {
                            dt.Rows[i]["EMAIL"] = CryptoHelper.DecryptText(dt.Rows[i]["EMAIL"].ToString().Trim());
                        }

                        if (dt.Rows[i]["TELNO"].ToString().Trim() != string.Empty)
                        {
                            dt.Rows[i]["TELNO"] = CryptoHelper.DecryptText(dt.Rows[i]["TELNO"].ToString().Trim());
                        }

                        //if (dt.Rows[i]["GNAME"].ToString().Trim() != string.Empty)
                        //{
                        //    dt.Rows[i]["GNAME"] = "XXX"; //dt.Rows[i]["GNAME"].ToString().Trim().Replace('(', 'X').Replace(')', 'Y');
                        //}
                    }

                    return JsonConvert.SerializeObject(dt); //, Formatting.Indented);
                }
                else
                {
                    return string.Empty;
                }
            }
            else
            {
                return string.Empty;
            }
        }