Exemplo n.º 1
0
        /// <summary>
        /// 生成实体
        /// </summary>
        /// <param name="ds"></param>
        /// <returns></returns>
        public GEEntity GenerGEEntityByDataSet(DataSet ds)
        {
            // New 它的实例.
            GEEntity en = this.HisGEEn;

            // 它的table.
            DataTable dt = ds.Tables[this.No];

            //装载数据.
            en.Row.LoadDataTable(dt, dt.Rows[0]);

            // dtls.
            MapDtls dtls = this.MapDtls;

            foreach (MapDtl item in dtls)
            {
                DataTable dtDtls = ds.Tables[item.No];
                GEDtls    dtlsEn = new GEDtls(item.No);
                foreach (DataRow dr in dtDtls.Rows)
                {
                    // 产生它的Entity data.
                    GEDtl dtl = (GEDtl)dtlsEn.GetNewEntity;
                    dtl.Row.LoadDataTable(dtDtls, dr);

                    //加入这个集合.
                    dtlsEn.AddEntity(dtl);
                }

                //加入到他的集合里.
                en.Dtls.Add(dtDtls);
            }
            return(en);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 生成单据根据
        /// </summary>
        /// <param name="templeteFile">模板文件</param>
        /// <param name="saveToFile"></param>
        /// <param name="mainDT"></param>
        /// <param name="dtls"></param>
        public void MakeDocByDataSet(string templeteFile, string saveToPath,
                                     string saveToFileName, DataTable mainDT, DataSet dtlsDS)
        {
            string valMain = DBAccess.RunSQLReturnString("SELECT NO FROM SYS_MapData");

            this.HisGEEntity = new GEEntity(valMain);
            this.HisGEEntity.Row.LoadDataTable(mainDT, mainDT.Rows[0]);
            this.AddEn(this.HisGEEntity); //增加一个主表。
            if (dtlsDS != null)
            {
                foreach (DataTable dt in dtlsDS.Tables)
                {
                    string dtlID = DBAccess.RunSQLReturnString("SELECT NO FROM SYS_MapDtl ");
                    GEDtls dtls  = new GEDtls(dtlID);
                    foreach (DataRow dr in dt.Rows)
                    {
                        GEDtl dtl = dtls.GetNewEntity as GEDtl;
                        dtl.Row.LoadDataTable(dt, dr);
                        dtls.AddEntity(dtl);
                    }
                    this.AddDtlEns(dtls); //增加一个明晰。
                }
            }

            this.MakeDoc(templeteFile, saveToPath, saveToFileName, "", false);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 生成单据根据
        /// </summary>
        /// <param name="templeteFile">模板文件</param>
        /// <param name="saveToFile"></param>
        /// <param name="mainDT"></param>
        /// <param name="dtls"></param>
        public void MakeDocByDataSet(string templeteFile, string saveToPath,
                                     string saveToFileName, DataTable mainDT, DataSet dtlsDS)
        {
            this.HisGEEntity = new GEEntity("ND101");
            this.HisGEEntity.Row.LoadDataTable(mainDT, mainDT.Rows[0]);
            this.AddEn(this.HisGEEntity); //增加一个主表。
            if (dtlsDS != null)
            {
                foreach (DataTable dt in dtlsDS.Tables)
                {
                    GEDtls dtls = new GEDtls("ND101Dtl1");
                    foreach (DataRow dr in dt.Rows)
                    {
                        GEDtl dtl = dtls.GetNewEntity as GEDtl;
                        dtl.Row.LoadDataTable(dt, dr);
                        dtls.AddEntity(dtl);
                    }
                    this.AddDtlEns(dtls); //增加一个明晰。
                }
            }

            this.MakeDoc(templeteFile, saveToPath, saveToFileName, "", false);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            #region 载入相关文件.
            this.Page.RegisterClientScriptBlock("sguw",
                                                "<link href='./Style/Frm/Tab.css' rel='stylesheet' type='text/css' />");

            this.Page.RegisterClientScriptBlock("s2g4uh",
                                                "<script language='JavaScript' src='./Style/Frm/jquery.min.js' ></script>");

            this.Page.RegisterClientScriptBlock("sdfuy24j",
                                                "<script language='JavaScript' src='./Style/Frm/jquery.idTabs.min.js' ></script>");
            #endregion 载入相关文件.

            #region 查询出来从表.
            MapDtl      mdtl = new MapDtl(this.EnsName);
            GEDtls      dtls = new GEDtls(this.EnsName);
            QueryObject qo   = null;
            try
            {
                qo = new QueryObject(dtls);
                switch (mdtl.DtlOpenType)
                {
                case DtlOpenType.ForEmp:
                    qo.AddWhere(GEDtlAttr.RefPK, this.RefPKVal);
                    break;

                case DtlOpenType.ForWorkID:
                    qo.AddWhere(GEDtlAttr.RefPK, this.RefPKVal);
                    break;

                case DtlOpenType.ForFID:
                    qo.AddWhere(GEDtlAttr.FID, this.RefPKVal);
                    break;
                }
                qo.DoQuery();
            }
            catch (Exception ex)
            {
                dtls.GetNewEntity.CheckPhysicsTable();
                throw ex;

                //#region 解决Access 不刷新的问题。
                //string rowUrl = this.Request.RawUrl;
                //if (rowUrl.IndexOf("rowUrl") > 1)
                //{
                //    throw ex;
                //}
                //else
                //{
                //    //this.Response.Redirect(rowUrl + "&rowUrl=1&IsWap=" + this.IsWap, true);
                //    return;
                //}
                //#endregion
            }
            #endregion 查询出来从表.

            #region 初始化空白行
            if (this.IsReadonly == false)
            {
                mdtl.RowsOfList = mdtl.RowsOfList + this.addRowNum;
                int num = dtls.Count;
                if (mdtl.IsInsert)
                {
                    int dtlCount = dtls.Count;
                    for (int i = 0; i < mdtl.RowsOfList - dtlCount; i++)
                    {
                        BP.Sys.GEDtl dt = new GEDtl(this.EnsName);
                        dt.ResetDefaultVal();
                        dt.OID = i;
                        dtls.AddEntity(dt);
                    }

                    if (num == mdtl.RowsOfList)
                    {
                        BP.Sys.GEDtl dt1 = new GEDtl(this.EnsName);
                        dt1.ResetDefaultVal();
                        dt1.OID = mdtl.RowsOfList + 1;
                        dtls.AddEntity(dt1);
                    }
                }
            }
            #endregion 初始化空白行

            MapData md = new MapData(mdtl.No);
            this.UCEn1.Clear();

            this.UCEn1.Add("\t\n<div class=\"easyui-tabs\" fit=\"true\" border=\"false\" style='width:" + md.FrmW + "px;height:" + md.FrmH + "px;' data-options=\"tools:'#tab-tools'\">");  //begain.

            #region 输出标签.
            int idx     = 0;
            int dtlsNum = dtls.Count;

            foreach (GEDtl dtl in dtls)
            {
                idx++;
                this.UCEn1.Add("\t\n<div id=" + idx + " title='第" + idx + "条' style='overflow: auto;'>");
                string src = "";
                src = "FrmDtl.aspx?FK_MapData=" + this.EnsName + "&WorkID=" + this.RefPKVal + "&OID=" + dtl.OID + "&IsReadonly=" + this.IsReadonly;
                this.UCEn1.Add("\t\n<iframe id='IF" + idx + "' Onblur=\"SaveDtlData('" + idx + "');\" frameborder='0' style='width:" + md.FrmW + "px;height:" + md.FrmH + "px;' src=\"" + src + "\"></iframe>");
                this.UCEn1.Add("\t\n</div>");
            }
            this.UCEn1.Add("\t\n </div>");
            if (this.IsReadonly == false && mdtl.IsInsert)
            {
                int addNum = addRowNum + 1;
                int cutNum = addRowNum - 1;

                this.UCEn1.Add("\t\n<div id=\"tab-tools\">");
                if (cutNum >= 0)
                {
                    this.UCEn1.Add("\t\n<a href='DtlCard.aspx?EnsName=" + this.EnsName + "&RefPKVal=" + this.RefPKVal + "&addRowNum=" + cutNum + "' class=\"easyui-linkbutton\" data-options=\"plain:true,iconCls:'icon-reload'\">移除</a>");
                    this.UCEn1.Add("\t\n<a href='DtlCard.aspx?EnsName=" + this.EnsName + "&RefPKVal=" + this.RefPKVal + "&addRowNum=" + addNum + "' class=\"easyui-linkbutton\" data-options=\"plain:true,iconCls:'icon-reload'\">插入</a>");
                }
                else
                {
                    this.UCEn1.Add("\t\n<a href='DtlCard.aspx?EnsName=" + this.EnsName + "&RefPKVal=" + this.RefPKVal + "&addRowNum=" + addNum + "' >插入</a>");
                }
                this.UCEn1.Add("\t\n</div>");
            }
            #endregion 输出标签.


            if (this.IsReadonly == false)
            {
            }

            #region 处理iFrom SaveDtlData。
            //string js = "";
            //js = "\t\n<script type='text/javascript' >";
            //js += "\t\n function SaveDtl(dtl) { ";
            //js += "\t\n document.getElementById('F' + dtl ).contentWindow.SaveDtlData();";
            //js += "\t\n } ";
            //js += "\t\n</script>";
            //this.UCEn1.Add(js);
            #endregion 处理iFrom SaveDtlData。
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region 载入相关文件.
            this.Page.RegisterClientScriptBlock("sgu",
                                                "<link href='./Style/Frm/Tab.css' rel='stylesheet' type='text/css' />");

            this.Page.RegisterClientScriptBlock("s2g4uh",
                                                "<script language='JavaScript' src='./Style/Frm/jquery.min.js' ></script>");

            this.Page.RegisterClientScriptBlock("sdfuy24j",
                                                "<script language='JavaScript' src='./Style/Frm/jquery.idTabs.min.js' ></script>");
            #endregion 载入相关文件.

            #region 查询出来从表.
            MapDtl      mdtl = new MapDtl(this.EnsName);
            GEDtls      dtls = new GEDtls(this.EnsName);
            QueryObject qo   = null;
            try
            {
                qo = new QueryObject(dtls);
                switch (mdtl.DtlOpenType)
                {
                case DtlOpenType.ForEmp:
                    qo.AddWhere(GEDtlAttr.RefPK, this.RefPKVal);
                    break;

                case DtlOpenType.ForWorkID:
                    qo.AddWhere(GEDtlAttr.RefPK, this.RefPKVal);
                    break;

                case DtlOpenType.ForFID:
                    qo.AddWhere(GEDtlAttr.FID, this.RefPKVal);
                    break;
                }
                qo.DoQuery();
            }
            catch (Exception ex)
            {
                dtls.GetNewEntity.CheckPhysicsTable();
                throw ex;

                //#region 解决Access 不刷新的问题。
                //string rowUrl = this.Request.RawUrl;
                //if (rowUrl.IndexOf("rowUrl") > 1)
                //{
                //    throw ex;
                //}
                //else
                //{
                //    //this.Response.Redirect(rowUrl + "&rowUrl=1&IsWap=" + this.IsWap, true);
                //    return;
                //}
                //#endregion
            }
            #endregion 查询出来从表.

            #region 初始化空白行
            if (this.IsReadonly == false)
            {
                mdtl.RowsOfList = mdtl.RowsOfList + this.addRowNum;
                int num = dtls.Count;
                if (mdtl.IsInsert)
                {
                    int dtlCount = dtls.Count;
                    for (int i = 0; i < mdtl.RowsOfList - dtlCount; i++)
                    {
                        BP.Sys.GEDtl dt = new GEDtl(this.EnsName);
                        dt.ResetDefaultVal();
                        dt.OID = i;
                        dtls.AddEntity(dt);
                    }

                    if (num == mdtl.RowsOfList)
                    {
                        BP.Sys.GEDtl dt1 = new GEDtl(this.EnsName);
                        dt1.ResetDefaultVal();
                        dt1.OID = mdtl.RowsOfList + 1;
                        dtls.AddEntity(dt1);
                    }
                }
            }
            #endregion 初始化空白行

            this.UCEn1.Clear();
            this.UCEn1.Add("<div  style='clear:both' ></div>");
            this.UCEn1.Add("\t\n<div  id='usual2' class='usual'>");  //begain.

            #region 输出标签.
            this.UCEn1.Add("\t\n <ul  style='background:red;border-color: #800000;border-width: 10px;' >");
            int idx     = 0;
            int dtlsNum = dtls.Count;
            foreach (GEDtl dtl in dtls)
            {
                idx++;
                this.UCEn1.Add("\t\n<li><a href=\"#" + dtl.OID + "\">第" + idx + "条</a></li>");
            }
            if (this.IsReadonly == false && mdtl.IsInsert)
            {
                int addNum = addRowNum + 1;
                int cutNum = addRowNum - 1;

                if (cutNum >= 0)
                {
                    this.UCEn1.Add("\t\n<li><a href='DtlCard.aspx?EnsName=" + this.EnsName + "&RefPKVal=" + this.RefPKVal + "&addRowNum=" + cutNum + "' >移除</a>|<a href='DtlCard.aspx?EnsName=" + this.EnsName + "&RefPKVal=" + this.RefPKVal + "&addRowNum=" + addNum + "' >插入</a></li>");
                }
                else
                {
                    this.UCEn1.Add("\t\n<li><a href='DtlCard.aspx?EnsName=" + this.EnsName + "&RefPKVal=" + this.RefPKVal + "&addRowNum=" + addNum + "' >插入</a></li>");
                }
            }
            this.UCEn1.Add("\t\n </ul>");
            #endregion 输出标签.

            #region 输出从表单内容.
            MapData md = new MapData(mdtl.No);
            foreach (GEDtl dtl in dtls)
            {
                this.UCEn1.Add("\t\n <DIV id='" + dtl.OID + "' style='width:" + md.FrmW + "px; height:" + md.FrmH + "px;text-align: left;' >");

                string src = "";
                src = "FrmDtl.aspx?FK_MapData=" + this.EnsName + "&WorkID=" + this.RefPKVal + "&OID=" + dtl.OID + "&IsReadonly=" + this.IsReadonly;

                this.UCEn1.Add("\t\n <iframe ID='F" + dtl.OID + "' src='" + src + "' frameborder=0  style='position:absolute;width:" + md.FrmW + "px; height:" + md.FrmH + "px;text-align: left;'  leftMargin='0'  topMargin='0' scrolling=no /></iframe>");
                this.UCEn1.Add("\t\n </DIV>");
            }
            #endregion 输出从表单内容.

            this.UCEn1.Add("\t\n</div>"); // end  usual2
            this.UCEn1.Add("\t\n<script type='text/javascript'>");

            if (dtls.Count >= 1)
            {
                this.UCEn1.Add("\t\n  $(\"#usual2 ul\").idTabs(\"" + dtls[0].GetValStrByKey("OID") + "\");");
            }

            this.UCEn1.Add("\t\n</script>");

            if (this.IsReadonly == false)
            {
            }

            #region 处理iFrom SaveDtlData。
            //string js = "";
            //js = "\t\n<script type='text/javascript' >";
            //js += "\t\n function SaveDtl(dtl) { ";
            //js += "\t\n document.getElementById('F' + dtl ).contentWindow.SaveDtlData();";
            //js += "\t\n } ";
            //js += "\t\n</script>";
            //this.UCEn1.Add(js);
            #endregion 处理iFrom SaveDtlData。
        }