Exemple #1
0
        /// <summary>
        /// 修改PathEmpRelation信息
        /// </summary>
        /// <param name="pathEmpRelation">线路员工关系类对象</param>
        /// <returns>此次操作影响的行数</returns>
        public int UpdatePathEmpRelation_cjg(PathEmpRelationModel pathEmpRelation)
        {
            if (pathEmpRelationDal == null)
            {
                pathEmpRelationDal = new PathEmpRelationDal();
            }
            string strMessage = "";
            int    result     = pathEmpRelationDal.UpdatePathEmpRelation(pathEmpRelation, out strMessage);

            return(result);
        }
Exemple #2
0
        /// <summary>
        /// 增加PathEmpRelation信息
        /// </summary>
        /// <param name="pathEmpRelation">线路员工关系类对象</param>
        /// <returns>此次操作影响的行数</returns>
        public int InsertPathEmpRelation_cjg(PathEmpRelationModel pathEmpRelation)
        {
            if (pathEmpRelationDal == null)
            {
                pathEmpRelationDal = new PathEmpRelationDal();
            }

            int result = pathEmpRelationDal.InsertPathEmpRelation_cjg(pathEmpRelation);

            return(result);
        }
Exemple #3
0
        /// <summary>
        /// 增加PathEmpRelation信息
        /// </summary>
        /// <param name="pathEmpRelation">线路员工关系类对象</param>
        /// <returns>此次操作影响的行数</returns>
        public int InsertPathEmpRelation(PathEmpRelationModel pathEmpRelation, out string strMessage)
        {
            if (pathEmpRelationDal == null)
            {
                pathEmpRelationDal = new PathEmpRelationDal();
            }

            int result = pathEmpRelationDal.InsertPathEmpRelation(pathEmpRelation, out strMessage);

            return(result);
        }
Exemple #4
0
        /// <summary>
        /// 增加PathEmpRelation信息
        /// </summary>
        /// <param name="pathEmpRelation">线路员工关系类对象</param>
        /// <returns>此次操作影响的行数</returns>
        public int InsertPathEmpRelation_cjg(PathEmpRelationModel pathEmpRelation)
        {
            SqlParameter[] para = new SqlParameter[] {
                new SqlParameter("@PathNo", SqlDbType.VarChar, 20),
                new SqlParameter("@EmpNo", SqlDbType.VarChar, 20),
            };
            para[0].Value = pathEmpRelation.PathNo;
            para[1].Value = pathEmpRelation.EmpNo;

            int result = help.RunProcedureByInt("insert_Path_Emp_Relation", para, out outStr);

            return(result);
        }
Exemple #5
0
        /// <summary>
        /// 增加PathEmpRelation信息
        /// </summary>
        /// <param name="pathEmpRelation">线路员工关系类对象</param>
        /// <returns>此次操作影响的行数</returns>
        public int InsertPathEmpRelation(PathEmpRelationModel pathEmpRelation, out string strMessage)
        {
            SqlParameter[] para = new SqlParameter[] {
                new SqlParameter("@PathNo", SqlDbType.VarChar, 50),
                new SqlParameter("@EmpID", SqlDbType.Int),
            };
            para[0].Value = pathEmpRelation.PathNo;
            para[1].Value = pathEmpRelation.EmpID;

            int result = help.RunProcedureByInt("insert_Path_Emp_Relation", para, out strMessage);

            return(result);
        }
Exemple #6
0
        /// <summary>
        /// 修改PathEmpRelation信息
        /// </summary>
        /// <returns>返回操作结果 1表示成功</returns>
        private int UpdatePathEmpRelation()
        {
            try
            {
                //存入日志
                LogSave.Messages("[FrmPathEmp]", LogIDType.UserLogID, "修改员工路径关系信息,路线编号:"
                                 + this.tbPathNo.Text + ",员工姓名:" + this.cbEmp.SelectedText.ToString() + "。");

                KJ128NModel.PathEmpRelationModel model = new PathEmpRelationModel();
                model.Id = Convert.ToInt32(dgvMain.CurrentRow.Cells["Id"].Value.ToString());

                if (this.cbEmp.SelectedValue != null)
                {
                    model.EmpID = Convert.ToInt32(this.cbEmp.SelectedValue.ToString());
                }
                else
                {
                    MessageBox.Show("修改员工信息不存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(0);
                }
                model.PathNo = this.tbPathNo.Text;
                string strMessage = "";
                int    count      = pathEmpRelationbll.UpdatePathEmpRelation(model, out strMessage);

                bool flag = (count == 1 ? true : false);

                if (flag)
                {
                    this.vspnlAdd.Visible = false;
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
            catch
            {
                return(0);
            }
        }
Exemple #7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (Check())
            {
                PathEmpRelationModel pathEmpModel = new PathEmpRelationModel();
                pathEmpModel.PathNo = cmbPathID.Text;
                pathEmpModel.EmpID  = int.Parse(cmbEmp.SelectedValue.ToString());
                string strMessage = "";
                int    rowCount   = 0;
                switch (m_type)
                {
                case 1:    //添加
                    try
                    {
                        rowCount = pathEmpBll.InsertPathEmpRelation(pathEmpModel, out strMessage);
                        if (strMessage.Equals("Succeeds"))
                        {
                            if (rowCount > 0)
                            {
                                SetShowInfo("保存成功", Color.Black);
                            }
                            else
                            {
                                SetShowInfo("添加重复数据", Color.Red);
                                return;
                            }
                        }
                        else
                        {
                            SetShowInfo("保存失败", Color.Red);
                            return;
                        }
                    }
                    catch
                    {
                        SetShowInfo("保存失败", Color.Red);
                        return;
                    }

                    break;

                case 2:    //修改
                    pathEmpModel.Id = int.Parse(txtID.Text);
                    try
                    {
                        pathEmpBll.UpdatePathEmpRelation(pathEmpModel, out strMessage);
                        if (strMessage.Equals("Succeeds"))
                        {
                            SetShowInfo("修改成功", Color.Black);
                        }
                        else
                        {
                            SetShowInfo("修改失败", Color.Red);
                            return;
                        }
                    }
                    catch
                    {
                        SetShowInfo("修改失败", Color.Red);
                        return;
                    }
                    break;
                }
                if (!New_DBAcess.IsDouble)          //单机版,直接刷新
                {
                    m_frmPathManage.SetTreeViewPathEmp();
                    m_frmPathManage.BindData("");
                }
                else                                //热备版,启用定时器
                {
                    m_frmPathManage.HostBackRefresh(true);
                }
            }
        }