예제 #1
0
        public override global::System.Data.DataSet Clone()
        {
            dsStock cln = ((dsStock)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
예제 #2
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            dsStock ds = new dsStock();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
예제 #3
0
        private void frmStockReport_Load(object sender, EventArgs e)
        {
            StockReport      rpt = new StockReport();
            dsStock          ds  = new dsStock();
            SQLiteConnection con = new SQLiteConnection("Data Source=" + System.IO.Path.Combine(AIO.path, AIO.file) + ";foreign keys=true;");

            DataTable xDT = new DataTable("Dates");

            DataColumn xDC = new DataColumn();

            xDC.DataType   = System.Type.GetType("System.DateTime");
            xDC.ColumnName = "From";
            xDT.Columns.Add(xDC);

            xDC            = new DataColumn();
            xDC.DataType   = System.Type.GetType("System.DateTime");
            xDC.ColumnName = "To";
            xDT.Columns.Add(xDC);


            DataRow dr = xDT.NewRow();

            dr["From"] = fromDate;
            dr["To"]   = ToDate;
            xDT.Rows.Add(dr);

            ds.Tables.Remove("Dates");
            ds.Tables.Add(xDT);


            AIO.command = "select abtComName as [Name],abtComMob as [Mob],abtComEmail as [Email],abtPAN as [PAN],abtVatTIN as [TIN],abtComAdd as [Add] from AboutMe as [Company]";
            SQLiteDataAdapter da = new SQLiteDataAdapter(AIO.command, con);

            da.Fill(ds, "Company");

            //AIO.command = "SELECT (SELECT comName || ' ' || M.modName FROM Company WHERE id = (SELECT catComID FROM Category WHERE id = M.modCatID)) AS Name, sum(CASE WHEN T.itgTranType = 'Purchase' THEN T.itgQTY ELSE 0 END) AS [Inwards], sum(CASE WHEN T.itgTranType = 'Sale' THEN T.itgQTY ELSE 0 END) AS [Outwards] FROM Model AS M LEFT JOIN TranItemsGrid AS T ON M.id == T.itgModID where T.itgTranID in (SELECT Trans.id from Trans where Trans.tranDate between '"+fromDate.ToString("yyyy-MM-dd")+"' and '"+ToDate.ToString("yyyy-MM-dd")+"') GROUP BY modName order by Name";


            StringBuilder sb = new StringBuilder();

            //sb.Append("SELECT cp.comName || ' ' || m.modName AS Name, ");
            //sb.Append("sum(CASE WHEN tig.itgTranType = 'Purchase' THEN tig.itgQTY ELSE 0 END) AS [Inwards], ");
            //sb.Append("sum(CASE WHEN tig.itgTranType = 'Sale' THEN tig.itgQTY ELSE 0 END) AS [Outwards] ");
            //sb.Append("FROM model AS m ");
            //sb.Append("LEFT JOIN ");
            //sb.Append("Category AS c ON m.modCatID = c.id ");
            //sb.Append("LEFT JOIN ");
            //sb.Append("Company AS cp ON c.catComID = cp.id ");
            //sb.Append("LEFT JOIN ");
            //sb.Append("TranItemsGrid AS tig ON tig.itgModID = m.id ");
            //sb.Append("LEFT JOIN ");
            //sb.Append("Trans AS t ON t.id = tig.itgTranID ");
            //sb.Append("WHERE t.tranDate BETWEEN '" + fromDate.ToString("yyyy-MM-dd") + "' AND '" + ToDate.ToString("yyyy-MM-dd") + "' ");
            //sb.Append("GROUP BY name;");
            //AIO.command = sb.ToString();

            //da = new SQLiteDataAdapter(AIO.command, con);
            //da.Fill(ds, "Items");

            sb = new StringBuilder();
            sb.Append("SELECT cp.comName || ' ' || m.modName AS Name, ");
            sb.Append("sum(CASE WHEN tig.itgTranType = 'Purchase' AND ");
            sb.Append("(t.tranDate BETWEEN '" + fromDate.ToString("yyyy-MM-dd") + "' AND '" + ToDate.ToString("yyyy-MM-dd") + "') THEN tig.itgQTY ELSE 0 END) AS [Inwards], ");
            sb.Append("sum(CASE WHEN tig.itgTranType = 'Sale' AND ");
            sb.Append("(t.tranDate BETWEEN '" + fromDate.ToString("yyyy-MM-dd") + "' AND '" + ToDate.ToString("yyyy-MM-dd") + "') THEN tig.itgQTY ELSE 0 END) AS [Outwards], ");
            sb.Append("sum(CASE WHEN tig.itgTranType = 'Purchase' AND ");
            sb.Append("(t.tranDate BETWEEN '" + StartDate.ToString("yyyy-MM-dd") + "' AND '" + fromDate.AddDays(-1).ToString("yyyy-MM-dd") + "') THEN tig.itgQTY ELSE 0 END) AS [OldIn], ");
            sb.Append("sum(CASE WHEN tig.itgTranType = 'Sale' AND ");
            sb.Append("(t.tranDate BETWEEN '" + StartDate.ToString("yyyy-MM-dd") + "' AND '" + fromDate.AddDays(-1).ToString("yyyy-MM-dd") + "') THEN tig.itgQTY ELSE 0 END) AS [OldOut] ");
            sb.Append("FROM model AS m ");
            sb.Append("LEFT JOIN ");
            sb.Append("Category AS c ON m.modCatID = c.id ");
            sb.Append("LEFT JOIN ");
            sb.Append("Company AS cp ON c.catComID = cp.id ");
            sb.Append("LEFT JOIN ");
            sb.Append("TranItemsGrid AS tig ON tig.itgModID = m.id ");
            sb.Append("LEFT JOIN ");
            sb.Append("Trans AS t ON t.id = tig.itgTranID ");
            sb.Append("GROUP BY name; ");

            AIO.command = sb.ToString();

            da = new SQLiteDataAdapter(AIO.command, con);
            da.Fill(ds, "Items");

            rpt.SetDataSource(ds);
            crystalReportViewer1.ReportSource = rpt;
            crystalReportViewer1.RefreshReport();
        }
예제 #4
0
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                dsStock ds = new dsStock();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "dsStockDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }