Exemplo n.º 1
0
        public override BaseResult Get(Hashtable param)
        {
            BaseResult res = new BaseResult()
            {
                Success = true
            };

            try
            {
                Td_Fk_1_Query_DetailModel result = new Td_Fk_1_Query_DetailModel();
                var head = DAL.GetItem <Td_Fk_1_QueryModel>(typeof(Td_Fk_1), param);
                if (head != null && !string.IsNullOrEmpty(head.id))
                {
                    result.head = head;
                    param.Clear();
                    param.Add("id_bill", head.id);
                    var body = DAL.QueryList <Td_Fk_2_QueryModel>(typeof(Td_Fk_2), param);
                    result.body = body.ToList();
                    res.Data    = result;
                }
                else
                {
                    res.Success = false;
                    res.Message.Add("未找到此付款单信息!");
                }
            }
            catch (Exception ex)
            {
                res.Success = false;
                res.Message.Add("操作异常!");
            }
            return(res);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 审核
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public BaseResult ActiveWork(Hashtable param)
        {
            #region 参数验证
            BaseResult result = new BaseResult()
            {
                Success = true
            };
            if (param == null || param.Count < 3)
            {
                result.Success = false;
                result.Message.Add("参数有误!");
                return(result);
            }
            var id            = param["id"].ToString();
            var id_masteruser = param["id_masteruser"].ToString();
            var id_user       = param["id_user"].ToString();
            if (string.IsNullOrEmpty(id))
            {
                result.Success = false;
                result.Message.Add("参数有误!");
                return(result);
            }
            if (string.IsNullOrEmpty(id_masteruser) || string.IsNullOrEmpty(id_user))
            {
                result.Success = false;
                result.Message.Add("请登录!");
                return(result);
            }
            #endregion
            #region 更新数据
            Hashtable ht = new Hashtable();
            ht.Add("id", id);
            var brFk = this.Get(ht);
            if (!brFk.Success)
            {
                return(brFk);
            }
            else
            {
                #region 校验商品合法性
                Td_Fk_1_Query_DetailModel dbModel = (Td_Fk_1_Query_DetailModel)brFk.Data;
                if (dbModel == null || dbModel.head == null || string.IsNullOrEmpty(dbModel.head.id) || dbModel.body == null || dbModel.body.Count() <= 0)
                {
                    result.Success = false;
                    result.Message.Add("获取付款单信息不符合要求!");
                    return(result);
                }
                #endregion
                #region 执行存储过程并返回结果
                ht.Clear();
                ht.Add("proname", "p_fk_sh");
                ht.Add("errorid", "-1");
                ht.Add("errormessage", "未知错误!");
                ht.Add("id_bill", dbModel.head.id);
                ht.Add("id_user", id_user);
                DAL.RunProcedure(ht);

                if (!ht.ContainsKey("errorid") || !ht.ContainsKey("errormessage"))
                {
                    result.Success = false;
                    result.Message.Add("执行审核出现异常!");
                    throw new CySoftException(result);
                }

                if (!string.IsNullOrEmpty(ht["errorid"].ToString()) || !string.IsNullOrEmpty(ht["errormessage"].ToString()))
                {
                    result.Success = false;
                    result.Message.Add(ht["errormessage"].ToString());
                    throw new CySoftException(result);
                }

                result.Success = true;
                result.Message.Add("审核成功!");
                return(result);

                #endregion
            }
            #endregion
        }
Exemplo n.º 3
0
        /// <summary>
        ///删除
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public override BaseResult Delete(Hashtable param)
        {
            #region 参数验证
            BaseResult result = new BaseResult()
            {
                Success = true
            };
            if (param == null || param.Count < 2)
            {
                result.Success = false;
                result.Message.Add("参数有误!");
                return(result);
            }
            var id            = param["id"].ToString();
            var id_masteruser = param["id_masteruser"].ToString();
            if (string.IsNullOrEmpty(id))
            {
                result.Success = false;
                result.Message.Add("参数有误!");
                return(result);
            }
            if (string.IsNullOrEmpty(id_masteruser))
            {
                result.Success = false;
                result.Message.Add("请登录!");
                return(result);
            }
            #endregion
            #region 更新数据
            Hashtable ht = new Hashtable();

            ht.Add("id", id);
            var brJh = this.Get(ht);
            if (!brJh.Success)
            {
                return(brJh);
            }
            else
            {
                Td_Fk_1_Query_DetailModel dbModel = (Td_Fk_1_Query_DetailModel)brJh.Data;
                if (dbModel == null || dbModel.head == null || string.IsNullOrEmpty(dbModel.head.id) || dbModel.body == null || dbModel.body.Count() <= 0)
                {
                    result.Success = false;
                    result.Message.Add("获取付款单信息不符合要求!");
                    return(result);
                }

                if (dbModel.head.flag_sh == (byte)Enums.FlagSh.HadSh)
                {
                    result.Success = false;
                    result.Message.Add("该单据已经审核,不允许删除!");
                    return(result);
                }

                ht.Clear();
                ht.Add("id", id);
                ht.Add("id_masteruser", id_masteruser);
                ht.Add("flag_sh", (byte)Enums.FlagSh.UnSh);
                ht.Add("new_flag_delete", (int)Enums.FlagCancel.Canceled);
                try
                {
                    if (DAL.UpdatePart(typeof(Td_Fk_1), ht) <= 0)
                    {
                        result.Success = false;
                        result.Message.Add("删除操作失败!");
                        return(result);
                    }
                }
                catch (Exception ex)
                {
                    result.Success = false;
                    result.Message.Add("删除操作异常!");
                }
                #endregion
                return(result);
            }
        }