Ejemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (bll.IsExitNotSelf(id, txtName.Text.Trim()))
            {
                MessageBox.Show("名称重复!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                try
                {
                    T_JB_WAREHOUSE mo = new T_JB_WAREHOUSE();

                    mo.C_ID         = id;
                    mo.C_COM        = txtCom.Text.Trim();
                    mo.C_NAME       = txtName.Text.Trim();
                    mo.C_BAUDRATE   = txtBaudrate.Text.Trim();
                    mo.C_PORT       = txtPort.Text.Trim();
                    mo.C_WRITE_PORT = txtWritePort.Text.Trim();
                    mo.C_READ_PORT  = txtReadPort.Text.Trim();
                    mo.C_IP_ADDRESS = txtIpAddress.Text.Trim();
                    mo.C_TYPE       = cmbType.SelectedValue.ToString();
                    mo.I_AUTO       = cbAuto.Checked ? 1 : 0;
                    mo.I_IN_MOBILE  = cbIn.Checked ? 1 : 0;
                    mo.I_OUT_MOBILE = cbOut.Checked ? 1 : 0;

                    if (bll.Update(mo))
                    {
                        MessageBox.Show("保存成功!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Log.saveLog("修改库房成功!Id:" + lblId.Text);
                        Close();
                    }
                    else
                    {
                        MessageBox.Show("保存失败!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("与数据库连接失败,请查看网络连接是否正常。如不能解决请与网络管理员联系!", "严重错误:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Ejemplo n.º 2
0
        protected void btSave_Click(object sender, EventArgs e)
        {
            Warehouse        info   = new Warehouse();
            WarehouseBLL     bll    = null;
            DataResult <int> result = null;

            try
            {
                UIBindHelper.BindModelByControls(this.Page, info);

                bll = BLLFactory.CreateBLL <WarehouseBLL>();

                if (this.hiID.Value == "")
                {
                    result = bll.Insert(info);
                }
                else
                {
                    info.CREATEUSER = this.HiCREATEUSER.Value;
                    info.CREATETIME = DateTime.Parse(this.HiCREATETIME.Value);
                    info.ID         = this.hiID.Value;
                    result          = bll.Update(info);
                }

                if (string.IsNullOrEmpty(result.Msg) == false)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "myjs", "MSI('提示','" + result.Msg + "')", true);
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "myjs", "parent.refreshData();parent.closeAppWindow1();", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }