Ejemplo n.º 1
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(!PageValidate.IsDecimal(txtlocation_lat.Text))
            {
                strErr+="location_lat格式错误!\\n";
            }
            if(!PageValidate.IsDecimal(txtlocation_lng.Text))
            {
                strErr+="location_lng格式错误!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int gps_id=int.Parse(this.lblgps_id.Text);
            string user_telphone=this.lbluser_telphone.Text;
            decimal location_lat=decimal.Parse(this.txtlocation_lat.Text);
            decimal location_lng=decimal.Parse(this.txtlocation_lng.Text);

            la.Model.gpslocation model=new la.Model.gpslocation();
            model.gps_id=gps_id;
            model.user_telphone=user_telphone;
            model.location_lat=location_lat;
            model.location_lng=location_lng;

            la.BLL.gpslocation bll=new la.BLL.gpslocation();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx");
        }
Ejemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(!PageValidate.IsNumber(txtgps_id.Text))
            {
                strErr+="gps定位编码格式错误!\\n";
            }
            if(this.txtuser_telphone.Text.Trim().Length==0)
            {
                strErr+="用户Phone不能为空!\\n";
            }
            if(!PageValidate.IsDecimal(txtlocation_lat.Text))
            {
                strErr+="location_lat格式错误!\\n";
            }
            if(!PageValidate.IsDecimal(txtlocation_lng.Text))
            {
                strErr+="location_lng格式错误!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int gps_id=int.Parse(this.txtgps_id.Text);
            string user_telphone=this.txtuser_telphone.Text;
            decimal location_lat=decimal.Parse(this.txtlocation_lat.Text);
            decimal location_lng=decimal.Parse(this.txtlocation_lng.Text);

            la.Model.gpslocation model=new la.Model.gpslocation();
            model.gps_id=gps_id;
            model.user_telphone=user_telphone;
            model.location_lat=location_lat;
            model.location_lng=location_lng;

            la.BLL.gpslocation bll=new la.BLL.gpslocation();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx");
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public la.Model.gpslocation DataRowToModel(DataRow row)
 {
     la.Model.gpslocation model=new la.Model.gpslocation();
     if (row != null)
     {
         if(row["gps_id"]!=null && row["gps_id"].ToString()!="")
         {
             model.gps_id=int.Parse(row["gps_id"].ToString());
         }
         if(row["user_telphone"]!=null)
         {
             model.user_telphone=row["user_telphone"].ToString();
         }
         if(row["location_lat"]!=null && row["location_lat"].ToString()!="")
         {
             model.location_lat=decimal.Parse(row["location_lat"].ToString());
         }
         if(row["location_lng"]!=null && row["location_lng"].ToString()!="")
         {
             model.location_lng=decimal.Parse(row["location_lng"].ToString());
         }
     }
     return model;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public la.Model.gpslocation GetModel(int gps_id,string user_telphone)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 gps_id,user_telphone,location_lat,location_lng from gpslocation ");
            strSql.Append(" where gps_id=@gps_id and user_telphone=@user_telphone ");
            SqlParameter[] parameters = {
                    new SqlParameter("@gps_id", SqlDbType.Int,4),
                    new SqlParameter("@user_telphone", SqlDbType.VarChar,20)			};
            parameters[0].Value = gps_id;
            parameters[1].Value = user_telphone;

            la.Model.gpslocation model=new la.Model.gpslocation();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }