Пример #1
0
        private void loadData()
        {
            // get data
            dsGeneral.dtAppPreferenceDataTable dt = iFacede.GetAppPreference(Globalized.ObjDbName, GlobalObjPreference);
            // intialize object
            if (dt.Rows.Count > 0)
            {
                ObservableCollection <dhAppPreference> listItem = ReflectionUtility.DataTableToObservableCollection <dhAppPreference>(dt);
                if (listItem.Count > 0)
                {
                    GlobalObjPreference         = listItem.Cast <dhAppPreference>().SingleOrDefault();
                    GlobalObjPreference.IUpdate = 1;
                    // GlobalObjPreference.ImgCompanyLogo =(byte[])dt.Rows[0]["imgCompanyLogo"];
                    GlobalObjPreference.ImgCompanyLogo = !string.IsNullOrEmpty(dt.Rows[0]["imgCompanyLogo"].ToString()) ? (byte[])dt.Rows[0]["imgCompanyLogo"] : null;
                    GlobalObjPreference.VCompanyName   = !string.IsNullOrEmpty(dt.Rows[0]["vCompanyName"].ToString()) ? dt.Rows[0]["VCompanyName"].ToString() : null;
                    GlobalObjPreference.VHeaderAdress  = !string.IsNullOrEmpty(dt.Rows[0]["vHeaderAdress"].ToString()) ? dt.Rows[0]["vHeaderAdress"].ToString() : null;
                    GlobalObjPreference.VCompanyMobile = !string.IsNullOrEmpty(dt.Rows[0]["vCompanyMobile"].ToString()) ? dt.Rows[0]["vCompanyMobile"].ToString() : null;
                    //    VSaleType.SelectedItem = GlobalObjPreference.VSaleType;

                    this.DataContext = GlobalObjPreference;
                    cstmUtilities.LoadImage(GlobalObjPreference.ImgCompanyLogo, image1);
                    //VSaleType.SelectedValue = GlobalObjPreference.VSaleType;
                    //Globalized.ObjPrefernce = GlobalObjPreference;
                }
            }
            else
            {
                GlobalObjPreference.IUpdate = 0;
                GlobalObjPreference         = new dhAppPreference();
                this.DataContext            = GlobalObjPreference;
            }
            Globalized.ShowMsg(lblErrorMsg);

            //Globalized.SetMsg(null);
        }
Пример #2
0
        //private void ListViewMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        //{
        //    UserControl usc = null;
        //    GridMain.Children.Clear();

        //    switch (((ListViewItem)((ListView)sender).SelectedItem).Name)
        //    {
        //        case "ItemHome":
        //            usc = new PartyView();
        //            GridMain.Children.Add(usc);
        //            break;
        //        case "ItemCreate":
        //            usc = new PartyView();
        //            GridMain.Children.Add(usc);
        //            break;
        //        default:
        //            break;
        //    }
        //}
        private void LoadComponent()
        {
            dhDBnames objDBNames = new dhDBnames();

            objDBNames.ServerName      = System.Configuration.ConfigurationManager.AppSettings["ServerName"].ToString();
            objDBNames.Default_DB_Name = System.Configuration.ConfigurationManager.AppSettings["DBName"].ToString();
            objDBNames.DBUser          = System.Configuration.ConfigurationManager.AppSettings["DBUser"].ToString();
            objDBNames.DBPassword      = System.Configuration.ConfigurationManager.AppSettings["DBPassword"].ToString();
            string path = AppDomain.CurrentDomain.BaseDirectory;//System.Reflection.Assembly.GetExecutingAssembly().Location;

            objDBNames.XmlFilePath = path + "XMLFiles\\" + System.Configuration.ConfigurationManager.AppSettings["DBXmlFilePath"].ToString();
            Globalized.ObjDbName   = objDBNames;

            if (Globalized.objAppPreference == null)
            {
                dsGeneral.dtAppPreferenceDataTable     dtApp    = iFacede.GetAppPreference(Globalized.ObjDbName, objAppPreference);
                ObservableCollection <dhAppPreference> sequence = ReflectionUtility.DataTableToObservableCollection <dhAppPreference>(dtApp);
                if (sequence.Count > 0)
                {
                    objAppPreference = sequence[0];
                    //objAppPreference.ImgCompanyLogo = (System.Byte[])dtApp.Rows[0]["ImgCompanyLogo"];
                    objAppPreference.VEnableModules = string.IsNullOrEmpty(dtApp.Rows[0]["vEnableModules"].ToString()) ? "" : dtApp.Rows[0]["vEnableModules"].ToString();
                    objAppPreference.ImgCompanyLogo = !string.IsNullOrEmpty(dtApp.Rows[0]["imgCompanyLogo"].ToString()) ? (byte[])dtApp.Rows[0]["imgCompanyLogo"] : null;
                    objAppPreference.VCompanyName   = !string.IsNullOrEmpty(dtApp.Rows[0]["vCompanyName"].ToString()) ? dtApp.Rows[0]["VCompanyName"].ToString() : null;
                    Globalized.objAppPreference     = objAppPreference;
                    // cstmUtilities.LoadImage(Globalized.objAppPreference.ImgCompanyLogo, Image1);

                    //  this.AppName.Text = String.IsNullOrEmpty(Globalized.objAppPreference.VApplicationName) ? "POS" : Globalized.objAppPreference.VApplicationName;
                    this.CompanyName.Text = String.IsNullOrEmpty(Globalized.objAppPreference.VCompanyName) ? "ABFA" : Globalized.objAppPreference.VCompanyName;
                    // ModernWindow Obj = (ModernWindow)Application.Current.MainWindow;
                    // Obj.Title = String.IsNullOrEmpty(Globalized.objAppPreference.VApplicationName) ? "POS" : Globalized.objAppPreference.VApplicationName;
                    ////this.lblErrorMsg.Visibility = Visibility.Hidden;
                    ////this.UserName.Text = "";
                    ////this.Password.Password = "";
                    //= sequence;
                }
                else
                {
                    Globalized.SetMsg("Application is Not Initialized Properly please contact support team. ", MsgType.Error);
                    // lblErrorMsg.Visibility = System.Windows.Visibility.Visible;
                    //  Globalized.ShowMsg(lblErrorMsg);
                }
            }
            //byte[] img = (byte[])objAppPreference.ImgCompanyLogo;
            //MemoryStream str = new MemoryStream();
            // str.Write(img, 0, img.Length);
            // BitmapImage  bit = new BitmapImage(str);
            //byte[] objimg = (byte[])objAppPreference.ImgCompanyLogo;
            //imgCompanyLogo.DataContext = ImageFromBytearray(objimg);

            //  byte[] bytImageDataBytes =   objAppPreference.ImgCompanyLogo;
            ////  byte[] bytImageDataBytes = (byte[])objAppPreference.ImgCompanyLogo.;
            //  System.IO.MemoryStream ms = new System.IO.MemoryStream(bytImageDataBytes);
            //  ms.Seek(0, System.IO.SeekOrigin.Begin);
            //  BitmapImage newBitmapImage = new BitmapImage();
            //  newBitmapImage.BeginInit();
            //  newBitmapImage.StreamSource = ms;
            //  newBitmapImage.EndInit();
            //  imgCompanyLogo.Source = newBitmapImage;//ConvertToImage(objAppPreference.ImgCompanyLogo);
        }
Пример #3
0
        public dsGeneral.dtAppPreferenceDataTable GetAppPreference(dhDBnames objDBNames, dhAppPreference objPreference)
        {
            dsGeneral ds       = new dsGeneral();
            DataSet   dsreturn = objDatabase.GetDataSet(objDBNames, objPreference, "xmlGetAppPreference", (DataSet)ds, "dtAppPreference");

            dsGeneral.dtAppPreferenceDataTable retdt = ((dsGeneral)dsreturn).dtAppPreference;
            return(retdt);
        }
Пример #4
0
        public static dsGeneral.dtAppPreferenceDataTable GetAppPreference(dhDBnames objDBNames, dhAppPreference objPreference)
        {
            try
            {
                dsGeneral.dtAppPreferenceDataTable var_ret = null;

                if (objBLAppPreference == null)
                {
                    objBLAppPreference = new blAppPreference();
                }
                {
                    var_ret = objBLAppPreference.GetAppPreference(objDBNames, objPreference);
                }

                return(var_ret);
            }
            catch (Exception ex) { throw ex; }
        }
Пример #5
0
        public static void printDoc(string TemplateName, DataSet ReportDatatables, String ReportName, Boolean ShowPreview = false, string ReportDisc = null)
        {
            //DocumentViewer docview1,
            try
            {
                ReportDocument reportDocument = new ReportDocument();
                StreamReader   reader         = new StreamReader(new FileStream(@"Templates\" + TemplateName, FileMode.Open, FileAccess.Read));
                reportDocument.XamlData      = reader.ReadToEnd();
                reportDocument.XamlImagePath = Path.Combine(Environment.CurrentDirectory, @"Templates\");
                reader.Close();

                ReportData data = new ReportData();
                // Add tables to report Data

                foreach (DataTable DT in ReportDatatables.Tables)
                {
                    //if (DT.Rows.Count < 10)
                    //{
                    //    DataRow abc = null;
                    //    DT.Rows.Add(abc);
                    //    DT.Rows.Add(abc);
                    //    DT.Rows.Add(abc);
                    //    DT.Rows.Add(abc);
                    //}
                    data.DataTables.Add(DT);
                }
                data.ReportDocumentValues.Add("PrintDate", DateTime.Now); // print date is now
                dhAppPreference obj = new dhAppPreference();
                dsGeneral.dtAppPreferenceDataTable dt = iFacede.GetAppPreference(Globalized.ObjDbName, obj);
                data.DataTables.Add(dt);

                DateTime dateTimeStart = DateTime.Now; // start time measure here
                data.ReportDocumentValues.Add("ReportDisc", ReportDisc);
                XpsDocument xps = reportDocument.CreateXpsDocument(data);
                // chek have to show or not
                if (!ShowPreview)
                {
                    PrintDialog dlg = new PrintDialog();
                    dlg.PrintDocument(xps.GetFixedDocumentSequence().DocumentPaginator, ReportName);
                }
                else
                {
                    PrintPreview objPre = new PrintPreview();
                    objPre.docview1.Document = xps.GetFixedDocumentSequence();
                    Window window = new Window
                    {
                        Title   = "Print Preview",
                        Content = objPre,
                        Height  = 800, // just added to have a smaller control (Window)
                        Width   = 750
                    };

                    window.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                // show exception
                MessageBox.Show(ex.Message + "\r\n\r\n" + ex.GetType() + "\r\n" + ex.StackTrace, ex.GetType().ToString(), MessageBoxButton.OK, MessageBoxImage.Stop);
            }
        }
Пример #6
0
 internal dsGeneral.dtAppPreferenceDataTable GetAppPreference(dhDBnames objDBNames, dhAppPreference objPreference)
 {
     dsGeneral.dtAppPreferenceDataTable dt = objDALGeneral.GetAppPreference(objDBNames, objPreference);
     return(dt);
 }