コード例 #1
0
        //保存事件
        protected void btn_save_OnClick(object sender, EventArgs e)
        {
            if (!TimePointContext.Current.UseCurrentTime)
            {
                HttpContext.Current.Response.Write(string.Format("<script>alert('{0}')</script>", "历史数据不能修改"));
                return;
            }
            bindingControl.CollectData();

            ETLEntityMapping mapping   = bindingControl.Data as ETLEntityMapping;
            ETLEntity        etnEntity = DESchemaObjectAdapter.Instance.Load(Request.QueryString["EntityID"]) as ETLEntity;

            mapping.InnerEntity = etnEntity;

            mapping.ETLFieldsMapping.Where(p => p.FieldTypeName.Equals(FieldTypeEnum.Collection.ToString())).ForEach(p =>
            {
                //这里需要验证输入的外部实体定义名称的有效性
            });

            ETLDEObjectOperations.Instance.AddETLEntityMapping(mapping);
            if (mapping.InnerEntity != null)
            {
                mapping.InnerEntity.ClearCacheData();
            }
            //etnEntity

            HttpContext.Current.Response.Write("<script>window.returnValue=true;window.close()</script>");
        }
コード例 #2
0
        /// <summary>
        /// 创建表语句
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            //d472d522-d99d-45b1-a5df-43271a800d3a   4cf34d72-1736-44dc-88cd-e9e9d901621f
            ETLEntity entity = new ETLEntity();

            entity        = (ETLEntity)DESchemaObjectAdapter.Instance.Load(txt_JobID.Text.Trim());
            TextBox1.Text = ETLTools.ETLEntityConvertToSql(entity);
        }
コード例 #3
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            ETLEntity etlEntityResult = DESchemaObjectAdapter.Instance.Load("f505ba56-2a11-45b4-8db2-dc6881204058") as ETLEntity;

            if (etlEntityResult != null)
            {
                List <SAPPara> list = etlEntityResult.GetSAPLoginParamByUepIdAndClient();
                Response.Write(JSONSerializerExecute.Serialize(list));
            }
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string etlID = Convert.ToString(Request["id"]);

            if (string.IsNullOrEmpty(etlID))
            {
                return;
            }

            ETLEntity entity = DESchemaObjectAdapter.Instance.Load(etlID) as ETLEntity;

            OutETLEntityCollection oEntities = entity.OutEtlEntitys;

            repeter.DataSource = oEntities;
            repeter.DataBind();
        }
コード例 #5
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            ETLEntity etlEntity = (ETLEntity)DESchemaObjectAdapter.Instance.Load("624da4a3-ffc2-4379-bddd-3cc4543da1d6");
            var       listSap   = etlEntity.GetSAPLoginParamByUepIdAndClient();
            string    resultStr = " Sap用户名:{0},SapApplicationServer:{1},共取出了{2}个用户";

            if (listSap.Any())
            {
                resultStr = string.Format(resultStr, listSap[0].User, listSap[0].ApplicationServer, listSap.Count);
            }
            else
            {
                resultStr = "未取出任何数据  可能有错误";
            }

            Response.Write(resultStr);
        }
コード例 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!Request.QueryString["Code"].IsNullOrEmpty())
                {
                    //etl实体编码
                    string etlCode = Request.QueryString["Code"].Trim();

                    ETLEntity etlEntity = DESchemaObjectAdapter.Instance.Load(etlCode) as ETLEntity;

                    if (etlEntity != null)
                    {
                        txt_CreateSql.Text = ETLTools.ETLEntityConvertToSql(etlEntity);
                    }
                }
            }
        }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ETLEntityMapping mapping = new ETLEntityMapping();

            if (!TimePointContext.Current.UseCurrentTime)
            {
                this.okButton.Visible       = false;
                txt_OuterEntityName.Enabled = false;
                grid.ReadOnly = true;
            }
            if (!IsPostBack)
            {
                ExceptionHelper.TrueThrow(string.IsNullOrEmpty(Request.QueryString["EntityID"]), "EntityID不能为空");

                ETLEntity innerEntity = DESchemaObjectAdapter.Instance.Load(Request.QueryString["EntityID"].Trim()) as ETLEntity;
                mapping.InnerEntity = innerEntity;

                OuterETLEntity outerEntity = new OuterETLEntity();
                outerEntity.ID = Guid.NewGuid().ToString();

                // mapping.OuterEntityID = outerEntity.ID;

                //外部实体
                if (Request.QueryString["OuterEntityID"].IsNotEmpty())
                {
                    outerEntity = DESchemaObjectAdapter.Instance.Load(Request.QueryString["OuterEntityID"].Trim()) as OuterETLEntity;

                    mapping.OuterEntityID = outerEntity.ID;

                    mapping.OuterEntityName = outerEntity.Name;
                }

                //绑定下拉框
                // this.ddl_InType.BindData(EnumItemDescriptionAttribute.GetDescriptionList(typeof(InType)), "EnumValue", "Description");
            }

            this.bindingControl.Data = mapping;
        }
