/// <summary>
 /// 导出页面当前页数据
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnOutputCurrentPage_Click(object sender, EventArgs e)
 {
     List<Med_Model.HelpStandard> listHelpStandard = new List<Med_Model.HelpStandard>();
     Med_Model.HelpStandard helpStandard = new Med_Model.HelpStandard();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         helpStandard = BLL_HelpStandard.SelectHelpStandardById(id);
         listHelpStandard.Add(helpStandard);
         helpStandard = null;
     }
     NPOIHelper.DataTable3Excel(listHelpStandard.ToADOTable(), "当前页救助标准信息", GetExportColumn());
 }
        private bool AdminHelpStandard(string type)
        {
            var helpStandard = new HelpStandard();
            CheckTheData(ref helpStandard, type); //检查数据合法性
            if (type == "add")
            {
                //如果添加民政救助标准成功 同时成功记录操作日志的话 返回true
                return (BLL_HelpStandard.AddHelpStandard(helpStandard) > 0) && (AddSysLog(CommonEnum.ActionType.Add.ToString(), "添加民政救助标准") ? true : false);
            }
            if (type == "edit")
            {
                //如果更新民政救助标准成功,同时添加日志成功 返回true 否则返回false  更改密码后 下一次登录有效
                return (BLL_HelpStandard.UpdateHelpStandard(helpStandard)) && (AddSysLog(CommonEnum.ActionType.Update.ToString(), "修改民政救助标准") ? true : false);

            }
            return false; //目前只有添加 修改两种操作,以后可能扩展
        }
示例#3
0
        /// <summary>
        /// 添加救助标准
        /// </summary>
        /// <param name="helpStandard">救助标准实体 model</param>
        /// <returns>
        /// 成功返回刚刚插入数据库的救助标准编号
        /// 失败 返回0
        /// </returns>
        public int AddHelpStandard(HelpStandard helpStandard)
        {
            int result = 0;
            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append(" insert into T_Med_HelpStandard (");
                strSql.Append(" HelpTypeId,HelpNums,HelpScale,HelpMax,ClinicMoney,DrugMoney,HelpDetails)");
                strSql.Append(" values(");
                strSql.Append(" @HelpTypeId,@HelpNums,@HelpScale,@HelpMax,@ClinicMoney,@DrugMoney,@HelpDetails)");
                strSql.Append(" ;select @@IDENTITY");

                SqlParameter[] parameters = {
                    new SqlParameter("@HelpTypeId", SqlDbType.Int),
                    new SqlParameter("@HelpNums", SqlDbType.Int),
                    new SqlParameter("@HelpScale", SqlDbType.Float),
                    new SqlParameter("@HelpMax", SqlDbType.Decimal),
                    new SqlParameter("@ClinicMoney", SqlDbType.Decimal),
                    new SqlParameter("@DrugMoney", SqlDbType.Decimal),
                    new SqlParameter("@HelpDetails", SqlDbType.NVarChar,50)
                };
                parameters[0].Value = helpStandard.HelpTypeId;
                parameters[1].Value = helpStandard.HelpNums;
                parameters[2].Value = helpStandard.HelpScale;
                parameters[3].Value = helpStandard.HelpMax;
                parameters[4].Value = helpStandard.ClinicMoney;
                parameters[5].Value = helpStandard.DrugMoney;
                parameters[6].Value = helpStandard.HelpDetails;

                object obj = SqlHelper.ExecuteScalar(SqlHelper.connString, CommandType.Text, strSql.ToString(), parameters);
                if (obj != null)
                {
                    result = Convert.ToInt32(obj);
                }
            }
            catch (Exception e)
            {
                Log4Net.LogWrite("err", "Med_DAL:DAL_HelpStandard//AddHelpStandard" + e.Message);  //发生异常,记录
            }
            return result;
        }
