Exemplo n.º 1
0
 public SYS_BUSINESSROLE GetBusinessRole(int RoleID)
 {
     using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
     {
         return(orm.Init <SYS_BUSINESSROLE>("where ID=" + RoleID));
     }
 }
Exemplo n.º 2
0
 public ORUP_ORGANIZATION GetOrganization(int OrgID)
 {
     using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
     {
         return(orm.Init <ORUP_ORGANIZATION>("where ID=" + OrgID));
     }
 }
Exemplo n.º 3
0
 public SYS_BUSINESSDATADETAIL BusinessDataDetail(int BusinessDataID, int MetaDataID)
 {
     using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
     {
         return(orm.Init <SYS_BUSINESSDATADETAIL>("where REF_BUSINESSDATA_ID=" + BusinessDataID + " and REF_METADATA_ID=" + MetaDataID));
     }
 }
Exemplo n.º 4
0
 public SYS_BUSINESSFORM GetBusinessForm(int FormID)
 {
     using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
     {
         return(orm.Init <SYS_BUSINESSFORM>("where ID=" + FormID));
     }
 }
Exemplo n.º 5
0
 public SYS_METADATA MetaData(int MetaDataID)
 {
     using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
     {
         return(orm.Init <SYS_METADATA>("where ID=" + MetaDataID));
     }
 }
Exemplo n.º 6
0
 public SYS_SYSTEMCONFIG GetConfig(int ConfigId)
 {
     using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
     {
         return(orm.Init <SYS_SYSTEMCONFIG>("where ID=" + ConfigId));
     }
 }
Exemplo n.º 7
0
 public SYS_BUSINESSMATERIAL GetBusinessMaterial(int MaterialID)
 {
     using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
     {
         return(orm.Init <SYS_BUSINESSMATERIAL>("where ID=" + MaterialID));
     }
 }
Exemplo n.º 8
0
 public SYS_BUSINESS Business(int BusinessID)
 {
     using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
     {
         return(orm.Init <SYS_BUSINESS>("where ID=" + BusinessID));
     }
 }
Exemplo n.º 9
0
 public ORUP_ROLE GetRole(int RoleID)
 {
     using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
     {
         return(orm.Init <ORUP_ROLE>("where ID=" + RoleID));
     }
 }
Exemplo n.º 10
0
        public List <SYS_MESSAGE> GetReadMsgs(string UserId)
        {
            List <SYS_MESSAGE> result = null;

            using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
            {
                result = orm.Query <SYS_MESSAGE>("where STATE=1 and RECVUSERID='" + UserId + "'");
                foreach (SYS_MESSAGE msg in result)
                {
                    ORUP_USER sendUser = orm.Init <ORUP_USER>("where ID=" + msg.SENDUSERID);
                    msg.SENDUSERNAME = sendUser.USERNAME;
                    msg.SENDUSERIMG  = sendUser.USERIMG;
                    msg.PROJECTNAME  = orm.Init <SYS_PROJECT>("where ID=" + msg.REF_PROJECT_ID).PROJECTNAME;
                    msg.RECVUSERNAME = orm.Init <ORUP_USER>("where ID=" + msg.RECVUSERID).USERNAME;
                }
            }
            return(result);
        }
Exemplo n.º 11
0
        public ORUP_USER GetUser(string username, string password)
        {
            ORUP_USER user = null;

            using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
            {
                user = orm.Init <ORUP_USER>("where USERNAME='******' and password='******'");
            }
            return(user);
        }
Exemplo n.º 12
0
        public ORUP_USER GetUser(int userId)
        {
            ORUP_USER user = null;

            using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
            {
                user = orm.Init <ORUP_USER>("where ID=" + userId);
            }
            return(user);
        }
Exemplo n.º 13
0
        public SYS_BUSINESSDATA BusinessData(int BusinessDataID)
        {
            SYS_BUSINESSDATA result = null;

            using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
            {
                result = orm.Init <SYS_BUSINESSDATA>("where ID=" + BusinessDataID);
            }
            return(result);
        }
Exemplo n.º 14
0
        public ORUP_USER modifyPassword(string userId, string password)
        {
            ORUP_USER user = null;

            using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
            {
                user          = orm.Init <ORUP_USER>("where ID='" + userId + "'");
                user.PASSWORD = password;
                orm.Save(user);
            }
            return(user);
        }
Exemplo n.º 15
0
        public SYS_BUSINESSDATA EditBusinessData(int Id, string Name, string Description)
        {
            SYS_BUSINESSDATA result = null;

            using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
            {
                result             = orm.Init <SYS_BUSINESSDATA>("where ID=" + Id);
                result.NAME        = Name;
                result.DESCRIPTION = Description;
                orm.Update(result);
            }
            return(result);
        }
Exemplo n.º 16
0
        public List <SYS_MESSAGE> ReadMsg(string MsgId)
        {
            SYS_MESSAGE msg = null;

            List <SYS_MESSAGE> result = null;

            using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
            {
                msg       = orm.Init <SYS_MESSAGE>("where ID=" + MsgId);
                msg.STATE = 1;
                orm.Save(msg);

                result = GetNoReadMsgs(msg.RECVUSERID + "");
            }
            return(result);
        }
Exemplo n.º 17
0
        public ActionResult DoLogin(LoginViewModel model, string returnUrl)
        {
            ORUP_USER user = null;

            using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
            {
                user = orm.Init <ORUP_USER>("where USERNAME='******' and PASSWORD='******'");
                if (null != user)
                {
                    Session["UserId"]   = user.ID + "";
                    Session["UserName"] = user.USERNAME + "";
                    return(View("Index"));
                }
                else
                {
                    return(View("Login"));
                }
            }
        }
Exemplo n.º 18
0
        public ORUP_USER modifyUserInfo(string userId, string name, string value)
        {
            ORUP_USER user = null;

            using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
            {
                user = orm.Init <ORUP_USER>("where ID='" + userId + "'");
                if (name == "MOBILE")
                {
                    user.MOBILE = value;
                }
                if (name == "PHONE")
                {
                    user.PHONE = value;
                }
                if (name == "EMAIL")
                {
                    user.EMAIL = value;
                }
                orm.Save(user);
            }
            return(user);
        }
Exemplo n.º 19
0
        public ActionResult BuildForm(int ProjectFormId)
        {
            SYS_PROJECTFORM  prjForm      = null;
            SYS_BUSINESSFORM businessForm = null;

            using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
            {
                prjForm      = orm.Init <SYS_PROJECTFORM>("where ID=" + ProjectFormId);
                businessForm = orm.Init <SYS_BUSINESSFORM>("where ID=" + prjForm.REF_BUSINESSFORM_ID);
            }
            StringBuilder result  = new StringBuilder();
            string        content = System.Text.Encoding.Default.GetString(businessForm.CONTENT);

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(content);
            XmlNode controlNode = doc.SelectNodes("Form/Control").Item(0);
            string  formWidth   = controlNode.Attributes["width"].Value;
            string  formHeight  = controlNode.Attributes["height"].Value;

            result.Append("<div id='form-" + ProjectFormId + "' style='position:relative; margin:0 auto;margin-top:20px;margin-bottom:20px; width:" + (Convert.ToInt32(formWidth) + 200) + "px; height:" + (Convert.ToInt32(formHeight) + 250) + "px;background:white;'>");

            #region Controls
            foreach (XmlNode node in controlNode.ChildNodes)
            {
                string NodeType  = node.Name;
                string id        = node.Attributes["id"].Value;
                string name      = node.Attributes["name"].Value;
                string x         = node.Attributes["x"].Value;
                string y         = node.Attributes["y"].Value;
                string width     = node.Attributes["width"].Value;
                string height    = node.Attributes["height"].Value;
                string readonlyT = node.Attributes["readonly"].Value;
                string isprint   = node.Attributes["isprint"].Value;
                string text      = null;
                if (null != node.Attributes["text"])
                {
                    text = node.Attributes["text"].Value;
                }

                string temp = "";
                switch (NodeType)
                {
                case "Label":
                    temp = "<span id='" + id + "' style='position: absolute;left:" + x + "px;top:" + y + "px;width:" + width + "px;height:" + height + "px' >" + text + "</span>";
                    break;

                case "TextBox":
                    temp = "<input type='text' id='" + id + "' style='position: absolute;left:" + x + "px;top:" + y + "px;width:" + width + "px;height:" + height + "px' />";
                    break;

                case "ComboBox":
                    temp = "<select id='" + id + "' style='position: absolute;left:" + x + "px;top:" + y + "px;width:" + width + "px;height:" + height + "px' >" + "</select>";
                    break;

                case "RadioButtonList":
                    temp = "<input type='radio' id='" + id + "' style='position: absolute;left:" + x + "px;top:" + y + "px;width:" + width + "px;height:" + height + "px' />";
                    break;

                default:
                    break;
                }
                result.Append(temp);
            }
            #endregion Controls

            #region Sheet
            XmlNode     sheetReportNode = doc.SelectNodes("Form/SheetReport/Layout").Item(0);
            SheetReport sheetReport     = new SheetReport();
            sheetReport.Orientation              = sheetReportNode.Attributes["Orientation"].Value;
            sheetReport.PaperWidthWithTwipsUnit  = sheetReportNode.Attributes["PaperWidthWithTwipsUnit"].Value;
            sheetReport.PaperHeightWithTwipsUnit = sheetReportNode.Attributes["PaperHeightWithTwipsUnit"].Value;
            sheetReport.BottomMargin             = sheetReportNode.Attributes["BottomMargin"].Value;
            sheetReport.LeftMargin  = sheetReportNode.Attributes["LeftMargin"].Value;
            sheetReport.RightMargin = sheetReportNode.Attributes["RightMargin"].Value;
            sheetReport.TopMargin   = sheetReportNode.Attributes["TopMargin"].Value;

            XmlNodeList sheetPageNodes = sheetReportNode.SelectNodes("SheetPageNode/SheetPage");
            sheetReport.SheetPages = new List <SheetPage>();
            int sheetPageNodeIndex = 0;
            foreach (XmlNode pageNode in sheetPageNodes)
            {
                /*用来画表*/
                //SheetRectangle paperMarginWithTwipsUnit = this.GetPaperMarginWithTwipsUnit();

                int paperActualHeight = Convert.ToInt32(sheetReport.PaperHeightWithTwipsUnit) - 750 * 1440 / 1000 - 750 * 1440 / 1000; //TOP - BOTTOM
                int pointX            = 1000 * 1440 / 1000;                                                                            //Left
                int pointY            = 750 * 1440 / 1000 - sheetPageNodeIndex * paperActualHeight;                                    // TOP
                sheetPageNodeIndex++;
                /**/

                SheetPage sheetPage = new SheetPage();
                sheetReport.SheetPages.Add(sheetPage);

                XmlNode    tableNode  = pageNode.SelectSingleNode("SheetTable");
                SheetTable sheetTable = new SheetTable();
                sheetPage.SheetTable = sheetTable;

                sheetTable.RowPositionCollection = new List <RowPosition>();
                XmlNodeList rowPositionNodes = tableNode.SelectNodes("RowPositionCollection/RowPosition");
                foreach (XmlNode rowPositionNode in rowPositionNodes)
                {
                    RowPosition rowPosition = new RowPosition();
                    rowPosition.position = rowPositionNode.Attributes["position"].Value;
                    sheetTable.RowPositionCollection.Add(rowPosition);
                }

                sheetTable.ColumnPositionCollection = new List <ColumnPosition>();
                XmlNodeList columnPositionNodes = tableNode.SelectNodes("ColumnPositionCollection/ColumnPosition");
                foreach (XmlNode columnPositionNode in columnPositionNodes)
                {
                    ColumnPosition columnPosition = new ColumnPosition();
                    columnPosition.position = columnPositionNode.Attributes["position"].Value;
                    sheetTable.ColumnPositionCollection.Add(columnPosition);
                }

                sheetTable.SheetRows = new List <SheetRow>();
                XmlNodeList sheetRowNodes = tableNode.SelectNodes("SheetRow");
                //int rowIndex = 0; //用来画表


                int rowCount    = sheetTable.RowPositionCollection.Count - 1;
                int columnCount = sheetTable.ColumnPositionCollection.Count - 1;

                for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
                {
                    XmlNode  sheetRowNode = sheetRowNodes[rowIndex];
                    SheetRow sheetRow     = new SheetRow();
                    sheetTable.SheetRows.Add(sheetRow);

                    XmlNodeList sheetColumnNodes = sheetRowNode.SelectNodes("SheetColumn");
                    sheetRow.SheetColumns = new List <SheetColumn>();

                    //int columnIndex = 0; //用来画表
                    for (int columnIndex = 0; columnIndex < columnCount; columnIndex++)
                    {
                        XmlNode sheetColumnNode = sheetColumnNodes[columnIndex];

                        SheetColumn sheetColumn = new SheetColumn();
                        sheetRow.SheetColumns.Add(sheetColumn);

                        XmlNode       sheetItemNodeNode = sheetColumnNode.SelectSingleNode("SheetItemNode");
                        SheetItemNode sheetItemNode     = new SheetItemNode();
                        sheetItemNode.IsCellUnit  = sheetItemNodeNode.Attributes["IsCellUnit"].Value;
                        sheetItemNode.CellPx      = sheetItemNodeNode.Attributes["CellPx"].Value;
                        sheetItemNode.CellPy      = sheetItemNodeNode.Attributes["CellPy"].Value;
                        sheetColumn.SheetItemNode = sheetItemNode;

                        if ("0" == sheetItemNode.IsCellUnit)
                        {
                            continue;
                        }

                        /**/
                        for (int px = 0; px < Convert.ToInt32(sheetItemNode.CellPx); px++)
                        {
                            for (int py = 0; py < Convert.ToInt32(sheetItemNode.CellPy); py++)
                            {
                                if (px > 0 && px < Convert.ToInt32(sheetItemNode.CellPx) - 1 && py > 0 && py < Convert.ToInt32(sheetItemNode.CellPy) - 1)
                                {
                                    continue;
                                }

                                SheetRectangle nodeRectangle = new SheetRectangle();

                                nodeRectangle.Left   = Convert.ToInt32(sheetTable.ColumnPositionCollection[columnIndex + px].position);
                                nodeRectangle.Right  = Convert.ToInt32(sheetTable.ColumnPositionCollection[columnIndex + px + 1].position);
                                nodeRectangle.Top    = Convert.ToInt32(sheetTable.RowPositionCollection[rowIndex + py].position);
                                nodeRectangle.Bottom = Convert.ToInt32(sheetTable.RowPositionCollection[rowIndex + py + 1].position);

                                nodeRectangle.Left   += pointX;
                                nodeRectangle.Right  += pointX;
                                nodeRectangle.Top    += pointY;
                                nodeRectangle.Bottom += pointY;
                                //计算放大倍数,换算为Pixels为单位
                                nodeRectangle.Left   = nodeRectangle.Left * 2 / 30;
                                nodeRectangle.Right  = nodeRectangle.Right * 2 / 30;
                                nodeRectangle.Top    = nodeRectangle.Top * 2 / 30;
                                nodeRectangle.Bottom = nodeRectangle.Bottom * 2 / 30;

                                float width  = nodeRectangle.Right - nodeRectangle.Left;
                                float height = nodeRectangle.Bottom - nodeRectangle.Top;
                                //result.Append("<div style='position:absolute;border:solid 1px black; left:" + (nodeRectangle.Left + 50) + "px; top:" + nodeRectangle.Top + "px; width:" + width + "px; height:" + height + "px;'></div>");


                                float pageStartPointX = 21 + 20;
                                float pageStartPointY = 21 + 16;
                                // 合并单元格左边框
                                if (px == 0)
                                {
                                    float startPointX = nodeRectangle.Left + pageStartPointX;
                                    float startPointY = nodeRectangle.Top + pageStartPointY;
                                    float endPointX   = nodeRectangle.Left + pageStartPointX;
                                    float endPointY   = nodeRectangle.Bottom + pageStartPointY;
                                    width  = endPointX - startPointX;
                                    height = endPointY - startPointY;
                                    result.Append(" <div style='position:absolute;border-left:solid 1px black; left:" + startPointX + "px; top:" + startPointY + "px; width:" + width + "px; height:" + height + "px;'></div>\r\n");
                                }
                                // 合并单元格上边框
                                if (py == 0)
                                {
                                    float startPointX = nodeRectangle.Left + pageStartPointX;
                                    float startPointY = nodeRectangle.Top + pageStartPointY;
                                    float endPointX   = nodeRectangle.Right + pageStartPointX;
                                    float endPointY   = nodeRectangle.Top + pageStartPointY;
                                    width  = endPointX - startPointX;
                                    height = endPointY - startPointY;
                                    result.Append(" <div style='position:absolute;border-top:solid 1px black; left:" + startPointX + "px; top:" + startPointY + "px; width:" + width + "px; height:" + height + "px;'></div>\r\n");
                                }
                                // 合并单元格右边框
                                if (px == Convert.ToInt32(sheetItemNode.CellPx) - 1 //最后一条边
                                    //&& columnIndex + Convert.ToInt32(sheetItemNode.CellPx) == columnCount
                                    )
                                {
                                    float startPointX = nodeRectangle.Right + pageStartPointX;
                                    float startPointY = nodeRectangle.Top + pageStartPointY;
                                    float endPointX   = nodeRectangle.Right + pageStartPointX;
                                    float endPointY   = nodeRectangle.Bottom + pageStartPointY;
                                    width  = endPointX - startPointX;
                                    height = endPointY - startPointY;
                                    result.Append(" <div style='position:absolute;border-right:solid 1px black; left:" + startPointX + "px; top:" + startPointY + "px; width:" + width + "px; height:" + height + "px;'></div>\r\n");
                                }
                                // 合并单元格下边框
                                if (py == Convert.ToInt32(sheetItemNode.CellPy) - 1  //最后一条边
                                    //&& rowIndex + Convert.ToInt32(sheetItemNode.CellPy) == rowCount
                                    )
                                {
                                    float startPointX = nodeRectangle.Left + pageStartPointX;
                                    float startPointY = nodeRectangle.Bottom + pageStartPointY;
                                    float endPointX   = nodeRectangle.Right + pageStartPointX;
                                    float endPointY   = nodeRectangle.Bottom + pageStartPointY;
                                    if (columnIndex + Convert.ToInt32(sheetItemNode.CellPx) == columnCount)
                                    {
                                        // 画图时右下角缺一块???
                                        endPointX++;
                                    }
                                    width  = endPointX - startPointX;
                                    height = endPointY - startPointY;
                                    result.Append(" <div style='position:absolute;border-bottom:solid 1px black; left:" + startPointX + "px; top:" + startPointY + "px; width:" + width + "px; height:" + height + "px;'></div>\r\n");
                                }
                            }
                        }
                        /**/
                    }
                }