コード例 #8
0
        /// <summary>
        /// 根据ETL实体的Code获取ETL实体
        /// </summary>
        /// <param name="entityCodes"></param>
        /// <returns></returns>
        public string GetETLEntityNames(string entityCodes)
        {
            string entityNames = string.Empty;

            string[] codes = entityCodes.Split(',');
            foreach (string code in codes)
            {
                if (!string.IsNullOrEmpty(code))
                {
                    ETLEntity entity = null;
                    try
                    {
                        entity       = (ETLEntity)DESchemaObjectAdapter.Instance.Load(code);
                        entityNames += entity.Name + ",";
                    }
                    catch (Exception)
                    {
                        entityNames += "实体已被删除,";
                    }
                }
            }
            return(entityNames.TrimEnd(','));
        }
コード例 #9
0
        /// <summary>
        /// 根据ID获取实体
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        protected ETLEntityCollection GetETLEntities(string ids)
        {
            ETLEntityCollection etls = new ETLEntityCollection();

            if (!string.IsNullOrEmpty(ids))
            {
                string[] propertities = ids.TrimEnd(',').Split(',');
                for (int i = 0; i < propertities.Length; i++)
                {
                    string id = propertities[i];
                    if (!string.IsNullOrEmpty(id))
                    {
                        //根据ID获取ETL实体
                        ETLEntity entity = DESchemaObjectAdapter.Instance.Load(id) as ETLEntity;
                        if (entity != null)
                        {
                            etls.Add(entity);
                        }
                    }
                }
            }
            return(etls);
        }
