Ejemplo n.º 1
0
        //取出GridView数据源中的绑定对象集合
        private ETLSapTableResultCollection getDataByGridView(GridView grid, int sortNo)
        {
            ETLSapTableResultCollection result = new ETLSapTableResultCollection();

            for (int i = 0; i < grid.Rows.Count; i++)
            {
                ETLSapTableResult item = new ETLSapTableResult();
                item.EntityName   = grid.ToolTip;
                item.IsEnable     = ((CheckBox)grid.Rows[i].FindControl("cb_IsEnable")).Checked;
                item.IsPrimaryKey = ((CheckBox)grid.Rows[i].FindControl("cb_IsPrimaryKey")).Checked;
                item.FieldName    = ((Label)grid.Rows[i].FindControl("lbl_FieldName")).Text;
                item.FieldDesc    = ((Label)grid.Rows[i].FindControl("lbl_FieldDesc")).Text;

                FieldTypeEnum fieldType;
                FieldTypeEnum.TryParse(((Label)grid.Rows[i].FindControl("lbl_FieldType")).Text, out fieldType);
                item.FieldType = fieldType;

                item.FieldLength = Convert.ToInt32(((Label)grid.Rows[i].FindControl("lbl_FieldLength")).Text);
                item.IsIndex     = ((CheckBox)grid.Rows[i].FindControl("cb_IsIndex")).Checked;
                if (checkIsCommon.Checked)
                {
                    item.IsKey   = ((CheckBox)grid.Rows[i].FindControl("cb_IsKey")).Checked;
                    item.IsValue = ((CheckBox)grid.Rows[i].FindControl("cb_IsValue")).Checked;
                }

                item.RefTableName = ((HBDropDownList)grid.Rows[i].FindControl("ddl_RefTableName")).SelectedIndex == 0 ? string.Empty : ((HBDropDownList)grid.Rows[i].FindControl("ddl_RefTableName")).SelectedValue;
                item.RefFieldName = ((HBDropDownList)grid.Rows[i].FindControl("ddl_RefFieldName")).SelectedValue.Trim() == "" ? string.Empty : ((HBDropDownList)grid.Rows[i].FindControl("ddl_RefFieldName")).SelectedValue;
                item.SortNo       = sortNo;
                result.Add(item);
            }

            return(result);
        }
Ejemplo n.º 2
0
        //保存实体及映射
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                var dataSource = collectReapterData();

                ETLSapTableResultCollection result = new ETLSapTableResultCollection();

                foreach (var sapFieldDataItem in dataSource)
                {
                    List <ETLSapTableResult> resultCollection = sapFieldDataItem.Collection.Where(p => p.IsEnable).ToList();

                    foreach (ETLSapTableResult etlSapTableResult in resultCollection)
                    {
                        result.Add(etlSapTableResult);
                    }
                }

                result.IsCommon = checkIsCommon.Checked;

                result.UepUsers      = this.hidd_Users.Value;
                result.SAPInstanceId = this.hidSAPInstanceId.Value;
                result.SAPInstanceId.CheckStringIsNullOrEmpty("sapInstanceId");
                ETLDEObjectOperations.Instance.AddETLEntityBySapTable(Request.QueryString["categoryid"], result);

                // HttpContext.Current.Response.Write("<script>alert('添加成功');window.returnValue=true;window.close();</script>");
                //return;
                //Response.End();
                //scriptStr = "<script>alert('添加成功');window.returnValue=true;window.close();</script>";
                WebUtility.ResponseShowClientMessageScriptBlock("添加成功!", "", "添加成功");
                WebUtility.RegisterOnLoadScriptBlock(this, "window.returnValue=true;window.close();");
            }
            catch (Exception ex)
            {
                WebUtility.ResponseShowClientMessageScriptBlock("操作失败!", ex.Message, "操作失败");
            }
        }
Ejemplo n.º 3
0
        public ETLSapTableResultCollection GetDatas(DataTable table)
        {
            ETLSapTableResultCollection resultList = new ETLSapTableResultCollection();

            var parentRows = table.Select();
            int sortNumber = 0;

            foreach (var item in parentRows)
            {
                sortNumber++;
                ETLSapTableResult result = new ETLSapTableResult();
                result.SortNo        = sortNumber;
                result.EntityName    = Convert.ToString(item["实体名"]);
                result.EntityDesc    = Convert.ToString(item["实体描述"]);
                result.DefaultValue  = Convert.ToString(item["默认值"]);
                result.IsMasterTable = Convert.ToString(item["主子标识"]) == "主" ? true : false;
                result.FieldName     = Convert.ToString(item["字段名"]);
                result.IsPrimaryKey  = bool.Parse(Convert.ToString(item["主键"]));
                if (result.IsPrimaryKey)
                {
                    result.IsEnable = true;
                }

                int fileLenth = Convert.ToInt32(item["字段长度"]);

                result.FieldType = SAPFileMapping.SAPFiledTypeToUEPFiledType(Convert.ToString(item["字段类型"]), ref fileLenth);;

                item["字段长度"] = fileLenth;

                result.FieldDesc = Convert.ToString(item["字段描述"]);

                result.FieldLength = int.Parse(Convert.ToString(item["字段长度"]));

                resultList.Add(result);
            }
            return(resultList);
        }