Esempio n. 1
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <param name="kpiEntity">考核信息</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, SafepunishEntity entity, SafekpidataEntity kpiEntity)
 {
     try
     {
         service.SaveForm(keyValue, entity, kpiEntity);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 删除数据
        /// </summary>
        /// <param name="keyValue">主键</param>
        public void RemoveForm(string keyValue)
        {
            SafekpidataService safekpidata = new SafekpidataService();
            SafekpidataEntity  list        = safekpidata.GetList("").Where(p => p.SafePunishId == keyValue).FirstOrDefault();

            if (list != null)
            {
                safekpidata.RemoveForm(list.ID);
            }
            this.BaseRepository().Delete(keyValue);
        }
Esempio n. 3
0
        public ActionResult SaveForm(string keyValue, SafepunishEntity entity, SafekpidataEntity kpiEntity, [System.Web.Http.FromBody] string punishJson, [System.Web.Http.FromBody] string relatedpunishJson)
        {
            var year       = DateTime.Now.ToString("yyyy");
            var month      = DateTime.Now.ToString("MM");
            var day        = DateTime.Now.ToString("dd");
            var punishCode = "Q/CRPHZHB 2208.06.01-JL02-" + year + month + day + safepunishbll.GetPunishCode();

            entity.SafePunishCode = !string.IsNullOrEmpty(entity.SafePunishCode) ? entity.SafePunishCode : punishCode;
            safepunishbll.SaveForm(keyValue, entity, kpiEntity);
            if (entity.AmerceType == "2" || entity.AmerceType == "3" || entity.AmerceType == "4")
            {
                if (punishJson.Length > 0)
                {
                    if (safepunishdetailbll.Remove(keyValue, "0") > 0)
                    {
                        List <SafepunishdetailEntity> list = Newtonsoft.Json.JsonConvert.DeserializeObject <List <SafepunishdetailEntity> >(punishJson);
                        foreach (SafepunishdetailEntity data in list)
                        {
                            safepunishdetailbll.SaveForm("", data);
                        }
                    }
                }

                if (relatedpunishJson.Length > 0)
                {
                    if (safepunishdetailbll.Remove(keyValue, "1") > 0)
                    {
                        List <SafepunishdetailEntity> list = Newtonsoft.Json.JsonConvert.DeserializeObject <List <SafepunishdetailEntity> >(relatedpunishJson);
                        foreach (SafepunishdetailEntity data in list)
                        {
                            safepunishdetailbll.SaveForm("", data);
                        }
                    }
                }
            }
            return(Success("操作成功。"));
        }
Esempio n. 4
0
        public ActionResult CommitApply(string keyValue, AptitudeinvestigateauditEntity entity, SafepunishEntity punEntity, SafekpidataEntity kpiEntity, [System.Web.Http.FromBody] string punishJson, [System.Web.Http.FromBody] string relatedpunishJson)
        {
            if (punEntity != null && (string.IsNullOrEmpty(punEntity.ApplyState) || punEntity.ApplyState == "0"))
            {
                var year       = DateTime.Now.ToString("yyyy");
                var month      = DateTime.Now.ToString("MM");
                var day        = DateTime.Now.ToString("dd");
                var punishCode = "Q/CRPHZHB 2208.06.01-JL02-" + year + month + day + safepunishbll.GetPunishCode();
                punEntity.SafePunishCode = !string.IsNullOrEmpty(punEntity.SafePunishCode) ? punEntity.SafePunishCode : punishCode;
                safepunishbll.SaveForm(keyValue, punEntity, kpiEntity);
                if (punishJson.Length > 0)
                {
                    if (safepunishdetailbll.Remove(keyValue, "0") > 0)
                    {
                        List <SafepunishdetailEntity> list = Newtonsoft.Json.JsonConvert.DeserializeObject <List <SafepunishdetailEntity> >(punishJson);
                        foreach (SafepunishdetailEntity data in list)
                        {
                            safepunishdetailbll.SaveForm("", data);
                        }
                    }
                }

                if (relatedpunishJson.Length > 0)
                {
                    if (safepunishdetailbll.Remove(keyValue, "1") > 0)
                    {
                        List <SafepunishdetailEntity> list = Newtonsoft.Json.JsonConvert.DeserializeObject <List <SafepunishdetailEntity> >(relatedpunishJson);
                        foreach (SafepunishdetailEntity data in list)
                        {
                            safepunishdetailbll.SaveForm("", data);
                        }
                    }
                }
            }

            if (!string.IsNullOrEmpty(keyValue) && entity != null)
            {
                safepunishbll.CommitApply(keyValue, entity);
            }

            return(Success("操作成功。"));
        }
Esempio n. 5
0
        /// <summary>
        /// 保存表单(新增、修改)
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="entity">实体对象</param>
        /// <param name="kpiEntity">考核信息</param>
        /// <returns></returns>
        public void SaveForm(string keyValue, SafepunishEntity entity, SafekpidataEntity kpiEntity)
        {
            entity.ID = keyValue;

            //主要部门与次要部门
            string deptName = "";

            if (kpiEntity != null)
            {
                deptName = GetDeptNames(kpiEntity.KpiUserId, kpiEntity.OnDutyUserId, kpiEntity.PrincipalId);
            }

            if (entity.AmerceType == "2")
            {
                entity.PunishType = "";
            }
            else
            {
                entity.ApplyDeptCode  = "";
                entity.ApplyDeptId    = "";
                entity.ApplyDeptName  = "";
                entity.PunishUserId   = "";
                entity.PunishUserName = "";
                entity.AmerceAmount   = "";
                if (entity.PunishType != "2")
                {
                    kpiEntity.PrincipalName = "";
                    kpiEntity.PrincipalId   = "";
                    kpiEntity.KpiScore10    = "";
                }

                if (entity.PunishType == "2" || entity.PunishType == "4")
                {
                    kpiEntity.KpiUserName = "";
                    kpiEntity.KpiUserId   = "";
                    kpiEntity.WssjScore   = "";
                }
            }
            SafepunishEntity eEntity = GetEntity(keyValue);

            if (eEntity != null)
            {
                entity.Modify(keyValue);
                if (entity.AmerceType == "1")
                {
                    entity.PunishObjectNames = !string.IsNullOrEmpty(entity.PunishDeptName) ? deptName + ',' + entity.PunishDeptName : deptName;
                }
                else if (entity.AmerceType == "2")
                {
                    entity.PunishObjectNames = entity.ApplyDeptName;
                }
                this.BaseRepository().Update(entity);
            }
            else
            {
                entity.Create();
                if (kpiEntity != null)
                {
                    kpiEntity.SafePunishId = entity.ID;
                }
                entity.ApplyState = !string.IsNullOrEmpty(entity.ApplyState)?entity.ApplyState: "0";
                //var userRole = OperatorProvider.Provider.Current().RoleName;
                //if (userRole.Contains("普通用户") || userRole.Contains("班组级用户") || userRole.Contains("专工"))
                //{
                //    entity.ApplyState = "0";
                //}
                //if (userRole.Contains("部门级用户"))
                //{
                //    entity.ApplyState = "1";
                //}

                entity.FlowState         = "0";
                entity.ApproverPeopleIds = "";
                if (entity.AmerceType == "1")
                {
                    entity.PunishObjectNames = !string.IsNullOrEmpty(entity.PunishDeptName) ? deptName + ',' + entity.PunishDeptName : deptName;
                }
                else if (entity.AmerceType == "2")
                {
                    entity.PunishObjectNames = entity.ApplyDeptName;
                }
                entity.ApplyUserDeptId   = OperatorProvider.Provider.Current().DeptId;
                entity.ApplyUserDeptName = OperatorProvider.Provider.Current().DeptName;

                this.BaseRepository().Insert(entity);
            }

            if (entity.AmerceType == "1")
            {
                new SafekpidataService().SaveForm(keyValue, kpiEntity);
            }
        }
Esempio n. 6
0
 public ActionResult SaveForm(string keyValue, SafekpidataEntity entity)
 {
     safekpidatabll.SaveForm(keyValue, entity);
     return(Success("操作成功。"));
 }