コード例 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!TimePointContext.Current.UseCurrentTime)
            {
                this.grid.ReadOnly = true;
            }
            //给隐藏域赋值
            Dictionary <string, string> enumValueKey = new Dictionary <string, string>();
            Dictionary <string, string> enumKeyValue = new Dictionary <string, string>();

            Type fileTypes = typeof(FieldTypeEnum);

            foreach (string s in Enum.GetNames(fileTypes))
            {
                FieldTypeEnum myEnum = (FieldTypeEnum)Enum.Parse(typeof(FieldTypeEnum), s);
                enumValueKey.Add(((int)myEnum).ToString(), s);
                enumKeyValue.Add(s, ((int)myEnum).ToString());
            }

            HF_EnumValueKey.Value = JSONSerializerExecute.Serialize(enumValueKey, typeof(object));
            HF_EnumKeyValue.Value = JSONSerializerExecute.Serialize(enumKeyValue, typeof(object));
            if (this.IsPostBack == false && this.IsCallback == false)
            {
                ControllerHelper.ExecuteMethodByRequest(this);
            }

            this.PropertyEditorRegister();

            WebUtility.RequiredScript(typeof(ClientGrid));
            ETLEntity etlEntity = InitETLEntity(Request.QueryString["ID"], Request.QueryString["CategoryID"]);

            this.bindingControl.Data = etlEntity;


            if (!IsPostBack)
            {
                //绑定字段类型
                this.ddl_FieldType.BindData(EnumItemDescriptionAttribute.GetDescriptionList(typeof(FieldTypeEnum)), "Name", "Description");
                this.gridUepUsers.InitialData = etlEntity.sapInstanceParams;
                this.lastUpdateTime.Value     = etlEntity.LastUpdateTime == DateTime.MinValue ? Convert.ToDateTime("1900-01-01 00:00:00") : etlEntity.LastUpdateTime;

                List <DBInfo> dbBaseInfo = new List <DBInfo>();
                //判断数据库登录主键是否存在
                if (etlEntity.TargetConnCode.IsNullOrEmpty())
                {
                    //数据库登录信息显示
                    if (!etlEntity.ServerAddress.IsNullOrEmpty() && !etlEntity.DataBase.IsNullOrEmpty() && !etlEntity.Uid.IsNullOrEmpty())
                    {
                        List <DBInfo> result = DBInfoAdapter.Instance.DBInfoIsExit(etlEntity.Uid, etlEntity.ServerAddress, etlEntity.DataBase);

                        if (result.Count == 0)
                        {
                            var    dbInfo = new DBInfo();
                            string code   = Guid.NewGuid().ToString();
                            //数据库登录信息的主键
                            dbInfo.DBCode = code;
                            //数据库登录账号
                            dbInfo.DBLoginID = etlEntity.Uid;
                            //数据库登录地址
                            dbInfo.DBAddr = etlEntity.ServerAddress;
                            //数据库名称
                            dbInfo.DBName = etlEntity.DataBase;
                            //数据库登录密码
                            dbInfo.DBPassword = etlEntity.Pwd;
                            DBInfoAdapter.Instance.Update(dbInfo);
                        }
                    }

                    //没数据时的显示
                    var showDbinfo = new DBInfo();
                    showDbinfo.DBCode     = "";
                    showDbinfo.DBLoginID  = "";
                    showDbinfo.DBAddr     = "";
                    showDbinfo.DBName     = "";
                    showDbinfo.DBPassword = "";
                    dbBaseInfo.Add(showDbinfo);
                }
                else
                {
                    //绑定登录数据库信息主键
                    HF_TargetConnCode.Value = etlEntity.TargetConnCode;
                    if (DBInfoAdapter.Instance.GetByID(etlEntity.TargetConnCode) != null)
                    {
                        dbBaseInfo.Add(DBInfoAdapter.Instance.GetByID(etlEntity.TargetConnCode));
                    }
                    else
                    {
                        //没数据时的显示
                        var showDbinfo = new DBInfo();
                        showDbinfo.DBCode     = "";
                        showDbinfo.DBLoginID  = "";
                        showDbinfo.DBAddr     = "";
                        showDbinfo.DBName     = "";
                        showDbinfo.DBPassword = "";
                        dbBaseInfo.Add(showDbinfo);
                    }
                }
                this.gridDBInfo.InitialData = dbBaseInfo;

                string etlConStr = string.Empty;
                try
                {
                    etlConStr = etlEntity.ETLConnectionString;
                }
                catch (Exception)
                { }
                //给隐藏域赋值
                string connStr = string.Format("权限中心:{0},该ETL实体的数据库地址:{1}",
                                               DbConnectionManager.GetConnectionString("PermissionsCenter"), etlConStr);

                this.connStrHidd.Value = connStr;
            }
        }
