Esempio n. 1
0
        /// <summary>
        /// 根据审核列表创建控件,设置样式,并添加至table
        /// </summary>
        /// <param name="objApprovalList">审核列表</param>
        public void CreateApprovalList(ObjApprovalList[] objApprovalList)
        {
            foreach (ObjApprovalList oaList in objApprovalList)
            {
                HtmlTable tb = CreateTable(0, 0, 0, "100%", null, null);

                if (null != objApprovalList && objApprovalList.Length > 0)
                {

                    foreach (ObjApprovalList objApproval in objApprovalList)
                    {
                        {//创建显示头部
                            if (null != objApproval.ApprovalList && objApproval.ApprovalList.Length > 0)
                            {
                                HtmlTableRow tr1 = CreateTop(oaList.Text);
                                tr1.Cells[0].ID = "tdApproveTitle";
                                //tr1.Cells[0].Attributes.Add("style", "display:none");
                                TableCtrl.Controls.Add(tr1);
                            }
                            else
                            {
                                HtmlTableRow tr1 = CreateTop(oaList.Text);
                                tr1.Cells[0].ID = "tdApproveTitle";
                                tr1.Cells[0].Attributes.Add("style", "display:none");
                                TableCtrl.Controls.Add(tr1);
                            }

                        }

                        foreach (ObjApproval obj in objApproval.ApprovalList)
                        {
                            string Approver = obj.Approver;
                            string ApprovalRemark = obj.ApprovalRemark;
                            //DK:日期统一格式
                            string ApprovalTime = obj.ApprovalTime.ToString("yyyy-MM-dd HH:mm");
                            string ApprovalState = obj.ApprovalState;
                            string flag = obj.Flag;
                            HtmlTableRow tr1 = new HtmlTableRow();

                            HtmlTableCell td1 = CreateTD(1, null, null, "billAuditPerson");
                            if (flag == "0")
                            {
                                td1.InnerText = "提单人";
                            }
                            else
                            {
                                td1.InnerText = "审核人";
                            }


                            HtmlTableCell td2 = CreateTD(1, "2%", null, null);

                            HtmlTableCell td3 = CreateTD(1, null, null, "billAuditName");
                            td3.InnerText = Approver;

                            HtmlTableCell td4 = CreateTD(1, null, null, "billAuditTime");
                            td4.InnerText = ApprovalTime;
                            td4.Width = "40%";
                            td4.Align = "center";
                            tr1.Controls.Add(td1);
                            tr1.Controls.Add(td2);
                            tr1.Controls.Add(td3);
                            tr1.Controls.Add(td4);
                            tb.Controls.Add(tr1);

                            if (flag == "1")
                            {
                                HtmlTableRow tr2 = new HtmlTableRow();
                                HtmlTableCell tdTwo1 = CreateTD(1, null, null, "billAuditPerson");
                                tdTwo1.InnerText = "审核结果";

                                HtmlTableCell tdTwo2 = CreateTD(1, "2%", null, null);

                                HtmlTableCell tdTwo3 = CreateTD(2, "80%", null, null);
                                tdTwo3.Align = "left";
                                tdTwo3.ColSpan = 2;
                                tdTwo3.InnerText = ApprovalState;

                                tr2.Controls.Add(tdTwo1);
                                tr2.Controls.Add(tdTwo2);
                                tr2.Controls.Add(tdTwo3);
                                tb.Controls.Add(tr2);

                                HtmlTableRow tr3 = new HtmlTableRow();

                                HtmlTableCell tdThree1 = CreateTD(1, null, null, "billAuditPerson");
                                tdThree1.InnerText = "审核意见";

                                HtmlTableCell tdThree2 = CreateTD(1, "2%", null, null);

                                HtmlTableCell tdThree3 = CreateTD(2, "80%", null, "smt_autobreak");
                                tdThree3.Align = "left";
                                tdThree3.InnerText = ApprovalRemark;
                                tdThree3.ColSpan = 2;
                                tr3.Controls.Add(tdThree1);
                                tr3.Controls.Add(tdThree2);
                                tr3.Controls.Add(tdThree3);
                                tb.Controls.Add(tr3);
                            }


                            tb.Controls.Add(CreateBottomLine());
                        }
                    }

                }
                tb.ID = "tbApprove";
                HtmlTableRow tr = AddTable(tb);
                tr.Cells[0].ID = "tdApprove";
                TableCtrl.Rows.Add(tr);
            }

        }
Esempio n. 2
0
        public static ObjBill CreateBill(string xml, ref string error)
        {
            ObjBill bill = new ObjBill();

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(xml);

            //读取Form中的数据
            XmlNode nodeResult = doc.SelectSingleNode("//Result");
            if (nodeResult != null)
            {
                if (((XmlElement)nodeResult).GetAttribute("Code") != "0")
                {
                    error = ((XmlElement)nodeResult).InnerText.ToString();
                    throw new SmtException(((XmlElement)nodeResult).InnerText);
                }
                else
                {
                    XmlNode nodeForm = doc.SelectSingleNode("//Form");
                    bill.ModelCode = ((XmlElement)nodeForm).GetAttribute("ModelCode");
                    bill.OrderType = ((XmlElement)nodeForm).GetAttribute("OrderType");
                    bill.Text = ((XmlElement)nodeForm).GetAttribute("Text");
                    bill.FormID = ((XmlElement)nodeForm).GetAttribute("FormID");
                    bill.MessageStatus = ((XmlElement)nodeForm).GetAttribute("MESSAGESTATUS");
                    ObjBill schemaBill = DataManager<ObjBill>.Get(HttpContext.Current.Server.MapPath("BillSchema/" + bill.ModelCode + ".xml"));

                    XmlNode nodeObject = doc.SelectSingleNode("//Object");

                    { //读取主表数据

                        XmlNodeList list = nodeObject.SelectNodes("Attribute");
                        ObjDetailList detailList = new ObjDetailList();
                        detailList.ObjFieldList = new ObjField[list.Count];
                        foreach (var item in schemaBill.DetailLists)
                        {
                            item.Load();
                        }
                        for (int i = 0; i < list.Count; i++)
                        {
                            XmlElement node = list[i] as XmlElement;
                            string Name = ((XmlElement)node).GetAttribute("Name");
                            string Text = ((XmlElement)node).GetAttribute("Text");
                            string DataType = ((XmlElement)node).GetAttribute("DataType");
                            string DataValue = ((XmlElement)node).GetAttribute("DataValue");
                            string fgColor = string.Empty;
                            string Tooltip = string.Empty;
                            if (node.HasAttribute("Color"))
                            {
                                fgColor = node.GetAttribute("Color");
                            }
                            if (node.HasAttribute("Tooltip"))
                            {
                                Tooltip = node.GetAttribute("Tooltip");
                            }

                            ObjField dataField = new ObjField();
                            dataField.Name = Name;
                            dataField.Text = Text;
                            dataField.DataType = DataType;
                            dataField.DataValue = DataValue.Replace("\n","<br />");
                            dataField.Color = fgColor;
                            dataField.Tooltip = Tooltip;

                            //将数据样式应用于字段
                            if (schemaBill.DetailLists.Length > 0 &&
                                schemaBill.DetailLists[0].ObjFieldList.Length > 0 && schemaBill.DetailLists[0].GetObjFieldDict()[Name] != null)
                            {

                                ObjField schemaField = schemaBill.DetailLists[0].GetObjFieldDict()[Name];
                                dataField.Colspan = schemaField.Colspan;
                                dataField.IsVisible = schemaField.IsVisible;
                                dataField.CssName = schemaField.CssName;
                                dataField.Orderno = schemaField.Orderno;
                                dataField.ColumnOrder = schemaField.ColumnOrder;
                                dataField.Text = schemaField.Text;
                                dataField.IsShowCaption = schemaField.IsShowCaption;
                                dataField.IsLink = schemaField.IsLink;
                                if (dataField.DataType.ToLower() == "rtf")
                                {
                                    bill.RtfData = dataField.DataValue;
                                }
                                //因业务编号的问题,需要重新获取编号(目前出差报销)
                                if (dataField.DataValue == "")
                                {
                                    //TODO:需要重新获取编号
                                    //UNDONE:需要重新获取编号

                                }
                            }
                            else //在配置文件中没找到的字段,都不显示 
                            {
                                dataField.IsVisible = false;
                            }
                            detailList.ObjFieldList[i] = dataField;
                            detailList.PadRepeatCount = schemaBill.DetailLists[0].PadRepeatCount;
                            detailList.PhoneRepeatCount = schemaBill.DetailLists[0].PhoneRepeatCount;
                        }
                        bill.DetailLists = new ObjDetailList[] { detailList };

                    }


                    bill.SubLists = CreateSubList(nodeObject, "", schemaBill, false);

                    XmlNode ConsultationList = doc.SelectSingleNode("//ConsultationList");
                    if (ConsultationList != null)
                    {
                        bill.ConsultationLists = CreateConsultationList(ConsultationList);
                    }
                    XmlNode nodeApproval = doc.SelectSingleNode("//ApprovalList");

                    if (nodeApproval != null)
                    {//读取审核列表数据

                        XmlNodeList list = nodeApproval.SelectNodes("Atrribute");
                        ObjApprovalList approvalList = new ObjApprovalList();
                        approvalList.Text = "审核信息";
                        approvalList.ApprovalList = new ObjApproval[list.Count];
                        for (int i = 0; i < list.Count; i++)
                        {
                            XmlNode node = list[i];
                            string Approver = ((XmlElement)node).GetAttribute("Approver");
                            string ApprovalTime = ((XmlElement)node).GetAttribute("ApprovalTime");
                            string ApprovalState = ((XmlElement)node).GetAttribute("ApprovalState");
                            string ApprovalRemark = ((XmlElement)node).GetAttribute("ApprovalRemark");
                            string FlowType = ((XmlElement)node).GetAttribute("FlowType");
                            string Flag = ((XmlElement)node).GetAttribute("Flag");
                            ObjApproval dataField = new ObjApproval();
                            dataField.Approver = Approver;
                            dataField.ApprovalTime = Convert.ToDateTime(ApprovalTime);
                            dataField.ApprovalState = ApprovalState;
                            dataField.ApprovalRemark = ApprovalRemark;
                            dataField.Flag = Flag;
                            dataField.FlowType = FlowType;

                            //应用样式于字段
                            if (null != schemaBill.ApprovalLists && schemaBill.ApprovalLists.Length > 0 && null != schemaBill.ApprovalLists[0].ApprovalList &&
                                schemaBill.ApprovalLists[0].ApprovalList.Length > 0 && schemaBill.ApprovalLists[0].GetApprovalDict()[Approver] != null)
                            {
                                ObjApproval schemaField = schemaBill.ApprovalLists[0].GetApprovalDict()[Approver];

                                //dataField.Colspan = schemaField.Colspan;
                            }
                            approvalList.ApprovalList[i] = dataField;
                        }
                        bill.ApprovalLists = new ObjApprovalList[] { approvalList };
                    }


                    XmlNode nodeAttach = doc.SelectSingleNode("//AttachList");
                    if (nodeAttach != null)
                    {//读取附件列表数据

                        XmlNodeList list = nodeAttach.SelectNodes("Atrribute");
                        ObjAttachList approvalList = new ObjAttachList();
                        approvalList.AttachList = new ObjAttach[list.Count];
                        for (int i = 0; i < list.Count; i++)
                        {
                            XmlNode node = list[i];
                            string Name = ((XmlElement)node).GetAttribute("Name");
                            string Url = ((XmlElement)node).GetAttribute("Url");

                            ObjAttach dataField = new ObjAttach();
                            dataField.Name = Name;
                            dataField.Url = Url;

                            //将样式应用于字段
                            if (null != schemaBill && null != schemaBill.AttachLists && schemaBill.AttachLists.Length > 0 &&
                                schemaBill.AttachLists[0].AttachList != null &&
                                schemaBill.AttachLists[0].AttachList.Length > 0 && schemaBill.AttachLists[0].GetAttachDict()[Name] != null)
                            {
                                ObjAttach schemaField = schemaBill.AttachLists[0].GetAttachDict()[Name];
                                //dataField.Colspan = schemaField.Colspan;
                            }
                            approvalList.AttachList[i] = dataField;
                        }
                        bill.AttachLists = new ObjAttachList[] { approvalList };
                    }


                }



            }

            return bill;

        }