private List<SystemParameterEntity> GetDataSource()
 {
     KPI_SystemDal DataAccess = new KPI_SystemDal();
     List<SystemParameterEntity> List = new List<SystemParameterEntity>();
     SystemParameterEntity SystemParameter,Param;
     List<KPI_UnitEntity> UnitList = KPI_UnitDal.GetAllEntity();
     foreach (KPI_UnitEntity Unit in UnitList) {
         SystemParameter = DataAccess.GetSystemParameter(Unit.UnitID);
         if (SystemParameter == null) {
             SystemParameter = new SystemParameterEntity();
             SystemParameter.SysName = Unit.UnitID;
             SystemParameter.SysDesc = Unit.UnitName + "奖金金额";
         }
         SystemParameter.SysCode = Unit.UnitCode;
         Param = DataAccess.GetSystemParameter(Unit.UnitCode);
         if (Param != null) SystemParameter.SysValue2 = Param.SysValue;
         //SystemParameter.SysValue2 = DataAccess.GetSystemParameter(Unit.UnitCode).SysValue;
         List.Add(SystemParameter);
     }
     return List;
 }
        protected void btnSave_Click(Object sender, EventArgs e)
        {
            Literal lblSysName, lblSysDesc, lblSysCode;
            TextBox txtSysValue, txtSysNote, txtSysValue2;
            KPI_SystemDal DataAccess = new KPI_SystemDal();
            SystemParameterEntity SystemParameter;
            RepeaterItemCollection Items = Repeater1.Items;
            foreach (RepeaterItem Item in Items) {
                lblSysName = (Literal)Item.FindControl("lblSysName");
                lblSysDesc = (Literal)Item.FindControl("lblSysDesc");
                lblSysCode = (Literal)Item.FindControl("lblSysCode");
                txtSysValue = (TextBox)Item.FindControl("txtSysValue");
                txtSysValue2 = (TextBox)Item.FindControl("txtSysValue2");
                txtSysNote = (TextBox)Item.FindControl("txtSysNote");
                SystemParameter = new SystemParameterEntity();
                SystemParameter.SysEngunit = "元";
                SystemParameter.SysIsValid = 1;
                SystemParameter.SysID = DateTime.Now.Ticks + "";
                SystemParameter.SysName = lblSysName.Text;
                SystemParameter.SysDesc = lblSysDesc.Text;
                SystemParameter.SysValue = txtSysValue.Text;
                SystemParameter.SysNote = txtSysNote.Text;
                DataAccess.SaveSystemParameter(SystemParameter);

                SystemParameter = new SystemParameterEntity();
                SystemParameter.SysEngunit = "";
                SystemParameter.SysIsValid = 1;
                SystemParameter.SysID = lblSysName.Text;
                SystemParameter.SysName = lblSysCode.Text;
                SystemParameter.SysDesc = "奖励名次";
                SystemParameter.SysValue = txtSysValue2.Text;
                SystemParameter.SysNote = "奖励名次";
                DataAccess.SaveSystemParameter(SystemParameter);
            }
            ShowMessage("数据保存成功!");
        }
Beispiel #3
0
 /// <summary>
 /// 更新系统参数
 /// </summary>
 /// <param name="SystemPara">系统参数实体</param>        
 /// <returns>更新的数据行数</returns>
 private int UpdateSystemParameter(SystemParameterEntity SystemPara)
 {
     int Result = 0;
     string SqlText = @"Update KPI_System Set SysDesc=@SysDesc,SysEngunit=@SysEngunit,SysIsValid=@SysIsValid,
                         SysValue=@SysValue,SysNote=@SysNote  Where SysName = @SysName";
     IDbDataParameter[] parames = new SqlParameter[] {
         new SqlParameter("@SysID",DbType.String),
         new SqlParameter("@SysName",DbType.String),
         new SqlParameter("@SysDesc",DbType.String),
         new SqlParameter("@SysEngunit",DbType.String),
         new SqlParameter("@SysIsValid",DbType.Int32),
         new SqlParameter("@SysValue",DbType.String),
         new SqlParameter("@SysNote",DbType.String)};
     parames[0].Value = SystemPara.SysID;
     parames[1].Value = SystemPara.SysName;
     parames[2].Value = SystemPara.SysDesc;
     parames[3].Value = SystemPara.SysEngunit;
     parames[4].Value = SystemPara.SysIsValid;
     parames[5].Value = SystemPara.SysValue;
     parames[6].Value = SystemPara.SysNote;
     Result = DBAccess.GetRelation().ExecuteNonQuery(SqlText, parames);
     return Result;
 }
Beispiel #4
0
 /// <summary>
 /// 判断数据是否存在
 /// </summary>
 /// <param name="KPI_System">实体</param>        
 /// <returns>数据存在则返回true否则返回false</returns>
 private bool Exists(SystemParameterEntity SystemPara)
 {
     bool Result = false;
     string SqlText = "SELECT SysName FROM  KPI_System WHERE SysName=@SysName ";
     IDbDataParameter SysNameParam = new SqlParameter("@SysName", SystemPara.SysName);
     Result = DBAccess.GetRelation().ExecuteScalar(SqlText, SysNameParam) != null;
     return Result;
 }
Beispiel #5
0
 /// <summary>
 /// 保存系统参数信息
 /// </summary>
 /// <param name="SystemPara"></param>
 /// <returns></returns>
 public int SaveSystemParameter(SystemParameterEntity SystemPara)
 {
     if (String.IsNullOrWhiteSpace(SystemPara.SysValue)) SystemPara.SysValue = "0.0";
     if (Exists(SystemPara))
         return UpdateSystemParameter(SystemPara);
     else
         return AddSystemParameter(SystemPara);
 }