/// <summary>
        /// 增、改K_RecyclingAssociated表

        /// </summary>
        /// <param name="tranType">操作类型,NEW=增,EDIT=改</param>
        /// <param name="paramsModel"></param>
        /// <returns>返回大于0的数字操作正常,返回非数字表示操作错误,返回的是系统错误说明</returns>
        public string Save(string tranType, KingTop.Model.Content.RecyclingAssociated paramsModel)
        {
            string isOk = "";

            try
            {
                SqlParameter returnValue = new SqlParameter("@ReturnValue", SqlDbType.Int, 4);
                returnValue.Direction = ParameterDirection.Output;

                string cmdText = "proc_K_RecyclingAssociatedSave";

                SqlParameter[] paras = new SqlParameter[] {
                    new SqlParameter("tranType", tranType),
                    new SqlParameter("ID", paramsModel.ID),
                    new SqlParameter("RecyclingManageID", paramsModel.RecyclingManageID),
                    new SqlParameter("AssociatedID", paramsModel.AssociatedID),
                    new SqlParameter("AssociatedKey", paramsModel.AssociatedKey),
                    new SqlParameter("AssociatedWhere", paramsModel.AssociatedWhere),
                    new SqlParameter("KeyIsWhere", paramsModel.KeyIsWhere),
                    new SqlParameter("AddMan", paramsModel.AddMan),
                    returnValue
                };

                SQLHelper.ExecuteNonQuery(SQLHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, cmdText, paras);
                isOk = returnValue.Value.ToString();
            }
            catch (Exception ex)
            {
                isOk = ex.Message;
            }

            return(isOk);
        }
예제 #2
0
        /// <summary>
        /// 添加/修改数据
        /// </summary>
        /// <param Name="sender"></param>
        /// <param Name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strOperateName = "Add";

            modelRecyclingAssociated = new KingTop.Model.Content.RecyclingAssociated();
            ModelSaveOrUpdate();
            if (Action == "NEW") //如果当前操作为新增,则运算出id的值

            {
                // 权限验证,是否具有修改权限

                if (!IsHaveRightByOperCode("New"))
                {
                    Utils.RunJavaScript(this, "alert({msg:'你没有添加操作的权限,请联系站点管理员!',title:'提示信息'})");
                    return;
                }
            }
            else  //否则直接绑定当前id
            {
                // 权限验证,是否具有修改权限

                if (!IsHaveRightByOperCode("Edit"))
                {
                    Utils.RunJavaScript(this, "alert({msg:'你没有修改操作的权限,请联系站点管理员!',title:'提示信息'})");
                    return;
                }
                strOperateName = "Update";
                modelRecyclingAssociated.ID = Utils.ParseInt(ID, 0);
            }

            //用户添加/修改操作
            string strMessage = bllRecyclingAssociated.Save(Action, modelRecyclingAssociated);

            if (strMessage == "1") //操作成功
            {
                Utils.UrlRedirect(this, "RecyclingAssociatedList.aspx" + StrPageParams, Utils.GetResourcesValue("model", "AddSucess"));
            }
            else
            {
                Utils.AlertJavaScript(this, Utils.GetResourcesValue("model", "AddError"));
            }
            WriteLogExpand(ddlRecyclingManageID.SelectedItem.Text, hidLogTitle.Value, strOperateName, "RecyclingAssociated", strMessage); //写日志
        }
        /// <summary>
        /// 增、改K_RecyclingAssociated表

        /// </summary>
        /// <param name="tranType">操作类型,NEW=增,EDIT=改</param>
        /// <param name="RecModel"></param>
        /// <returns>返回大于0的数字操作正常,返回非数字表示操作错误,返回的是系统错误说明</returns>
        public string Save(string trantype, KingTop.Model.Content.RecyclingAssociated recModel)
        {
            return(dal.Save(trantype, recModel));
        }