Esempio n. 1
0
        /// <summary>
        /// 右键删除事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnMenuDelete_Click(object sender, EventArgs e)
        {
            if (Grid1.SelectedRowIndexArray.Length > 0)
            {
                foreach (int rowIndex in Grid1.SelectedRowIndexArray)
                {
                    string rowID = Grid1.DataKeys[rowIndex][0].ToString();
                    Model.Manager_ResetManHours resetManHours = (from x in Funs.DB.Manager_ResetManHours
                                                                 where x.AccidentReportId == rowID
                                                                 select x).FirstOrDefault();
                    if (resetManHours != null)
                    {
                        Alert.ShowInTop("公司安全人工时管理中已记录该事故,无法删除!", MessageBoxIcon.Warning);
                        return;
                    }
                    else
                    {
                        var getV = BLL.AccidentReport2Service.GetAccidentReportById(rowID);
                        if (getV != null)
                        {
                            BLL.LogService.AddSys_Log(this.CurrUser, getV.AccidentReportCode, getV.AccidentReportId, BLL.Const.ProjectAccidentReportMenuId, Const.BtnDelete);
                            BLL.AccidentReport2Service.DeleteAccidentReportById(rowID);
                        }
                    }
                }

                this.BindGrid();
                ShowNotify("删除数据成功!", MessageBoxIcon.Success);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 增加人工时清零信息
        /// </summary>
        /// <param name="resetManHours">人工时清零实体</param>
        public static void AddResetManHours(Model.Manager_ResetManHours resetManHours)
        {
            Model.SUBHSSEDB db       = Funs.DB;
            string          newKeyID = SQLHelper.GetNewID(typeof(Model.Manager_ResetManHours));

            Model.Manager_ResetManHours newResetManHours = new Model.Manager_ResetManHours
            {
                ResetManHoursId  = newKeyID,
                ProjectId        = resetManHours.ProjectId,
                AccidentTypeId   = resetManHours.AccidentTypeId,
                Abstract         = resetManHours.Abstract,
                AccidentDate     = resetManHours.AccidentDate,
                BeforeManHours   = resetManHours.BeforeManHours,
                AccidentReportId = resetManHours.AccidentReportId,
                ProjectManager   = resetManHours.ProjectManager,
                HSSEManager      = resetManHours.HSSEManager
            };

            db.Manager_ResetManHours.InsertOnSubmit(newResetManHours);
            db.SubmitChanges();
        }