Beispiel #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (this.txtPayName.Text.Trim() == "")
            {
                MessageBox.Show("工资项名不能为空!", "提示");
                return;
            }
            PayrollAdd oEntity = new PayrollAdd();

            oEntity.name      = this.txtPayName.Text;
            oEntity.inputDate = DateTime.Now;
            oEntity.inputMan  = this.UserName;
            oEntity.remark    = this.txtMemo.Text;
            oEntity.kind      = this.cboHumanType.SelectedIndex;
            if (this.cboAddType.SelectedIndex == 0)
            {
                oEntity.minusPlace = this.cboSub.SelectedIndex == 0 ? false:true;
            }
            oEntity.mark = this.cboAddType.SelectedIndex == 0 ? false:true;
            string strResult = new PayrollLogic().AddPayroll(oEntity);

            if (strResult != "")
            {
                System.Windows.Forms.MessageBox.Show(strResult);
                return;
            }
            this.txtPayName.Text = "";
            this.txtMemo.Text    = "";
            this.BindDataGrid();
        }
Beispiel #2
0
        /*
         * 方法名称:InsertPayroll
         * 方法功能描述:插入工资项
         *
         * 创建人:杨林
         * 创建时间:2009-03-12
         *
         * 修改人:
         * 修改时间:
         * 修改内容:
         *
         */
        /// <summary>
        /// 插入工资项
        /// </summary>
        /// <param name="arg">工资项实体类</param>
        /// <returns>返回错误描述,如果为空串则为执行成功</returns>
        public string InsertPayroll(PayrollAdd arg)
        {
            try
            {
                HumanResourceDataContext oHumanContext = new HumanResourceDataContext(this.oSqlHelper.SqlConn);
                oHumanContext.ObjectTrackingEnabled = false;
                var result = from item in oHumanContext.PayrollAdd.AsQueryable <PayrollAdd>()
                             where item.name == arg.name
                             select item.name;
                if (result.Count() > 0)
                {
                    return("指定工资项名称己存在!");
                }
                oHumanContext.ObjectTrackingEnabled = true;

                oHumanContext.PayrollAdd.InsertOnSubmit(arg);
                oHumanContext.SubmitChanges();
                return("");
            }
            catch (System.Data.SqlClient.SqlException)
            {
                throw;
            }
            finally
            {
            }
        }
Beispiel #3
0
        /*
         * 方法名称:AddPayroll
         * 方法功能描述:增加工资项
         *
         * 创建人:杨林
         * 创建时间:2009-03-12
         *
         * 修改人:
         * 修改时间:
         * 修改内容:
         *
         */
        /// <summary>
        /// 增加工资项
        /// </summary>
        /// <param name="args">工资项实体</param>
        /// <returns>错误描述</returns>
        public string AddPayroll(PayrollAdd args)
        {
            string strResult = null;

            try
            {
                strResult = new PayrollDB().InsertPayroll(args);
            }
            catch (System.Data.SqlClient.SqlException e)
            {
                strResult = e.Message;
            }
            return(strResult);
        }