コード例 #1
0
 private void ShowInfo(int AddressId)
 {
     NoName.NetShop.BLL.AddressModelBll bll=new NoName.NetShop.BLL.AddressModelBll();
     NoName.NetShop.Model.AddressModel model=bll.GetModel(AddressId);
     this.lblUserId.Text=model.UserId.ToString();
     this.lblProvince.Text=model.Province;
     this.lblCity.Text=model.City;
     this.lblAddressDetail.Text=model.AddressDetail;
     this.lblRecieverName.Text=model.RecieverName;
     this.lblMobile.Text=model.Mobile;
     this.lblTelephone.Text=model.Telephone;
     this.lblPostalcode.Text=model.Postalcode;
     this.chkIsDefault.Checked=model.IsDefault;
     this.lblInsertTime.Text=model.InsertTime.ToString();
     this.lblModifyTime.Text=model.ModifyTime.ToString();
 }
コード例 #2
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(!PageValidate.IsNumber(txtUserId.Text))
            {
            strErr+="UserId�������֣�\\n";
            }
            if(this.txtProvince.Text =="")
            {
            strErr+="Province����Ϊ�գ�\\n";
            }
            if(this.txtCity.Text =="")
            {
            strErr+="City����Ϊ�գ�\\n";
            }
            if(this.txtAddressDetail.Text =="")
            {
            strErr+="AddressDetail����Ϊ�գ�\\n";
            }
            if(this.txtRecieverName.Text =="")
            {
            strErr+="RecieverName����Ϊ�գ�\\n";
            }
            if(this.txtMobile.Text =="")
            {
            strErr+="Mobile����Ϊ�գ�\\n";
            }
            if(this.txtTelephone.Text =="")
            {
            strErr+="Telephone����Ϊ�գ�\\n";
            }
            if(this.txtPostalcode.Text =="")
            {
            strErr+="Postalcode����Ϊ�գ�\\n";
            }
            if(!PageValidate.IsDateTime(txtInsertTime.Text))
            {
            strErr+="InsertTime����ʱ���ʽ��\\n";
            }
            if(!PageValidate.IsDateTime(txtModifyTime.Text))
            {
            strErr+="ModifyTime����ʱ���ʽ��\\n";
            }

            if(strErr!="")
            {
            MessageBox.Show(this,strErr);
            return;
            }
            int UserId=int.Parse(this.txtUserId.Text);
            string Province=this.txtProvince.Text;
            string City=this.txtCity.Text;
            string AddressDetail=this.txtAddressDetail.Text;
            string RecieverName=this.txtRecieverName.Text;
            string Mobile=this.txtMobile.Text;
            string Telephone=this.txtTelephone.Text;
            string Postalcode=this.txtPostalcode.Text;
            bool IsDefault=this.chkIsDefault.Checked;
            DateTime InsertTime=DateTime.Parse(this.txtInsertTime.Text);
            DateTime ModifyTime=DateTime.Parse(this.txtModifyTime.Text);

            NoName.NetShop.Model.AddressModel model=new NoName.NetShop.Model.AddressModel();
            model.UserId=UserId;
            model.Province=Province;
            model.City=City;
            model.AddressDetail=AddressDetail;
            model.RecieverName=RecieverName;
            model.Mobile=Mobile;
            model.Telephone=Telephone;
            model.Postalcode=Postalcode;
            model.IsDefault=IsDefault;
            model.InsertTime=InsertTime;
            model.ModifyTime=ModifyTime;

            NoName.NetShop.BLL.AddressModelBll bll=new NoName.NetShop.BLL.AddressModelBll();
            bll.Add(model);
        }