Esempio n. 1
0
        public override global::System.Data.DataSet Clone()
        {
            InOrderReportData cln = ((InOrderReportData)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Esempio n. 2
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            InOrderReportData ds = new InOrderReportData();

            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);
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            InOrderReportData ds = new InOrderReportData();
            if (Session["DataToReport"] != null)
            {
                ds = Session["DataToReport"] as InOrderReportData;
            }

            InOrderReport objRpt = new InOrderReport();
            objRpt.SetDataSource(ds);

            this.CrystalReportViewer1.ReportSource = objRpt;
            this.CrystalReportViewer1.RefreshReport();
        }
Esempio n. 4
0
        protected void btnPrint_Click(object sender, EventArgs e)
        {
            List <STORE> list = new List <STORE>();
            var          cmd  = new StoreService();

            for (int i = 0; i < grideInOrder.Rows.Count; i++)
            {
                if (list.Where(x => x.STORE_ID == Convert.ToInt32(grideInOrder.DataKeys[i].Values[1].ToString())).FirstOrDefault() == null)
                {
                    list.Add(cmd.Select(Convert.ToInt32(grideInOrder.DataKeys[i].Values[1].ToString())));
                }
            }


            List <InOrderForPrint> listInOrder = new List <InOrderForPrint>();
            var          cmdOrder       = new OrderService();
            var          cmdOrderDetail = new OrderDetailService();
            List <ORDER> tmpListOrder   = new List <ORDER>();

            foreach (STORE tmp in list)
            {
                InOrderForPrint inOrder = new InOrderForPrint();
                inOrder.Store        = tmp;
                inOrder.OrderDetails = new List <ORDER_DETAIL>();
                tmpListOrder         = cmdOrder.GetALLIncludeByStore(tmp.STORE_ID);
                foreach (ORDER tmpOrder in tmpListOrder)
                {
                    inOrder.Order = tmpOrder;
                    inOrder.OrderDetails.AddRange(cmdOrderDetail.GetALLIncludeByOrder(tmpOrder.ORDER_ID).ToList());
                }
                listInOrder.Add(inOrder);
            }
            InOrderReportData ds  = new InOrderReportData();
            DataTable         dt  = ds.Tables["Data"];
            DataTable         dt2 = ds.Tables["Data2"];

            List <ListOfLineForPrint> lstHead = new List <ListOfLineForPrint>();

            foreach (InOrderForPrint item in listInOrder)
            {
                List <LineForPrint> lstLine = new List <LineForPrint>();
                ListOfLineForPrint  tmpList = new ListOfLineForPrint();
                tmpList.LineForPrint = new List <LineForPrint>();
                LineForPrint linePrint = new LineForPrint();
                linePrint.line1 = ConvertDateToThai(item.Order.ORDER_DATE.Value);
                if (item.Store.PROVINCE_ID == 1)
                {
                    linePrint.line2 = item.Store.STORE_NAME + " (" + item.Store.STORE_CODE.Substring(item.Store.STORE_CODE.Length - 3, 3) + " )";
                }
                else
                {
                    linePrint.line2 = item.Store.STORE_CODE + " " + item.Store.STORE_NAME;
                }
                linePrint.line3 = "จำนวน";
                linePrint.line4 = "";
                linePrint.line5 = "ราคาต่อชิ้น";
                lstLine.Add(linePrint);

                foreach (ORDER_DETAIL od in item.OrderDetails)
                {
                    LineForPrint linePrintItem = new LineForPrint();
                    linePrintItem.line1 = "";
                    if (od.IS_FREE.Value)
                    {
                        linePrintItem.line2 = "แถม";
                    }
                    else
                    {
                        linePrintItem.line2 = od.PRODUCT.PRODUCT_NAME;
                    }
                    linePrintItem.line3 = od.PRODUCT_QTY.ToString();
                    linePrintItem.line4 = "";
                    linePrintItem.line5 = od.PRODUCT_PRICE.ToString();
                    lstLine.Add(linePrintItem);
                }
                tmpList.LineForPrint.AddRange(lstLine);
                lstHead.Add(tmpList);
            }

            DataRow dr1;
            int     indexData1 = 0;

            for (int i = 0; i < lstHead.Count; i++)
            {
                for (int j = 0; j < lstHead[i].LineForPrint.Count; j++)
                {
                    dr1          = dt.NewRow();
                    dr1["LINEX"] = indexData1++;
                    dr1["LINE1"] = lstHead[i].LineForPrint[j].line1;
                    dr1["LINE2"] = lstHead[i].LineForPrint[j].line2;
                    dr1["LINE3"] = lstHead[i].LineForPrint[j].line3;
                    dr1["LINE4"] = lstHead[i].LineForPrint[j].line4;
                    dr1["LINE5"] = lstHead[i].LineForPrint[j].line5;
                    dt.Rows.Add(dr1);
                }

                for (int k = 0; k < 5; k++)
                {
                    dr1          = dt.NewRow();
                    dr1["LINEX"] = indexData1++;
                    dr1["LINE1"] = "";
                    dr1["LINE2"] = "";
                    dr1["LINE3"] = "";
                    dr1["LINE4"] = "";
                    dr1["LINE5"] = "";
                    dt.Rows.Add(dr1);
                }
            }

            Session["DataToReport"] = ds;
            Response.Redirect("../Reports/InOrder.aspx");
        }
