DCSIMG
DEV - Uzi Drori's Blog
Sign in | Join | Help

Browse by Tags

complex XML Class Generator for C# using XSD
26 July 12 06:22 PM | uzid | with no comments
1. Open VS Command Promot (2010) 2. Create XSD: >xd c:\...XmlFile1.xml 3. Create CSS: >xsd XmlFile1.xsd /classes (for C#) 4. Main Code: System.IO.StreamReader str = new System.IO.StreamReader (@"C:\XMLFile1.xml"); System.Xml.Serialization.XmlSerializer xSerializer = new System.Xml.Serialization.XmlSerializer(typeof(WIRECARD_BXML)); WIRECARD_BXML res = (WIRECARD_BXML)xSerializer.Deserialize(str);
תגים:,
TSQL Self join for expert
20 May 12 02:57 PM | uzid | with no comments
שאילתה שסופרת שמות של עובדים ע"פ מפתח, בכל פעם שעובד מתחלף הספירה מתאפסת ID Employee Count 1 Rafi 1 Rafi 2 Uzi 2 Uzi 3 Bio 3 Bio 4 Moti 4 Moti 5 Oth 5 Oth declare @temp table ( ID int, Employee nvarchar(500), ncount int ) INSERT INTO @temp (ID, Employee) SELECT * FROM ( SELECT [ProfessionID] ,Employee.Name FROM [DWH].[dbo].Employee )Main Update @temp SET ncount = (select count(1) from @temp a where a.id <= b.id and a.id = b.id) from @temp b select * from @temp ID Employee Count 1 Rafi 1 1...
תגים:, ,
Moss 2007 – Hiding fields on NewForm and EditForm
26 December 11 05:09 PM | uzid | with no comments
In the NewForm or EditForm you need to paste the following code: <script language= "javascript" type= "text/javascript" > _spBodyOnLoadFunctionNames.push( "hideField" ); function findacontrol(FieldName) { var arr = document.getElementsByTagName( "!" ); for ( var i=0;i < arr.length; i++ ) { if (arr[i].innerHTML.indexOf(FieldName) > 0) { return arr[i]; } } } function hideField() { var control = findacontrol( "Title" ); control.parentNode...
תגים:, ,
Convert MSWord to PDF by PDFCreator - The complete Code
25 June 11 09:49 PM | uzid | with no comments
First you need to install PDFCreator using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using PDFCreator; using System.Diagnostics; using System.Threading; using Microsoft.Office.Interop.Word; namespace PDF_Creator_WORD { public class CreatePDF { public CreatePDF(string docOutputPath, string _AutosaveDirectory, string _AutosaveFilename) { //get path to template and instance output #region PDF Create clsPDFCreator creator = new clsPDFCreator(); string...
תגים:,
C# - How to Insert paragraph to MsWord and save it as PDF
25 June 11 09:27 PM | uzid | with no comments
1. First you need to install the Add-In: 2007 Microsoft Office Add-in: Microsoft Save as PDF 2. You need to create Bookmark in msWord Microsoft.Office.Interop.Word.Application ap = new Microsoft.Office.Interop.Word.Application(); Microsoft.Office.Interop.Word.Document doc1 = ap.Documents.Open(@"c:\test.docx", ReadOnly: false, Visible: false); Object oBookmarkTOC1 = "BookMarkName"; object format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF; //Update BookMark doc1.Bookmarks...
תגים:,
C# lambda expressions - Array and DataTable
10 May 11 10:12 PM | uzid | with no comments
How to get distinct (GroupBy) from Array and do query (Select). string[] TotalCompany = new string[] { "A", "B", "A", "C" }; var groupbyCompany = TotalCompany.GroupBy(x => x).Select(group => group.Key != null); How to get distinct (GroupBy) from DataTable and do query (Select). var groupbyCompany = DtCompany.AsEnumerable() .GroupBy(x => x.Field("CompanyID")) .Select(group => group.Key != null);
תגים:, ,
CRM 2011 - How to create related Lookup between Country and City (cascading dropdown)
30 March 11 06:24 PM | uzid | with no comments
How to create cascading dropdown Counrty and City without Code to The Account Entity: 1. Create 2 Entity Country and City and Create Relationships 1:N and Publish. 2. Open the Account entity and add 2 new fields 3. Add the 2 fileds to the form. 4. Click on the City field and add the following: 5. Publish the form
תגים:, ,
CRM 2011 - Import status stuck in Waiting
14 March 11 05:33 PM | uzid | with no comments
Check the service: Microsoft Dynamics CRM Asynchronous Processing Service if is not running or having an issue.
תגים:, ,
C# - How to get Datatable from XML
06 January 11 01:19 PM | uzid | with no comments
//XML <?xml version="1.0" encoding="utf-8" ?> <currencies> <currency> <symbol>NIS</symbol> <code>1</code> </currency> <currency> <symbol>USD</symbol> <code>2</code> </currency> </currencies> XElement res = XElement.Load("Currency.xml"); List<Currency> cur = (from x2 in res.Elements("currency") select new Currency { CurrencyID = x2.Element("symbol").Value...
תגים:, ,
ADO.NET Entity Model - Using Stored Procedures That Return Non Entity Type
03 January 11 03:31 PM | uzid | 2 comment(s)
In order to get this working you might need to implement a partial class and then specify the method. take a look at this Link
תגים:, ,
C# - question marks and TSQL - COALESCE
27 December 10 10:07 AM | uzid | 2 comment(s)
מה המשותף בין שני סימני שאלה ?? ב C# לפונקצית COALESCE ב TSQL : TSQL: SELECT COALESCE(X, Y, Z) AS FirstNotNull FROM MyTable C#: Int32? N1 = null; //Nullable N1; Nullable N2 = 15; Console.WriteLine(N1 ?? N2); התשובה היא בשניהם נקבל את המשתנה הראשון שלא מכיר את NULL
תגים:, , ,
How to Create HTML Table from MOSS List by using jquery and json
01 December 10 09:10 PM | uzid | 15 comment(s)
להלן המדריך השלם להעברת list מ moss ל client בעזרת ajax ו json: //Server WebService 1. Add Web Reference to: http:///_vti_bin/lists.asmx 2. Add new WebService.cs class Code for the WebService: [WebMethod] public Dictionary getSPSdata() { WSS.Lists newListProxy = new WSS.Lists();//WSS is the WebReference Name newListProxy.Credentials = new System.Net.NetworkCredential("user", "password", "domain"); XmlDocument xmlDoc = new XmlDocument(); XmlNode xmlNode = newListProxy...
תגים:, ,
Reporting Server - Print report automatically by c#
01 December 10 04:47 PM | uzid | with no comments
הופתעתי לגלות שלא ניתן להדפיס דו"ח ישירות מהקוד אלא צריך לשמור את הדו"ח כתמונה ורק לאחר מכן להדפיס, מצ"ב הקוד המלא static int m_currentPageIndex; static IList m_streams; //First convert the Reporting Server to Image Export(reportViewer1.LocalReport); //Send to the Printer Print(); public static void Print() { if (m_streams == null || m_streams.Count == 0) throw new Exception("Error: no stream to print."); PrintDocument printDoc = new PrintDocument(); if (!printDoc.PrinterSettings...
תגים:, ,
MSSQL - Tsql information
21 November 10 07:04 PM | uzid | with no comments
Sizes of All Tables in a Database IF OBJECT_ID('tempdb..#TablesSizes') IS NOT NULL DROP TABLE #TablesSizes CREATE TABLE #TablesSizes (TableName sysname, ROWS BIGINT, reserved VARCHAR(100), DATA VARCHAR(100), index_size VARCHAR(100), unused VARCHAR(100)) DECLARE @SQL VARCHAR(MAX) SELECT @SQL = COALESCE(@SQL,'') + ' insert into #TablesSizes execute sp_spaceused ' + QUOTENAME(Table_Name,'''') FROM INFORMATION_SCHEMA.TABLES EXECUTE (@SQL) SELECT * FROM #TablesSizes...
תגים:,
Linq to XML
21 November 10 01:43 PM | uzid | with no comments
הדרך הקלה ביותר לשלוף מידע מתוך xml היא ללא ספק דרך link XElement res = XElement.Load("MyXML.xml"); var Linq1 = from x1 in res.Descendants("Node") where x1.Element("Customer").Value == "MyCustomer" select x1; foreach (var item in Linq1) { string x = item.Value; }
תגים:,
More Posts Next page »