Пример #1
0
 private void SetValue(ShipExpress model)
 {
     txtContactMan.Text  = model.ContactMan;
     txtContactType.Text = model.ContactType;
     txtName.Text        = model.Name;
     txtRemarks.Text     = model.Remarks;
 }
Пример #2
0
    protected void lbtnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            ShipExpress model = null;
            if (string.IsNullOrEmpty(Request.QueryString["ID"]))
            {//新增
                model = new ShipExpress();
                GetValue(model);
                //    BLLExpress.Add(model);
                KWebApiHelper <ShipExpress> .Post <ShipExpress>(KApiUrlConfig.ShipApiUrl, "Express/add", model);
            }
            else
            {//修改
                model = KWebApiHelper <ShipExpress> .Get(KApiUrlConfig.ShipApiUrl, "Express/get/" + Request.QueryString["ID"].ToString());

                GetValue(model);
                KWebApiHelper <bool> .Post <ShipExpress>(KApiUrlConfig.ShipApiUrl, "Express/edit", model);
            }
            ClientScript.RegisterStartupScript(this.GetType(), "success", "alert('操作成功!');parent.close1(true);", true);
        }
        catch (Exception ex)
        {
            string message = "添加失败!" + ex.Message;
            ClientScript.RegisterStartupScript(this.GetType(), "failed", "alert('" + message + "');", true);
        }
    }
Пример #3
0
 private void GetValue(ShipExpress model)
 {
     model.ContactMan  = txtContactMan.Text.Trim();
     model.Name        = txtName.Text.Trim();
     model.Remarks     = txtRemarks.Text.Trim();
     model.ContactType = txtContactType.Text.Trim();
 }
Пример #4
0
    private void BindInfo()
    {
        string      id    = Request.QueryString["ID"].ToString();
        ShipExpress model = KWebApiHelper <ShipExpress> .Get(KApiUrlConfig.ShipApiUrl, "Express/get/" + id);

        if (model != null)
        {
            SetValue(model);
        }
    }