示例#4
0
        /// <summary>
        /// 更新救助标准信息
        /// </summary>
        /// <param name="helpStandard"></param>
        /// <returns>
        /// 成功:true
        /// 失败:false
        /// </returns>
        public bool UpdateHelpStandard(HelpStandard helpStandard)
        {
            bool result = false;
            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append(" update T_Med_HelpStandard set ");
                strSql.Append(" HelpTypeId=@HelpTypeId, ");
                strSql.Append(" HelpNums=@HelpNums, ");
                strSql.Append(" HelpScale=@HelpScale, ");
                strSql.Append(" HelpMax=@HelpMax,");
                strSql.Append(" ClinicMoney=@ClinicMoney, ");
                strSql.Append(" DrugMoney=@DrugMoney, ");
                strSql.Append(" HelpDetails=@HelpDetails ");
                strSql.Append(" where Id=@Id ");
                SqlParameter[] parameters = {
                    new SqlParameter("@HelpTypeId", SqlDbType.Int),
                    new SqlParameter("@HelpNums", SqlDbType.Int),
                    new SqlParameter("@HelpScale", SqlDbType.Float),
                    new SqlParameter("@HelpMax", SqlDbType.Decimal),
                    new SqlParameter("@ClinicMoney", SqlDbType.Decimal),
                    new SqlParameter("@DrugMoney", SqlDbType.Decimal),
                    new SqlParameter("@HelpDetails", SqlDbType.NVarChar,50),
                    new SqlParameter("@Id", SqlDbType.Int)
                };
                parameters[0].Value = helpStandard.HelpTypeId;
                parameters[1].Value = helpStandard.HelpNums;
                parameters[2].Value = helpStandard.HelpScale;
                parameters[3].Value = helpStandard.HelpMax;
                parameters[4].Value = helpStandard.ClinicMoney;
                parameters[5].Value = helpStandard.DrugMoney;
                parameters[6].Value = helpStandard.HelpDetails;
                parameters[7].Value = helpStandard.Id;

                if (SqlHelper.ExecuteNonQuery(SqlHelper.connString, CommandType.Text, strSql.ToString(), parameters) > 0) //更改成功 影响条数为1
                {
                    result = true;  //更新成功设置为true
                }
            }
            catch (Exception e)
            {
                Log4Net.LogWrite("err", "Med_DAL:DAL_HelpStandard//UpdateHelpStandard" + e.Message);  //发生异常,记录
            }
            return result;
        }
示例#5
0
        /// <summary>
        /// 根据救助标类型准编号得到相应救助标准信息
        /// </summary>
        /// <returns></returns>
        public HelpStandard SelectHelpStandardById(int helpTypeId)
        {
            HelpStandard helpStandard = new HelpStandard();
            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append(" select top 1 Id,HelpTypeId,HelpNums,HelpScale,HelpMax,ClinicMoney,DrugMoney,HelpDetails from T_Med_HelpStandard");
                strSql.Append(" where HelpTypeId=@helpTypeId");

                SqlParameter[] parameters = {
                    new SqlParameter("@helpTypeId", SqlDbType.Int)};
                parameters[0].Value = helpTypeId;

                helpStandard = SqlHelper.ExecuteDataset(SqlHelper.connString, CommandType.Text, strSql.ToString(), parameters).Tables[0].ToList<HelpStandard>()[0];//当前List<> 中只有一条记录,用这种方式得到
            }
            catch (Exception e)
            {
                Log4Net.LogWrite("err", "Med_DAL:DAL_HelpStandard//SelectHelpStandardById" + e.Message);  //发生异常,记录
            }
            return helpStandard;
        }
示例#6
0
 /// <summary>
 /// 添加救助标准
 /// </summary>
 /// <param name="helpStandard">救助标准实体 model</param>
 /// <returns>
 /// 成功返回刚刚插入数据库的救助标准编号
 /// 失败 返回0
 /// </returns>
 public static int AddHelpStandard(HelpStandard helpStandard)
 {
     return DalHelpStandard.AddHelpStandard(helpStandard);
 }
示例#7
0
 /// <summary>
 /// 更新救助标准信息
 /// </summary>
 /// <param name="helpStandard"></param>
 /// <returns>
 /// 成功:true
 /// 失败:false
 /// </returns>
 public static bool UpdateHelpStandard(HelpStandard helpStandard)
 {
     return DalHelpStandard.UpdateHelpStandard(helpStandard);
 }