コード例 #11
0
        //保存
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            //取值
            this.bindingControl.CollectData();
            var entity = (ETLEntity)this.bindingControl.Data;

            try
            {
                var error = new StringBuilder();

                //是否历史时间
                if (!Util.CheckOperationSafe())
                {
                    return;
                }

                PropertyValueCollection pvc = JSONSerializerExecute.Deserialize <PropertyValueCollection>(Request.Form.GetValue("properties", string.Empty));
                //取出PropertyForm值
                entity.Properties.FromPropertyValues(pvc);

                string parentCodeName = entity.ParentCodeName;
                //DESchemaObjectAdapter.Instance.Exist(entity.ID, DateTime.Now.SimulateTime());
                try
                {
                    if (!string.IsNullOrEmpty(parentCodeName.Trim()))
                    {
                        ETLEntity parent = ETLEntityAdapter.Instance.LoadWithCache(parentCodeName, DateTime.Now);
                    }
                }
                catch (Exception ee)
                {
                    error.Append(ee.Message);
                }

                //检查重复项
                entity.Fields.GroupBy(p => p.Name).ForEach(p => { if (p.Count() > 1)
                                                                  {
                                                                      error.Append(p.Key + "有重复项!\r\n");
                                                                  }
                                                           });

                bool needCheckExist = false;
                #region
                if (DESchemaObjectAdapter.Instance.Exist(entity.ID, DateTime.Now.SimulateTime()))
                {
                    //更新实体
                    ETLEntity old = DESchemaObjectAdapter.Instance.Load(entity.ID, DateTime.Now.SimulateTime()) as ETLEntity;
                    if (!old.Name.Equals(entity.Name))
                    {
                        needCheckExist = true;
                    }
                }
                else
                {
                    needCheckExist = true;
                }

                if (needCheckExist)
                {
                    //生成CodeName
                    entity.BuidCodeName();

                    if (DEDynamicEntityAdapter.Instance.ExistByCodeName(entity.CodeName, DateTime.Now.SimulateTime()))
                    {
                        error.AppendFormat("已存在名称为[{0}]的实体!\r\n", entity.Name);
                    }
                }
                var sapInstanceParams = this.gridUepUsers.InitialData[0] as SAPInstanceParams;
                if (sapInstanceParams.SAPInstanceId.IsNullOrEmpty())
                {
                    error.AppendFormat("ETL抽数账号不能为空!\r\n", entity.Name);
                }
                (error.Length > 0).TrueThrow(error.ToString());

                // 数据库信息的赋值
                if (this.gridDBInfo.InitialData.Count > 0)
                {
                    DBInfo dbBaseInfo = this.gridDBInfo.InitialData[0] as DBInfo;

                    entity.TargetConnCode = dbBaseInfo.DBCode;

                    //if (entity.TargetConnCode.IsNullOrEmpty())
                    //{
                    //    //this.ClientScript.RegisterClientScriptBlock(this.GetType(), "reloadPage", "alert('请选择数据库登录信息!'); ", true);

                    //    string errorMsg = "请选择数据库登录信息!";

                    //    WebUtility.ShowClientError(errorMsg, errorMsg, "错误");

                    //    return;
                    //}
                }

                entity.SAPInstanceId = sapInstanceParams.SAPInstanceId;
                var sapList = entity.sapInstanceParams;
                #endregion

                //校验数据库连接字符串是否正确
                string msg;
                if (!entity.CheckDBConnString(out msg))
                {
                    entity.TargetConnCode = HF_TargetConnCode.Value;
                    this.ClientScript.RegisterClientScriptBlock(this.GetType(), "reloadPage", "alert('" + msg.Replace("\r\n", "").Replace("'", "") + "'); ", true);
                    InitPropertyForm(entity, false);
                    this.ddl_FieldType.BindData(EnumItemDescriptionAttribute.GetDescriptionList(typeof(FieldTypeEnum)), "Name", "Description");
                    this.okButton.Visible = true;
                }
                else if (error.Length > 0)
                {
                    this.ClientScript.RegisterClientScriptBlock(this.GetType(), "reloadPage", "alert('" + error.ToString().Replace("\r\n", "").Replace("'", "") + "'); ", true);
                    //WebUtility.RegisterClientErrorMessage(error.ToString(), error.ToString(), "失败");
                    InitPropertyForm(entity, false);
                    this.ddl_FieldType.BindData(EnumItemDescriptionAttribute.GetDescriptionList(typeof(FieldTypeEnum)), "Name", "Description");
                    this.okButton.Visible = true;
                }
                else
                {
                    //入库
                    ETLDEObjectOperations.Instance.DoOperation(this.OperationMode, entity, null);
                    entity.ClearCacheData();

                    DateTime last = lastUpdateTime.Value == null ? DateTime.MinValue : lastUpdateTime.Value;
                    ETLPropertiesMappingAdapter.Instance.Update(new ETLEntityPropertiesMapping()
                    {
                        ETLEntityID = entity.ID, LastUpdateTime = last
                    });

                    HttpContext.Current.Response.Write("<script>window.returnValue=true;window.close()</script>");
                }
            }
            catch (Exception ee)
            {
                this.ClientScript.RegisterClientScriptBlock(this.GetType(), "reloadPage", "alert('" + ee.Message.ToString().Replace("\r\n", "").Replace("'", "") + "'); ", true);
                InitPropertyForm(entity, false);
                this.ddl_FieldType.BindData(EnumItemDescriptionAttribute.GetDescriptionList(typeof(FieldTypeEnum)), "Name", "Description");
                this.okButton.Visible = true;
            }
        }