コード例 #1
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "application/json";
     string result = string.Empty;
     if (context.Request.Params["namecontent"] == null)
     {
         result = "{success:false,msg:'名称不能为空'}";
     }
     else
     {
         try
         {
             string namecontent = context.Request.Params["namecontent"].ToString();
             CY.CSTS.Core.Business.CountryCode countryCode = new CY.CSTS.Core.Business.CountryCode();
             countryCode.Name= namecontent;
             countryCode.Save();
             result = "{success:true}";
         }
         catch (Exception ex)
         {
             result = "{success:false,msg:'" + ex.Message + "'}";
         }
     }
     context.Response.Write(result);
 }
コード例 #2
0
ファイル: Instrument.cs プロジェクト: dalinhuang/cy-csts
        public static void ImportCountry()
        {
            try
            {
                ImportSqlServerUtility isql = new ImportSqlServerUtility();

                RelationSqlServerUtility rsql = new RelationSqlServerUtility();

                string strselectsql = "select * from COUNTRYCODE";

                string insertsql = "insert into RCountry(old,new) values('{0}','{1}')";

                DataSet ds = isql.ExecuteSqlDataSet(strselectsql);

                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        CY.CSTS.Core.Business.CountryCode country = new CY.CSTS.Core.Business.CountryCode();

                        country.Name = ds.Tables[0].Rows[i][1].ToString();

                        country.Save();

                        rsql.ExecuteSql(string.Format(insertsql, ds.Tables[0].Rows[i][0], country.Id));

                    }
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }