コード例 #1
0
ファイル: ConstructDAO.cs プロジェクト: ishui/rms2
        public static EntityData GetDefaultRiskIndex()
        {
            EntityData data2;

            try
            {
                RiskIndexStrategyBuilder builder = new RiskIndexStrategyBuilder();
                builder.AddStrategy(new Strategy(RiskIndexStrategyName.IsDefault, "1"));
                string     queryString = builder.BuildMainQueryString();
                QueryAgent agent       = new QueryAgent();
                EntityData data        = agent.FillEntityData("RiskIndex", queryString);
                agent.Dispose();
                data2 = data;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
コード例 #2
0
ファイル: ConstructDAO.cs プロジェクト: ishui/rms2
        public static EntityData GetAllRiskIndex()
        {
            EntityData data2;

            try
            {
                RiskIndexStrategyBuilder builder = new RiskIndexStrategyBuilder();
                builder.AddOrder("IndexLevel", true);
                string     queryString = builder.BuildMainQueryString();
                QueryAgent agent       = new QueryAgent();
                EntityData data        = agent.FillEntityData("RiskIndex", queryString);
                agent.Dispose();
                data2 = data;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
コード例 #3
0
        private void LoadData()
        {
            try
            {
                RiskIndexStrategyBuilder sb = new RiskIndexStrategyBuilder();

                sb.AddOrder("IndexLevel", true);

                string sql = sb.BuildMainQueryString();

                QueryAgent qa     = new QueryAgent();
                EntityData entity = qa.FillEntityData("RiskIndex", sql);
                qa.Dispose();

                dgList.DataSource = entity;
                dgList.DataBind();
                entity.Dispose();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(Rms.Web.JavaScript.Alert(true, "初始化页面出错:" + ex.Message));
            }
        }
コード例 #4
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="code"></param>
        /// <param name="parentCode"></param>
        private void SavaData()
        {
            try
            {
                string IndexCode = this.txtIndexCode.Value;

                EntityData entity = DAL.EntityDAO.ConstructDAO.GetRiskIndexByCode(IndexCode);
                DataRow    dr;
                bool       isNew = !entity.HasRecord();


                if (isNew)
                {
                    dr = entity.GetNewRecord();

                    IndexCode = SystemManageDAO.GetNewSysCode("RiskIndexCode");
                    this.txtIndexCode.Value = IndexCode;
                    dr["IndexCode"]         = IndexCode;
                    entity.CurrentTable.Rows.Add(dr);
                }
                else
                {
                    dr = entity.CurrentRow;
                }

                dr["IndexName"]  = this.txtIndexName.Value;
                dr["IndexLevel"] = BLL.ConvertRule.ToInt(this.txtIndexLevel.Value);

                if (this.chkIsDefault.Checked)
                {
                    dr["IsDefault"] = 1;
                }
                else
                {
                    dr["IsDefault"] = 0;
                }

                DAL.EntityDAO.ConstructDAO.SubmitAllRiskIndex(entity);
                entity.Dispose();

                //更新其它记录的默认值
                if (this.chkIsDefault.Checked)
                {
                    RiskIndexStrategyBuilder sb = new RiskIndexStrategyBuilder();

                    sb.AddStrategy(new Strategy(RiskIndexStrategyName.IsDefault, "1"));
                    sb.AddStrategy(new Strategy(RiskIndexStrategyName.ExceptIndexCode, IndexCode));

                    string sql = sb.BuildMainQueryString();

                    QueryAgent qa = new QueryAgent();
                    entity = qa.FillEntityData("RiskIndex", sql);
                    qa.Dispose();

                    if (entity.HasRecord())
                    {
                        foreach (DataRow drTemp in entity.CurrentTable.Rows)
                        {
                            drTemp["IsDefault"] = 0;
                        }

                        DAL.EntityDAO.ConstructDAO.SubmitAllRiskIndex(entity);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }