private void InitialControl() { oGenControl.GenDDLModel(CGeneral.TypeSelect.Please, ddlModel); MDFactory oMDFactory = new MDFactory(); MDLineData oMDLineData = new MDLineData(); MDMachine oMDMachine = new MDMachine(); oMDFactory = oFactory.GetFactoryByFactoryID(ViewState["FactoryID"].ToString()); oMDLineData = oLineData.GetLineDataByLineID(Convert.ToInt32(ViewState["ld_id"])); oMDMachine = oMachine.GetMachineBymc_code(ViewState["mc_code"].ToString()); if (oMDFactory.ListOfFactory.Count > 0) { lbFactory.Text = oMDFactory.ListOfFactory[0].FactoryName; } if (oMDLineData.ListOfLine.Count > 0) { lbPDLine.Text = oMDLineData.ListOfLine[0].ld_linename; } if (oMDMachine.ListOfmachine.Count > 0) { lbMachine.Text = oMDMachine.ListOfmachine[0].mc_code + " " + oMDMachine.ListOfmachine[0].mc_name; } }
public string GenBlock() { string result = ""; MDFactory oMDFactory = new MDFactory(); oMDFactory = oFactory.GetFactory(); if (oMDFactory.ListOfFactory.Count > 0) { foreach (MDFactory.CMDFactory oMD in oMDFactory.ListOfFactory) { result += " <div class='col-sm-6 col-md-2'>" + Environment.NewLine; result += " <div class='board-widget-wrap'>" + Environment.NewLine; result += " <a href='" + ResolveClientUrl("~/Production/DataHistory/Quantity/PDQuantityDataLine.aspx?FactoryID=" + oMD.FactoryID) + "'><i class='icon-factory'></i>" + Environment.NewLine; result += " <span class='board-widget-label'>" + oMD.FactoryName + " </span>" + Environment.NewLine; result += " <span class='board-widget-intro'>Line Qty: " + oMD.TotalLine + " , M/C Qty: " + oMD.TotalMachine + "</span>" + Environment.NewLine; result += " </a>" + Environment.NewLine; result += " </div>" + Environment.NewLine; result += " </div>" + Environment.NewLine; } } return(result); }
public MDFactory GetFactory() { MDFactory oMDFactory = new MDFactory(); DataTable dTable = new DataTable(); SqlCommand sql = new SqlCommand(); sql.CommandText = "SELECT fac.FactoryID,FactoryName"; sql.CommandText += " ,Count(ld.ld_id) as TotalLine"; sql.CommandText += " ,Count(mc.mc_code) as TotalMachine"; sql.CommandText += " FROM FactoryData fac"; sql.CommandText += " LEFT JOIN LineData ld ON fac.FactoryID = ld.FactoryID"; sql.CommandText += " LEFT JOIN Machine mc ON ld.ld_id = mc.ld_id"; sql.CommandText += " GROUP BY fac.FactoryID,FactoryName"; dTable = oConn.Query(sql); if (dTable.Rows.Count > 0) { foreach (DataRow row in dTable.Rows) { MDFactory.CMDFactory oMD = new MDFactory.CMDFactory(); oMD.FactoryID = row["FactoryID"] != DBNull.Value ? Convert.ToInt32(row["FactoryID"]) : 0; oMD.FactoryName = row["FactoryName"].ToString(); oMD.TotalLine = row["TotalLine"] != DBNull.Value ? Convert.ToInt32(row["TotalLine"]) : 0; oMD.TotalMachine = row["TotalMachine"] != DBNull.Value ? Convert.ToInt32(row["TotalMachine"]) : 0; oMDFactory.ListOfFactory.Add(oMD); } } return(oMDFactory); }
static void Main(string[] args) { string[] commands; var list = File.ReadAllText("CreateDocumentScript.txt"); commands = list.Split('#'); IDocumentFactory currentFactory = null; IDocument currentDocument = null; IElement currentElement = null; foreach (var command in commands) { var strippedCommand = Regex.Replace(command, @"\t|\n|\r", ""); var commandList = strippedCommand.Split(':'); switch (commandList[0]) { case "Document": { var temp = commandList[1].Split(';'); switch (temp[0]) { case "Html": currentFactory = HTMLFactory.GetInstance(); currentDocument = currentFactory.CreateDocument(temp[1]); break; case "Markdown": currentFactory = MDFactory.GetInstance(); currentDocument = currentFactory.CreateDocument(temp[1]); break; default: break; } } // Your document creation code goes here break; case "Element": { currentElement = currentFactory.CreateElement(commandList[1], commandList[2]); currentDocument.AddElement(currentElement); } // Your element creation code goes here break; case "Run": currentDocument.RunDocument(); break; default: break; } } }
public MDFactory GetFactoryByFactoryID(string FactoryID) { MDFactory oMDFactory = new MDFactory(); DataTable dTable = new DataTable(); SqlCommand sql = new SqlCommand(); sql.CommandText = "SELECT FactoryID,FactoryName"; sql.CommandText += " FROM FactoryData"; sql.CommandText += " WHERE FactoryID=@FactoryID"; sql.Parameters.Add(new SqlParameter("@FactoryID", FactoryID)); dTable = oConn.Query(sql); if (dTable.Rows.Count > 0) { foreach (DataRow row in dTable.Rows) { MDFactory.CMDFactory oMD = new MDFactory.CMDFactory(); oMD.FactoryID = row["FactoryID"] != DBNull.Value ? Convert.ToInt32(row["FactoryID"]) : 0; oMD.FactoryName = row["FactoryName"].ToString(); oMDFactory.ListOfFactory.Add(oMD); } } return(oMDFactory); }