Ejemplo n.º 1
0
        /// <summary>
        /// 停用或启用
        /// </summary>
        /// <param name="sender">控件</param>
        /// <param name="e">参数</param>
        private void btnStop_Click(object sender, EventArgs e)
        {
            if (dgEntrust.CurrentCell == null)
            {
                return;
            }

            RowIndex = dgEntrust.CurrentCell.RowIndex;
            DataTable     dt         = (DataTable)dgEntrust.DataSource;
            Basic_Entrust entEntrust = new Basic_Entrust();

            entEntrust = EFWCoreLib.CoreFrame.Common.ConvertExtend.ToObject <Basic_Entrust>(dt, RowIndex);
            if (btnStop.Text == "启用(&U)")
            {
                entEntrust.DelFlag = 0;
            }
            else
            {
                entEntrust.DelFlag = 1;
            }

            if (Convert.ToInt32(InvokeController("SaveEntrust", entEntrust, Convert.ToInt32(cbbWork.SelectedValue))) > 0)
            {
                InvokeController("LoadEntrustInfo", cbbWork.SelectedValue, txtQueryName.Text);
                btnCancel.Enabled = false;
                btnSave.Enabled   = false;
                btnNew.Enabled    = true;
                btnStop.Enabled   = true;
                setGridSelectIndex(dgEntrust);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender">控件</param>
        /// <param name="e">参数</param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtName.Text) == true)
            {
                MessageBoxEx.Show("嘱托名称不能为空!", "提示框", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (RegexTelPhone(txtName.Text) == true)
            {
                MessageBoxEx.Show("嘱托名称不能包含特殊字符,请删除!", "提示框", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (Convert.ToBoolean(InvokeController("CheckEntrustName", Entrust, txtName.Text, Convert.ToInt32(cbbWork.SelectedValue))) == false)
            {
                MessageBoxEx.Show("嘱托名称已存在!", "提示框", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            int           flag       = Entrust; //是新增0或修改
            Basic_Entrust entEntrust = new Basic_Entrust();

            entEntrust.EntrustID   = Entrust;
            entEntrust.PYCode      = txtPY.Text;
            entEntrust.EntrustName = txtName.Text;
            entEntrust.WBCode      = txtWB.Text;
            if (flag == 0)
            {
                entEntrust.DelFlag = 0;
            }

            if (Convert.ToInt32(InvokeController("SaveEntrust", entEntrust, Convert.ToInt32(cbbWork.SelectedValue))) > 0)
            {
                InvokeController("LoadEntrustInfo", cbbWork.SelectedValue, txtQueryName.Text);
                if (flag > 0)
                {
                    setGridSelectIndex(dgEntrust);
                }
                else
                {
                    setGridSelectIndex(dgEntrust, ((DataTable)dgEntrust.DataSource).Rows.Count - 1);
                }

                btnCancel.Enabled = false;
                btnSave.Enabled   = false;
                btnNew.Enabled    = true;
                btnStop.Enabled   = true;
                btnQuery.Enabled  = true;
            }
        }
Ejemplo n.º 3
0
        public int SaveEntrust(Basic_Entrust ent, int workID)
        {
            var retdata = InvokeWcfService(
                "BaseProject.Service",
                "EntrustController",
                "SaveEntrust",
                (request) =>
            {
                request.AddData(ent);
                request.AddData(workID);
            });

            return(retdata.GetData <int>(0));
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 保存嘱托
 /// </summary>
 /// <param name="entity">嘱托</param>
 /// <returns>保存成功行数</returns>
 public int SaveEntrust(Basic_Entrust entity)
 {
     this.BindDb(entity);
     return(entity.save());
 }