Esempio n. 5
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();
                InOrderReportData ds = new InOrderReportData();

                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 = "DataDataTable";
                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);
            }
Esempio n. 6
0
        protected void btnPrint_Click(object sender, EventArgs e)
        {
            List<STORE> list = new List<STORE>();
            var cmd = new StoreService();
            for (int i = 0; i < grideInOrder.Rows.Count; i++)
            {
                if (list.Where(x => x.STORE_ID == Convert.ToInt32(grideInOrder.DataKeys[i].Values[1].ToString())).FirstOrDefault() == null)
                {
                    list.Add(cmd.Select(Convert.ToInt32(grideInOrder.DataKeys[i].Values[1].ToString())));
                }
            }

            List<InOrderForPrint> listInOrder = new List<InOrderForPrint>();
            var cmdOrder = new OrderService();
            var cmdOrderDetail = new OrderDetailService();
            List<ORDER> tmpListOrder = new List<ORDER>();
            foreach (STORE tmp in list)
            {
                InOrderForPrint inOrder = new InOrderForPrint();
                inOrder.Store = tmp;
                inOrder.OrderDetails = new List<ORDER_DETAIL>();
                tmpListOrder = cmdOrder.GetALLIncludeByStore(tmp.STORE_ID);
                foreach (ORDER tmpOrder in tmpListOrder)
                {
                    inOrder.Order = tmpOrder;
                    inOrder.OrderDetails.AddRange(cmdOrderDetail.GetALLIncludeByOrder(tmpOrder.ORDER_ID).ToList());
                }
                listInOrder.Add(inOrder);
            }
            InOrderReportData ds = new InOrderReportData();
            DataTable dt = ds.Tables["Data"];
            DataTable dt2 = ds.Tables["Data2"];

            List<ListOfLineForPrint> lstHead = new List<ListOfLineForPrint>();
            foreach (InOrderForPrint item in listInOrder)
            {
                List<LineForPrint> lstLine = new List<LineForPrint>();
                ListOfLineForPrint tmpList = new ListOfLineForPrint();
                tmpList.LineForPrint = new List<LineForPrint>();
                LineForPrint linePrint = new LineForPrint();
                linePrint.line1 = ConvertDateToThai(item.Order.ORDER_DATE.Value);
                if (item.Store.PROVINCE_ID == 1)
                {
                    linePrint.line2 = item.Store.STORE_NAME + " (" + item.Store.STORE_CODE.Substring(item.Store.STORE_CODE.Length - 3, 3) + " )";
                }
                else
                {
                    linePrint.line2 = item.Store.STORE_CODE + " " + item.Store.STORE_NAME;
                }
                linePrint.line3 = "จำนวน";
                linePrint.line4 = "";
                linePrint.line5 = "ราคาต่อชิ้น";
                lstLine.Add(linePrint);

                foreach (ORDER_DETAIL od in item.OrderDetails)
                {
                    LineForPrint linePrintItem = new LineForPrint();
                    linePrintItem.line1 = "";
                    if (od.IS_FREE.Value)
                    {
                        linePrintItem.line2 = "แถม";
                    }
                    else
                    {
                        linePrintItem.line2 = od.PRODUCT.PRODUCT_NAME;
                    }
                    linePrintItem.line3 = od.PRODUCT_QTY.ToString();
                    linePrintItem.line4 = "";
                    linePrintItem.line5 = od.PRODUCT_PRICE.ToString();
                    lstLine.Add(linePrintItem);
                }
                tmpList.LineForPrint.AddRange(lstLine);
                lstHead.Add(tmpList);
            }

            DataRow dr1;
            int indexData1 = 0;
            for (int i = 0; i < lstHead.Count; i++)
            {
                for (int j = 0; j < lstHead[i].LineForPrint.Count; j++)
                {
                    dr1 = dt.NewRow();
                    dr1["LINEX"] = indexData1++;
                    dr1["LINE1"] = lstHead[i].LineForPrint[j].line1;
                    dr1["LINE2"] = lstHead[i].LineForPrint[j].line2;
                    dr1["LINE3"] = lstHead[i].LineForPrint[j].line3;
                    dr1["LINE4"] = lstHead[i].LineForPrint[j].line4;
                    dr1["LINE5"] = lstHead[i].LineForPrint[j].line5;
                    dt.Rows.Add(dr1);
                }

                for (int k = 0; k < 5; k++)
                {
                    dr1 = dt.NewRow();
                    dr1["LINEX"] = indexData1++;
                    dr1["LINE1"] = "";
                    dr1["LINE2"] = "";
                    dr1["LINE3"] = "";
                    dr1["LINE4"] = "";
                    dr1["LINE5"] = "";
                    dt.Rows.Add(dr1);
                }
            }

            Session["DataToReport"] = ds;
            Response.Redirect("../Reports/InOrder.aspx");
        }