public static void Load()
        {
            try
            {
                if (File.Exists(GetSettingsFilePath()))
                {
                    SettingsInfo settingsInfo;

                    var xmlSerializer = new XmlSerializer(typeof(SettingsInfo));
                    //var xmlSerializer = new XmlSerializer(typeof(ExporterTemplate));

                    using (var fileStream = new FileStream(GetSettingsFilePath(), FileMode.Open))
                    {
                        settingsInfo = (SettingsInfo)xmlSerializer.Deserialize(fileStream);
                    }

                    Current = settingsInfo;

                    // Set the setting changed to false after loading them from a file...
                    Current.SettingsChanged = false;
                }
                else
                {
                    Current = new SettingsInfo();
                }
            }
            catch (Exception exc)
            {
                logger.Error(string.Format(Strings.EventExceptionOccurredFormated, exc.TargetSite, exc.Message));
                Current = new SettingsInfo();
            }
        }
Ejemplo n.º 2
0
        internal static Boolean UpdateSettingPostStatus(string connString, SettingsInfo setting)
        {
            List <KeyValuePair <String, Object> > parameters = getSQLParametersPostStatus(setting);
            DataTable dataTable = SQLExtension.GetDataTableFromStoredProcedure(connString: connString, storedProcedureName: "[qwi].[AB.UpdateSettingPostStatus]", parameters: parameters);

            return(!StatusExtension.HasError);
        }
Ejemplo n.º 3
0
        public VirtualBoyee(CoreLoadParameters <NymaSettings, NymaSyncSettings> lp)
            : base(lp.Comm, VSystemID.Raw.VB, "VirtualBoy Controller", lp.Settings, lp.SyncSettings)
        {
            DoInit <LibNymaCore>(lp, "vb.wbx");

            _cachedSettingsInfo ??= SettingsInfo.Clone();
        }
Ejemplo n.º 4
0
 internal static void UpdateXElement(this XElement element, SettingsInfo settings, XNamespace ns)
 {
     element.Attribute("ID").Value = settings.Id.ToString();
     element.Attribute("processorRef").Value = settings.Processor.Id.ToString();
     element.Element(ns + "name").Value = settings.Name;
     element.Element(ns + "serialPortSettings").UpdateXElement(settings.SerialPortSettings, ns);
 }
Ejemplo n.º 5
0
        //internal static Boolean UpdateSupplierByBusinessCardsSent(String connString, List<BusinessCardInfo> cards)
        //{
        //    Boolean success = false;
        //    foreach (BusinessCardInfo card in cards)
        //    {
        //        List<KeyValuePair<String, Object>> parameters = getSQLParameters(card, true);
        //        DataTable dataTable = SQLExtension.GetDataTableFromStoredProcedure(connString: connString, storedProcedureName: "[qwi].[AB.UpdateBusinessCard]", parameters: parameters);
        //        card.Result = dataTable.SerializeFirst<SQLResultStatusInfo>();
        //        success = !StatusExtension.HasError;
        //    }
        //    return success;
        //}
        //private static List<KeyValuePair<String, Object>> getSQLParametersSent(BusinessCardInfo card)
        //{
        //    List<KeyValuePair<String, Object>> parameters = new List<KeyValuePair<String, Object>>() {
        //        new KeyValuePair<String, Object>("@CompanyName",card.CompanyName),
        //        new KeyValuePair<String, Object>("@ConnectDate",card.ConnectedDate),
        //        new KeyValuePair<String, Object>("@ContactName",card.ContactName),
        //        new KeyValuePair<String, Object>("@Account",card.Account),
        //        new KeyValuePair<String, Object>("@ConnectStatus",card.ConnectStatus),
        //        new KeyValuePair<String, Object>("@InteractionStatus",card.InteractionStatus)
        //    };
        //    return parameters;
        //}

        internal static DataTable UpdateSetting(string connString, SettingsInfo setting)
        {
            List <KeyValuePair <String, Object> > parameters = getSQLParameters(setting);
            DataTable dataTable = SQLExtension.GetDataTableFromStoredProcedure(connString: connString, storedProcedureName: "[qwi].[AB.UpdateSetting]", parameters: parameters);

            return(dataTable);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Function to insert values to Settings Table
 /// </summary>
 /// <param name="settingsinfo"></param>
 public void SettingsAdd(SettingsInfo settingsinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("SettingsAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@settingsId", SqlDbType.Decimal);
         sprmparam.Value = settingsinfo.SettingsId;
         sprmparam       = sccmd.Parameters.Add("@settingsName", SqlDbType.VarChar);
         sprmparam.Value = settingsinfo.SettingsName;
         sprmparam       = sccmd.Parameters.Add("@status", SqlDbType.VarChar);
         sprmparam.Value = settingsinfo.Status;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.VarChar);
         sprmparam.Value = settingsinfo.ExtraDate;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = settingsinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = settingsinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         //MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Ejemplo n.º 7
0
        private frmSettings()
        {
            this._settingsInfo = null;
            this._model        = null;

            InitializeComponent();
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Function to set the calculation method by checking the settings
 /// </summary>
 public void CalculationMethod()
 {
     try
     {
         SettingsInfo InfoSettings = new SettingsInfo();
         SettingsSP   SpSettings   = new SettingsSP();
         //--------------- Selection Of Calculation Method According To Settings ------------------//
         if (SpSettings.SettingsStatusCheck("StockValueCalculationMethod") == "FIFO")
         {
             calculationMethod = "FIFO";
         }
         else if (SpSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Average Cost")
         {
             calculationMethod = "Average Cost";
         }
         else if (SpSettings.SettingsStatusCheck("StockValueCalculationMethod") == "High Cost")
         {
             calculationMethod = "High Cost";
         }
         else if (SpSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Low Cost")
         {
             calculationMethod = "Low Cost";
         }
         else if (SpSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Last Purchase Rate")
         {
             calculationMethod = "Last Purchase Rate";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("AGWREP17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 9
0
        public void WriteToExcel(string info, SettingsInfo settingsInfo, DownloadedPartOfPageSettingInfo downloadedPart)
        {
            if (writingPath != null)
            {
                Directory.CreateDirectory(writingPath);
            }
            var file = new FileInfo($"{writingPath}{settingsInfo.NameOfFileToWriteInfo}");

            using (var excelPackage = new ExcelPackage(file))
            {
                if (file.Exists)
                {
                    excelPackage.File.Attributes = FileAttributes.Normal;
                }

                ExcelWorksheet workSheet;
                InitializeWorkSheet(excelPackage, out workSheet);
                InstallCurrentWritingPositionIfIsNull(downloadedPart, settingsInfo, workSheet);
                workSheet.Cells[downloadedPart.CurrentWritingPosition.Row, downloadedPart.CurrentWritingPosition.Column].Value = info;
                if (settingsInfo.HorizontalOrientationOfWritingInfo)
                {
                    downloadedPart.CurrentWritingPosition.Column += settingsInfo.BetweenLineDistance;
                }
                else
                {
                    downloadedPart.CurrentWritingPosition.Row += settingsInfo.BetweenLineDistance;
                }
                excelPackage.Save();
                excelPackage.File.Attributes = FileAttributes.ReadOnly;
            }
        }
Ejemplo n.º 10
0
    // public Transform joystickPosition;
    // public Transform fireActButtonPosition;

    public SettingsData(SettingsInfo settingsInfo)
    {
        musicOn   = settingsInfo.musicOn;
        effectsOn = settingsInfo.effectsOn;
        // joystickPosition = settingsInfo.joystickPosition;
        // fireActButtonPosition = settingsInfo.fireActButtonPosition;
    }
Ejemplo n.º 11
0
        internal static Boolean UpdateSettingStatus(String connString, SettingsInfo setting, String errorMessage)
        {
            List <KeyValuePair <String, Object> > parameters = getSQLParameters(setting, errorMessage);
            DataTable dataTable = SQLExtension.GetDataTableFromStoredProcedure(connString: connString, storedProcedureName: "[qwi].[AB.UpdateSettingStatus]", parameters: parameters);

            return(dataTable.SerializeFirst <SQLResultStatusInfo>().Code == "S");
        }
Ejemplo n.º 12
0
        public SettingsInfo ReadSettingsFile(string fileSettingsPath)
        {
            if (string.IsNullOrWhiteSpace(fileSettingsPath))
            {
                throw new ArgumentNullException(nameof(fileSettingsPath), $"The parameter {nameof(fileSettingsPath)} can't be null/white/white space");
            }

            if (!ExistsSettingsFile(fileSettingsPath))
            {
                throw new InvalidOperationException($"No exists a IsolateStorage settings file {fileSettingsPath} in your IsolateStorage");
            }

            var result = new SettingsInfo();

            var isolatedStorage = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null);

            using (IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream(fileSettingsPath, FileMode.Open, isolatedStorage))
            {
                using (StreamReader reader = new StreamReader(isoStream))
                {
                    string fileContent = reader.ReadToEnd();

                    var parts = fileContent.Split(';');

                    result.ServiceAddress = parts[0];
                    result.SecondsVisibilityBallonTime     = int.Parse(parts[1]);
                    result.ShowBallonWithNotificationsOpen = bool.Parse(parts[2]);
                }
            }

            isolatedStorage.Dispose();

            return(result);
        }
 /// <summary>
 /// Resets the card payment info.
 /// </summary>
 private void ResetCardPaymentInfo()
 {
     this.merchantProperties   = null;
     this.paymentConnectorName = null;
     this.terminalSettings     = null;
     this.timeoutTask          = null;
 }
Ejemplo n.º 14
0
 public void SettingsEdit(SettingsInfo settingsinfo)
 {
     try
     {
         if (base.sqlcon.State == ConnectionState.Closed)
         {
             base.sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("SettingsEdit", base.sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam3 = new SqlParameter();
         sprmparam3       = sccmd.Parameters.Add("@settingsId", SqlDbType.Decimal);
         sprmparam3.Value = settingsinfo.SettingsId;
         sprmparam3       = sccmd.Parameters.Add("@status", SqlDbType.VarChar);
         sprmparam3.Value = settingsinfo.Status;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         base.sqlcon.Close();
     }
 }
Ejemplo n.º 15
0
 internal static void UpdateXElement(this XElement element, SettingsInfo settings, XNamespace ns)
 {
     element.Attribute("ID").Value           = settings.Id.ToString();
     element.Attribute("processorRef").Value = settings.Processor.Id.ToString();
     element.Element(ns + "name").Value      = settings.Name;
     element.Element(ns + "serialPortSettings").UpdateXElement(settings.SerialPortSettings, ns);
 }
        protected override object ReadObject <T>(ES3Reader reader)
        {
            var instance = new SettingsInfo();

            ReadObject <T>(reader, instance);
            return(instance);
        }
Ejemplo n.º 17
0
        public TurboNyma(CoreLoadParameters <NymaSettings, NymaSyncSettings> lp)
            : base(lp.Comm, VSystemID.Raw.PCE, "PC Engine Controller", lp.Settings, lp.SyncSettings)
        {
            var firmwares = new Dictionary <string, FirmwareID>();

            if (lp.Discs.Count > 0)
            {
                _hasCds = true;
                var ids = lp.Discs.Select(dg => dg.DiscType).ToList();
                if (ids.Contains(DiscType.TurboCD))
                {
                    firmwares.Add("FIRMWARE:syscard3.pce", new("PCECD", "Bios"));
                }
                if (ids.Contains(DiscType.TurboGECD))
                {
                    firmwares.Add("FIRMWARE:gecard.pce", new("PCECD", "GE-Bios"));
                }
            }
            else if (lp.Roms.Count == 1)
            {
                if (lp.Game["BRAM"])
                {
                    SettingOverrides["pce.disable_bram_hucard"].Default = "0";
                }
            }

            _turboNyma = DoInit <LibTurboNyma>(lp, "turbo.wbx", firmwares);

            _cachedSettingsInfo ??= SettingsInfo.Clone();
        }
Ejemplo n.º 18
0
        public void UpdateSettings(SettingsInfo settingsInfo)
        {
            try
            {
                var p = Settings.First(n => n.Name == settingsInfo.Name);
                if (p != null && p.Id != settingsInfo.Id)
                {
                    throw new SettingsException(Resources.SettingsNameAlreadyExists);
                }

                XDocument  doc      = xmlFileManager.Open();
                XNamespace ns       = doc.Root.GetDefaultNamespace();
                var        elements = doc.Element(ns + "settings").Element(ns + "usersRecords").Elements(ns + "record");
                var        element  = elements.Where(x => Convert.ToInt32(x.Attribute("ID").Value, 10) == settingsInfo.Id).First();
                element.UpdateXElement(settingsInfo, ns);
                xmlFileManager.Save(doc);
            }
            catch (SettingsException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new SettingsException(Resources.IncorrectFileWithSettings, ex);
            }
        }
Ejemplo n.º 19
0
        public void ManualSetup()
        {
            _IOService.Introduction();

            _settings = new SettingsInfo();

            _settings.DeleteExes   = true;
            _settings.Paths        = new HashSet <PathInfo>();
            _settings.DeleteFolder = _IOService.YesOrNoInput(IOHandlingService.FolderDelOrNot);
            _settings.SendToBin    = _IOService.YesOrNoInput(IOHandlingService.BinOrNot);

            _settings.GlobalLifeSpan = _IOService.LifeSpanInput();

            var path = new PathInfo
            {
                Path     = _IOService.PathInput(),
                LifeSpan = _settings.GlobalLifeSpan
            };

            _settings.Paths.Add(path);

            _folders = _settings.Paths?.ToList();

            _IOService.SuccessConfirmer();
        }
Ejemplo n.º 20
0
        public void AddNewSettings(SettingsInfo settingsInfo)
        {
            try
            {
                XDocument  doc = xmlFileManager.Open();
                XNamespace ns  = doc.Root.GetDefaultNamespace();

                if (settingsInfo == null)
                {
                    throw new ArgumentNullException("settingsInfo");
                }

                settingsInfo.Id = Settings.Select(n => n.Id).Max() + 1;

                doc.Element(ns + "settings").Element(ns + "usersRecords").Add(new XElement(ns + "record",
                                                                                           new XAttribute("ID", settingsInfo.Id),
                                                                                           new XAttribute("processorRef", settingsInfo.Processor.Id),
                                                                                           new XElement(ns + "name", settingsInfo.Name),
                                                                                           settingsInfo.SerialPortSettings.ToXElement(ns)));

                xmlFileManager.Save(doc);
            }
            catch (SettingsException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new SettingsException(Resources.IncorrectFileWithSettings, ex);
            }
        }
Ejemplo n.º 21
0
        public bool CheckGroupURL(int PortalId, int ModuleId, string VanityName, int ForumGroupId)
        {
            try
            {
                SettingsInfo _mainSettings = DataCache.MainSettings(ModuleId);
                if (!(string.IsNullOrEmpty(_mainSettings.PrefixURLBase)))
                {
                    VanityName = _mainSettings.PrefixURLBase + "/" + VanityName;
                }
                int tmpForumGroupId = -1;
                tmpForumGroupId = Convert.ToInt32(SqlHelper.ExecuteScalar(_connectionString, dbPrefix + "URL_CheckGroupVanity", PortalId, VanityName));
                if (tmpForumGroupId > 0 && ForumGroupId == -1)
                {
                    return(false);
                }
                else if (tmpForumGroupId == ForumGroupId && ForumGroupId > 0)
                {
                    return(true);
                }
                else if (tmpForumGroupId <= 0)
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }

            return(false);
        }
Ejemplo n.º 22
0
            /// <summary>
            /// Construct the Payment Device class and open the connection from it.
            /// </summary>
            /// <param name="peripheralName">Name of peripheral device.</param>
            /// <param name="terminalSettings">The terminal settings for the peripheral device.</param>
            /// <param name="deviceConfig">Device Configuration parameters.</param>
            /// <returns>A task that can be awaited until the connection is opened.</returns>
            public Task OpenAsync(string peripheralName, SettingsInfo terminalSettings, IDictionary <string, string> deviceConfig)
            {
                this.paymentDevice    = new HydraPaymentDevice();
                this.terminalSettings = terminalSettings;

                return(this.paymentDevice.OpenAsync());
            }
Ejemplo n.º 23
0
        public NeoGeoPort(CoreComm comm, byte[] rom, GameInfo game,
                          NymaSettings settings, NymaSyncSettings syncSettings, bool deterministic, string extension)
            : base(comm, VSystemID.Raw.NGP, "NeoGeo Portable Controller", settings, syncSettings)
        {
            _neopop = DoInit <LibNeoGeoPort>(game, rom, null, "ngp.wbx", extension, deterministic);

            _cachedSettingsInfo ??= SettingsInfo.Clone();
        }
Ejemplo n.º 24
0
 public static void InitDefault()
 {
     // Init new Settings with default data
     Current = new SettingsInfo
     {
         SettingsChanged = true
     };
 }
Ejemplo n.º 25
0
        static void getSettings(WebResponse response)
        {
            SettingsInfo info = new SettingsInfo();

            // Read the current graphics flags
            info.lensFlares           = Scripting.GetUserSetting("Graphics/Enable Lensflares", false);
            info.volumetricScattering = Scripting.GetUserSetting("Graphics/Enable Volumetric Scattering", true);
            info.bloom       = Scripting.GetUserSetting("Graphics/Enable Bloom", true);
            info.afterImage  = Scripting.GetUserSetting("Graphics/Enable AfterImage", true);
            info.tonemapping = Scripting.GetUserSetting("Graphics/Enable Tonemapping", true);
            info.noise       = Scripting.GetUserSetting("Graphics/Enable Noise", false);
            info.shadows     = Scripting.GetUserSetting("Graphics/Enable Shadows", true);
            info.ssao        = Scripting.GetUserSetting("Graphics/Enable SSAO", true);
            info.fog         = Scripting.GetUserSetting("Graphics/Enable Fog", true);
            info.fxaa        = Scripting.GetUserSetting("Graphics/Enable FXAA", true);

            // Currently, only the main screen can be set for fullscreen mode.
            info.fullscreen = Scripting.GetUserSettingString("WindowManager/Fullscreen", "-1") != "-1";

            // Read the supported video modes
            List <string> modes = Rendering.GetSupportedVideoModes();

            modes.Insert(0, "Native Resolution");

            info.resolution = Scripting.GetUserSettingString("WindowManager/Resolution", "-1x-1");

            if (info.resolution == "-1x-1")
            {
                info.resolution = "Native Resolution";
            }

            info.supportedModes = modes.Distinct().ToArray();

            double lod = (Scripting.GetUserSettingNumber("Graphics/Lod Falloff", 40.0) - 10.0) / 30.0;

            lod += Scripting.GetUserSettingNumber("Graphics/Min Lod Range", 0.0) / 30.0;

            if (lod < 0)
            {
                lod = 0;
            }
            if (lod > 2)
            {
                lod = 2;
            }

            info.lod = lod;

            // Serialize to json to be read by the gui
            StringWriter   writer     = new StringWriter();
            JsonSerializer json       = new JsonSerializer();
            JsonTextWriter jsonWriter = new JsonTextWriter(writer);

            json.Formatting = Formatting.Indented;
            json.Serialize(jsonWriter, info);
            response.AddHeader("Content-Type", "application/json");
            response.AppendBody(writer.GetStringBuilder().ToString());
        }
Ejemplo n.º 26
0
        public void WriteSettings(SettingsInfo settingsInfo)
        {
            if (settingsInfo == null)
            {
                throw new ArgumentNullException(nameof(settingsInfo), $"The parameter {nameof(settingsInfo)} can't be null");
            }

            fileSettingsManager.WriteSettingsFile(SettingsGlobalData.PathFileSettingsName, settingsInfo);
        }
Ejemplo n.º 27
0
        public static List <SettingsInfo> GetList_Settings(string OrganizationCode, bool IsActive)
        {
            using (DBHelper dbhlper = new DBHelper("[spSettingsGet]"))
            {
                DBHelper.AddPparameter("@OrganizationCode", OrganizationCode);

                using (DataSet ds = DBHelper.Execute_Query())
                {
                    if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                    {
                        List <SettingsInfo> list = new List <SettingsInfo>();
                        SettingsInfo        obj  = null;

                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            obj = new SettingsInfo();
                            obj.OrganizationCode                 = dr["OrganizationCode"].ToString();
                            obj.OrganizationName                 = dr["OrganizationName"].ToString();
                            obj.an_AlertText_GSTDate             = dr["an_AlertText_GSTDate"].ToString();
                            obj.an_AlertText_PaidMembership      = dr["an_AlertText_PaidMembership"].ToString();
                            obj.an_isAllowedAlert_GSTDate        = dr["an_isAllowedAlert_GSTDate"].ToString().Trim().ToUpper() == "Y";
                            obj.an_isAllowedAlert_PaidMembership = dr["an_isAllowedAlert_PaidMembership"].ToString().Trim().ToUpper() == "Y";
                            obj.c_isAllowedMultyLanguage         = dr["c_isAllowedMultyLanguage"].ToString().Trim().ToUpper() == "Y";
                            obj.mc_CurrencyList          = dr["mc_CurrencyList"].ToString();
                            obj.mc_isAllowedMutyCurrency = dr["mc_isAllowedMutyCurrency"].ToString().Trim().ToUpper() == "Y";
                            obj.p_BankAccountHolder      = dr["p_BankAccountHolder"].ToString();
                            obj.p_BankAccountIBankName   = dr["p_BankAccountIBankName"].ToString();
                            obj.p_BankAccountIBranchName = dr["p_BankAccountIBranchName"].ToString();
                            obj.p_BankAccountIFSCCode    = dr["p_BankAccountIFSCCode"].ToString();
                            obj.p_BankAccountIMCRCode    = dr["p_BankAccountIMCRCode"].ToString();
                            obj.p_BankAccountNumber      = dr["p_BankAccountNumber"].ToString();
                            obj.p_isAllowedOnlinePayment = dr["p_isAllowedOnlinePayment"].ToString().Trim().ToUpper() == "Y";
                            obj.p_PaypalAccountID        = dr["p_PaypalAccountID"].ToString();

                            obj.c_CompanyName  = dr["CompanyName"].ToString();
                            obj.c_Email        = dr["Email"].ToString();
                            obj.c_Mobile       = dr["Mobile"].ToString();
                            obj.c_Address      = dr["Address"].ToString();
                            obj.c_City         = dr["City"].ToString();
                            obj.c_State        = dr["State"].ToString();
                            obj.c_Country      = dr["Country"].ToString();
                            obj.c_Website      = dr["Website"].ToString();
                            obj.c_CIN          = dr["CIN"].ToString();
                            obj.c_PAN          = dr["PAN"].ToString();
                            obj.c_DefaultEmail = dr["DefaultEmail"].ToString();
                            obj.c_SMTP         = dr["SMTP"].ToString();

                            list.Add(obj);
                        }

                        return(list);
                    }
                }
            }

            return(null);
        }
Ejemplo n.º 28
0
        private static List <KeyValuePair <String, Object> > getSQLParameters(SettingsInfo setting)
        {
            List <KeyValuePair <String, Object> > parameters = new List <KeyValuePair <String, Object> >()
            {
                new KeyValuePair <String, Object>("@Email", setting.Email)
            };

            return(parameters);
        }
        public ActionResult Save_Settings(string an_AlertText_GSTDate, string an_AlertText_PaidMembership, string an_isAllowedAlert_GSTDate, string an_isAllowedAlert_PaidMembership,
                                          string c_isAllowedMultyLanguage, string InfoType, string mc_CurrencyList, string mc_isAllowedMutyCurrency,
                                          string OrganizationCode, string p_BankAccountHolder, string p_BankAccountIBankName,
                                          string p_BankAccountIBranchName, string p_BankAccountIFSCCode, string p_BankAccountIMCRCode, string p_BankAccountNumber,
                                          string p_isAllowedOnlinePayment, string p_PaypalAccountID,
                                          string CompanyName, string Email, string Mobile, string Address, string City, string State, string Country,
                                          string Website, string CIN, string PAN, string DefaultEmail, string SMTP)
        {
            if (Session["UserDetails"] != null && ((UserInfo)Session["UserDetails"]).UserType.ToString().Trim().ToUpper() == "R" && ((UserInfo)Session["UserDetails"]).OrganizationCode != null)
            {
                OrganizationCode = ((UserInfo)Session["UserDetails"]).OrganizationCode.Trim();
            }

            using (Master_Svc.MasterServiceClient iGstSvc = new Master_Svc.MasterServiceClient())
            {
                SettingsInfo objSettings = new SettingsInfo();

                objSettings.an_AlertText_GSTDate             = an_AlertText_GSTDate;
                objSettings.an_AlertText_PaidMembership      = an_AlertText_PaidMembership;
                objSettings.an_isAllowedAlert_GSTDate        = an_isAllowedAlert_GSTDate.Trim().ToUpper() == "Y";
                objSettings.an_isAllowedAlert_PaidMembership = an_isAllowedAlert_PaidMembership.Trim().ToUpper() == "Y";
                objSettings.c_isAllowedMultyLanguage         = c_isAllowedMultyLanguage.Trim().ToUpper() == "Y";
                objSettings.InfoType                 = InfoType;
                objSettings.mc_CurrencyList          = mc_CurrencyList;
                objSettings.mc_isAllowedMutyCurrency = mc_isAllowedMutyCurrency.Trim().ToUpper() == "Y";
                objSettings.OrganizationCode         = OrganizationCode;
                objSettings.p_BankAccountHolder      = p_BankAccountHolder;
                objSettings.p_BankAccountIBankName   = p_BankAccountIBankName;
                objSettings.p_BankAccountIBranchName = p_BankAccountIBranchName;
                objSettings.p_BankAccountIFSCCode    = p_BankAccountIFSCCode;
                objSettings.p_BankAccountIMCRCode    = p_BankAccountIMCRCode;
                objSettings.p_BankAccountNumber      = p_BankAccountNumber;
                objSettings.p_isAllowedOnlinePayment = p_isAllowedOnlinePayment.Trim().ToUpper() == "Y";
                objSettings.p_PaypalAccountID        = p_PaypalAccountID;

                objSettings.c_CompanyName  = CompanyName;
                objSettings.c_Email        = Email;
                objSettings.c_Mobile       = Mobile;
                objSettings.c_Address      = Address;
                objSettings.c_City         = City;
                objSettings.c_State        = State;
                objSettings.c_Country      = Country;
                objSettings.c_Website      = Website;
                objSettings.c_SMTP         = SMTP;
                objSettings.c_CIN          = CIN;
                objSettings.c_PAN          = PAN;
                objSettings.c_DefaultEmail = DefaultEmail;
                objSettings.c_SMTP         = SMTP;

                if (iGstSvc.Save_Settings(false, objSettings, ((UserInfo)Session["UserDetails"]), out ErrorMessage))
                {
                    return(Json("Ok", JsonRequestBehavior.AllowGet));
                }
            }

            return(Json(ErrorMessage, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 30
0
    void Start()
    {
        settingsInfo = GameObject.Find("SettingsHandler").GetComponent <SettingsInfo>();
        audioManager = FindObjectOfType <AudioManager>();
        musicOn      = true;
        effectsOn    = true;

        settingsInfo.effectsOn = effectsOn;
    }
        /// <summary>
        /// Initialize settings.
        /// </summary>
        /// <param name="paymentConnectorName">The payment connector name.</param>
        /// <param name="merchantPaymentPropertiesXml">The merchant properties.</param>
        /// <param name="terminalSettings">The terminal settings.</param>
        private void InitializeSettings(string paymentConnectorName, string merchantPaymentPropertiesXml, SettingsInfo terminalSettings)
        {
            this.terminalSettings     = terminalSettings;
            this.paymentConnectorName = paymentConnectorName;

            // Convert the connector properties to local
            this.merchantProperties = !string.IsNullOrWhiteSpace(merchantPaymentPropertiesXml)
                ? PaySdk.PaymentProperty.ConvertXMLToPropertyArray(merchantPaymentPropertiesXml)
                : null;
        }
Ejemplo n.º 32
0
        public AttackManipulator(Map map)
            : base(map)
        {
            _plans = new List<AttackPlan>();
            Settings = new SettingsInfo();

            map.EventPublisher.TargetAdded += EventPublisherOnTargetAdded;
            map.EventPublisher.TargetUpdated += EventPublisherOnTargetUpdated;
            map.EventPublisher.TargetSelected += EventPublisherOnTargetSelected;
            map.EventPublisher.TargetRemoved += EventPublisherOnTargetRemoved;
        }
Ejemplo n.º 33
0
        public void SettingsInfoToString()
        {
            SettingsInfo si = new SettingsInfo(0, "Name",
                new Processor(0, "Name", 0x1000, 0x40000, 0x3E000, 0x3FFFF),
                new SerialPortSettings(BaudRate.BR_57600, Parity.Even, StopBits.One, 0xA0, 0xA5));

            Console.WriteLine(si.ToString());
            Console.WriteLine(si.ToString("LOG", null));

            SelectedSettings ss = new SelectedSettings(MemoryType.FLASH, si);

            Console.WriteLine(ss.ToString());
            Console.WriteLine(ss.ToString("LOG", null));
        }
        public void ToSettingsInfo()
        {
            XDocument doc = XDocument.Load(Directory.GetCurrentDirectory() + "\\Settings\\TestSettings.xml");
            var ns = doc.Root.GetDefaultNamespace();
            var settings = doc.Element(ns + "settings").ToSettingsInfo(ns).ToList();

            Assert.AreEqual(2, settings.Count);

            SettingsInfo si1 = new SettingsInfo(0, "ОПС24Н-1 КО",
                new Processor(0, "ATMega2560", 0x1000, 0x40000, 0x3E000, 0x3FFFF),
                new SerialPortSettings(BaudRate.BR_57600, Parity.Odd, StopBits.One, 0xAA, 0xA5));

            SettingsInfo si2 = new SettingsInfo(1, "ОПС24Н-1 УУТПЛ",
                new Processor(1, "ATMega128", 0x1000, 0x20000, 0x1E000, 0x1FFFF),
                new SerialPortSettings(BaudRate.BR_57600, Parity.Odd, StopBits.One, 0xCA, 0xC5));

            Assert.IsTrue(settings[0].Equals(si1));
            Assert.IsTrue(settings[1].Equals(si2));
        }
Ejemplo n.º 35
0
        public void Create()
        {
            SettingsInfo s1 = new SettingsInfo(0, "Name",
                new Processor(0, "Name", 0x1000, 0x40000, 0x3E000, 0x3FFFF),
                new SerialPortSettings(BaudRate.BR_57600, Parity.Even, StopBits.One, 0xA0, 0xA5));

            SettingsInfo s2 = new SettingsInfo(0, "Name",
                new Processor(0, "Name", 0x1000, 0x40000, 0x3E000, 0x3FFFF),
                new SerialPortSettings(BaudRate.BR_57600, Parity.Even, StopBits.One, 0xA0, 0xA5));

            Assert.AreEqual("Name", s1.ToString());
            Assert.AreEqual("Name", s2.ToString());
            Assert.IsTrue(s1.Equals(s2));

            s2.Name = "NewName";

            Assert.AreEqual("NewName", s2.ToString());
            Assert.IsFalse(s1.Equals(s2));
        }
        public void UpdateXElement()
        {
            SettingsInfo si = new SettingsInfo(1, "ОПС24Н-1 КО",
                new Processor(1, "ATMega128", 0x1000, 0x20000, 0x1E000, 0x1FFFF),
                new SerialPortSettings(BaudRate.BR_38400, Parity.Odd, StopBits.One, 0x80, 0x85));

            string xElementRecord =
                "<record ID =\"0\" processorRef=\"0\">" + "\r\n  " +
                "<name>ОПС24Н-1 КО</name>" + "\r\n  " +
                "<serialPortSettings>" + "\r\n    " +
                "<baudrate>57600</baudrate>" + "\r\n    " +
                "<parity>1</parity>" + "\r\n    " +
                "<stopbit>1</stopbit>" + "\r\n    " +
                "<headerTx>0xAA</headerTx>" + "\r\n    " +
                "<headerRx>0xA5</headerRx>" + "\r\n  " +
                "</serialPortSettings>" + "\r\n" +
                "</record>";

            XElement xElement = XElement.Parse(xElementRecord);

            xElement.UpdateXElement(si, XNamespace.None);

            string xExpectedElementRecord =
                "<record ID=\"1\" processorRef=\"1\">" + "\r\n  " +
                "<name>ОПС24Н-1 КО</name>" + "\r\n  " +
                "<serialPortSettings>" + "\r\n    " +
                "<baudrate>38400</baudrate>" + "\r\n    " +
                "<parity>1</parity>" + "\r\n    " +
                "<stopbit>1</stopbit>" + "\r\n    " +
                "<headerTx>0x80</headerTx>" + "\r\n    " +
                "<headerRx>0x85</headerRx>" + "\r\n  " +
                "</serialPortSettings>" + "\r\n" +
                "</record>";
            Console.WriteLine(xExpectedElementRecord);
            Console.WriteLine(xElement.ToString());
            Assert.AreEqual(xExpectedElementRecord, xElement.ToString());
        }
Ejemplo n.º 37
0
		public bool MoveSettings(int forumModuleId, int tabModuleId)
		{
			var objModules = new Entities.Modules.ModuleController();
			var currSettings = new SettingsInfo {MainSettings = Settings.GeneralSettings(forumModuleId, "GEN")};

		    objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PageSize, currSettings.PageSize.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.UserNameDisplay, currSettings.UserNameDisplay);
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.ProfileVisibility, ((int)currSettings.ProfileVisibility).ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.EnablePoints, currSettings.EnablePoints.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.TopicPointValue, currSettings.TopicPointValue.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.ReplyPointValue, currSettings.ReplyPointValue.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AnswerPointValue, currSettings.AnswerPointValue.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.MarkAnswerPointValue, currSettings.MarkAsAnswerPointValue.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.ModPointValue, currSettings.ModPointValue.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AvatarHeight, currSettings.AvatarHeight.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AvatarWidth, currSettings.AvatarWidth.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AllowSignatures, currSettings.AllowSignatures.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.ForumTemplateId, currSettings.ForumTemplateID.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.InstallDate, currSettings.InstallDate.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.IsInstalled, currSettings.IsInstalled.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.Theme, currSettings.Theme);
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.FullText, currSettings.FullText.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.MailQueue, currSettings.MailQueue.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.FloodInterval, currSettings.FloodInterval.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.EditInterval, currSettings.EditInterval.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.DeleteBehavior, currSettings.DeleteBehavior.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AddThisAccount, currSettings.AddThisAccount);
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.EnableAutoLink, currSettings.AutoLinkEnabled.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.EnableURLRewriter, currSettings.URLRewriteEnabled.ToString());
			if (string.IsNullOrEmpty(currSettings.PrefixURLBase))
			{
				objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLBase, "forums");
			}
			else
			{
				objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLBase, currSettings.PrefixURLBase);
			}
			if (string.IsNullOrEmpty(currSettings.PrefixURLOther))
			{
				objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLOther, "views");
			}
			else
			{
				objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLOther, currSettings.PrefixURLOther);
			}
			if (string.IsNullOrEmpty(currSettings.PrefixURLTag))
			{
				objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLTags, "tag");
			}
			else
			{
				objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLTags, currSettings.PrefixURLTag);
			}
			if (string.IsNullOrEmpty(currSettings.PrefixURLCategory))
			{
				objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLCategories, "category");
			}
			else
			{
				objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLCategories, currSettings.PrefixURLCategory);
			}

			objModules.UpdateModuleSetting(tabModuleId, "NeedsConvert", "False");
			objModules.UpdateModuleSetting(tabModuleId, "AFINSTALLED", "True");
			DataCache.CacheClear(string.Format(CacheKeys.MainSettings, forumModuleId));

            return false;
		}
Ejemplo n.º 38
0
        public virtual SettingsInfo GetNewSettingsInfo()
        {
            var processor = ListOfProcessors.ElementAt(IndexOfTheSelectedProcessor);
            var serialPortSettings = new SerialPortSettings(ListOfBaudRates.ElementAt(IndexOfTheSelectedBaudRate),
                ListOfParities.ElementAt(IndexOfTheSelectedParity), ListOfStopBits.ElementAt(IndexOfTheSelectedStopBits),
                ListOfAllowableHeaders.ElementAt(IndexOfTheSelectedHeaderTx), ListOfAllowableHeaders.ElementAt(IndexOfTheSelectedHeaderRx));

            var s = new SettingsInfo(0, string.Empty, processor, serialPortSettings);

            return s;
        }
        /// <summary>
        /// Function to fill Datagridview
        /// </summary>
        public void FillGrid()
        {
            try
            {
                if (!isFormLoad)
                {
                    DateValidation objValidation = new DateValidation();
                    objValidation.DateValidationFunction(txtToDate);
                    if (txtToDate.Text == string.Empty)
                        txtToDate.Text = PublicVariables._dtToDate.ToString("dd-MMM-yyyy");
                    Font newFont = new Font(dgvReport.Font, FontStyle.Bold);
                    CurrencyInfo InfoCurrency = new CurrencyInfo();
                    CurrencyBll BllCurrency = new CurrencyBll();
                    InfoCurrency = BllCurrency.CurrencyView(1);
                    int inDecimalPlaces = InfoCurrency.NoOfDecimalPlaces;
                    dgvReport.Rows.Clear();
                    FinancialStatementBll bllFinancialStatement = new FinancialStatementBll();

                   // FinancialStatementSP SpFinance = new FinancialStatementSP();
                    DataSet DsetBalanceSheet = new DataSet();
                    DataTable dtbl = new DataTable();
                    SettingsInfo InfoSettings = new SettingsInfo();
                    SettingsBll BllSettings = new SettingsBll();
                    //--------------- Selection Of Calculation Method According To Settings ------------------//
                    if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "FIFO")
                    {
                        calculationMethod = "FIFO";
                    }
                    else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Average Cost")
                    {
                        calculationMethod = "Average Cost";
                    }
                    else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "High Cost")
                    {
                        calculationMethod = "High Cost";
                    }
                    else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Low Cost")
                    {
                        calculationMethod = "Low Cost";
                    }
                    else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Last Purchase Rate")
                    {
                        calculationMethod = "Last Purchase Rate";
                    }
                    DsetBalanceSheet = bllFinancialStatement.BalanceSheet(PublicVariables._dtFromDate, DateTime.Parse(txtToDate.Text));
                    //------------------- Asset -------------------------------//
                    dtbl = DsetBalanceSheet.Tables[0];
                    foreach (DataRow rw in dtbl.Rows)
                    {
                        dgvReport.Rows.Add();
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtAsset"].Value = rw["Name"].ToString();
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["Amount1"].Value = rw["Balance"].ToString();
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["GroupId1"].Value = rw["ID"].ToString();
                    }
                    decimal dcTotalAsset = 0;
                    if (dtbl.Rows.Count > 0)
                    {
                        dcTotalAsset = decimal.Parse(dtbl.Compute("Sum(Balance)", string.Empty).ToString());
                    }
                    //------------------------ Liability ---------------------//
                    dtbl = new DataTable();
                    dtbl = DsetBalanceSheet.Tables[1];
                    int index = 0;
                    foreach (DataRow rw in dtbl.Rows)
                    {
                        if (index < dgvReport.Rows.Count)
                        {
                            dgvReport.Rows[index].Cells["dgvtxtLiability"].Value = rw["Name"].ToString();
                            dgvReport.Rows[index].Cells["Amount2"].Value = rw["Balance"].ToString();
                            dgvReport.Rows[index].Cells["GroupId2"].Value = rw["ID"].ToString();
                        }
                        else
                        {
                            dgvReport.Rows.Add();
                            dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtLiability"].Value = rw["Name"].ToString();
                            dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["Amount2"].Value = rw["Balance"].ToString();
                            dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["GroupId2"].Value = rw["ID"].ToString();
                        }
                        index++;
                    }
                    decimal dcTotalLiability = 0;
                    if (dtbl.Rows.Count > 0)
                    {
                        dcTotalLiability = decimal.Parse(dtbl.Compute("Sum(Balance)", string.Empty).ToString());
                    }
                    decimal dcClosingStock = bllFinancialStatement.StockValueGetOnDate(Convert.ToDateTime(txtToDate.Text), calculationMethod, false, false);
                    dcClosingStock = Math.Round(dcClosingStock, inDecimalPlaces);
                    //---------------------Opening Stock---------------------------------------------------------------------------------------------------------------
                    decimal dcOpeninggStock = bllFinancialStatement.StockValueGetOnDate(PublicVariables._dtFromDate, calculationMethod, true, true);
                    decimal dcProfit = 0;
                    DataSet dsetProfitAndLoss = new DataSet();
                    dsetProfitAndLoss = bllFinancialStatement.ProfitAndLossAnalysisUpToaDateForBalansheet(PublicVariables._dtFromDate, DateTime.Parse(txtToDate.Text));
                    DataTable dtblProfit = new DataTable();
                    dtblProfit = dsetProfitAndLoss.Tables[0];
                    for (int i = 0; i < dsetProfitAndLoss.Tables.Count; ++i)
                    {
                        dtbl = dsetProfitAndLoss.Tables[i];
                        decimal dcSum = 0;
                        if (i == 0 || (i % 2) == 0)
                        {
                            if (dtbl.Rows.Count > 0)
                            {
                                dcSum = decimal.Parse(dtbl.Compute("Sum(Debit)", string.Empty).ToString());
                                dcProfit = dcProfit - dcSum;
                            }
                        }
                        else
                        {
                            if (dtbl.Rows.Count > 0)
                            {
                                dcSum = decimal.Parse(dtbl.Compute("Sum(Credit)", string.Empty).ToString());
                                dcProfit = dcProfit + dcSum;
                            }
                        }
                    }
                    decimal decCurrentProfitLoss = 0;
                    decCurrentProfitLoss = dcProfit + (dcClosingStock - dcOpeninggStock);
                    decimal dcProfitOpening = 0;
                    DataSet dsetProfitAndLossOpening = new DataSet();
                    dsetProfitAndLossOpening = bllFinancialStatement.ProfitAndLossAnalysisUpToaDateForPreviousYears(PublicVariables._dtFromDate);
                    DataTable dtblProfitOpening = new DataTable();
                    dtblProfitOpening = dsetProfitAndLossOpening.Tables[0];
                    for (int i = 0; i < dsetProfitAndLossOpening.Tables.Count; ++i)
                    {
                        dtbl = dsetProfitAndLossOpening.Tables[i];
                        decimal dcSum = 0;
                        if (i == 0 || (i % 2) == 0)
                        {
                            if (dtbl.Rows.Count > 0)
                            {
                                dcSum = decimal.Parse(dtbl.Compute("Sum(Debit)", string.Empty).ToString());
                                dcProfitOpening = dcProfitOpening - dcSum;
                            }
                        }
                        else
                        {
                            if (dtbl.Rows.Count > 0)
                            {
                                dcSum = decimal.Parse(dtbl.Compute("Sum(Credit)", string.Empty).ToString());
                                dcProfitOpening = dcProfitOpening + dcSum;
                            }
                        }
                    }
                    DataTable dtblProfitLedgerOpening = new DataTable();
                    dtblProfitLedgerOpening = DsetBalanceSheet.Tables[3];
                    decimal decProfitLedgerOpening = 0;
                    foreach (DataRow dRow in dtblProfitLedgerOpening.Rows)
                    {
                        decProfitLedgerOpening += decimal.Parse(dRow["Balance"].ToString());
                    }
                    DataTable dtblProf = new DataTable();
                    dtblProf = DsetBalanceSheet.Tables[2];
                    decimal decProfitLedger = 0;
                    if (dtblProf.Rows.Count > 0)
                    {
                        decProfitLedger = decimal.Parse(dtblProf.Compute("Sum(Balance)", string.Empty).ToString());
                    }
                    decimal decTotalProfitAndLoss = 0;
                    if (dcProfitOpening >= 0)
                    {
                        decTotalProfitAndLoss = decProfitLedger;
                    }
                    else if (dcProfitOpening < 0)
                    {
                        decTotalProfitAndLoss = decProfitLedger;
                    }
                    index = 0;
                    if (dcClosingStock >= 0)
                    {
                        //---------- Asset ----------//
                        dgvReport.Rows.Add();
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtAsset"].Value = "Closing Stock";
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["Amount1"].Value = Math.Round(dcClosingStock, inDecimalPlaces);
                        dcTotalAsset += dcClosingStock;
                    }
                    else
                    {
                        //--------- Liability ---------//
                        dgvReport.Rows.Add();
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtLiability"].Value = "Closing Stock";
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["Amount2"].Value = -(Math.Round(dcClosingStock, inDecimalPlaces));
                        dcTotalLiability += -dcClosingStock;
                    }
                    dgvReport.Rows.Add();
                    decimal decOpeningOfProfitAndLoss = decProfitLedgerOpening + dcProfitOpening;
                    decimal decTotalProfitAndLossOverAll = decTotalProfitAndLoss + decOpeningOfProfitAndLoss + decCurrentProfitLoss;
                    if (decTotalProfitAndLossOverAll <= 0)
                    {
                        dgvReport.Rows.Add();
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtAsset"].Value = "----------------------------------------";
                        dgvReport.Rows[dgvReport.Rows.Count - 1].DefaultCellStyle.Font = newFont;
                        foreach (DataRow dRow in dtblProf.Rows)
                        {
                            if (dRow["Name"].ToString() == "Profit And Loss Account")
                            {
                                dgvReport.Rows.Add();
                                dgvReport.Rows[dgvReport.Rows.Count - 1].DefaultCellStyle.Font = newFont;
                                dgvReport.Rows[dgvReport.Rows.Count - 1].DefaultCellStyle.ForeColor = Color.DarkSlateGray;
                                dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtAsset"].Value = dRow["Name"].ToString();
                                if (decCurrentProfitLoss < 0)
                                {
                                    decCurrentProfitLoss = decCurrentProfitLoss * -1;
                                }
                                dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["Amount1"].Value =Math.Round(decTotalProfitAndLoss + decCurrentProfitLoss,PublicVariables._inNoOfDecimalPlaces);
                                dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["GroupId1"].Value = dRow["ID"].ToString();
                            }
                        }
                        //-------------- Asset ---------------//
                        dgvReport.Rows.Add();
                        dgvReport.Rows[dgvReport.Rows.Count - 1].DefaultCellStyle.Font = newFont;
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtAsset"].Value = "Profit And Loss (Opening)";
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["Amount1"].Value = Math.Round(decTotalProfitAndLoss, PublicVariables._inNoOfDecimalPlaces);
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["Amount1"].Style.ForeColor = Color.DarkSlateGray;
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtAsset"].Style.ForeColor = Color.DarkSlateGray;
                        //-------------- Asset ---------------//
                        dgvReport.Rows.Add();
                        dgvReport.Rows[dgvReport.Rows.Count - 1].DefaultCellStyle.Font = newFont;
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtAsset"].Value = "Current Period";
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["Amount1"].Value = Math.Round(decCurrentProfitLoss, PublicVariables._inNoOfDecimalPlaces);
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["Amount1"].Style.ForeColor = Color.DarkSlateGray;
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtAsset"].Style.ForeColor = Color.DarkSlateGray;
                        dcTotalAsset = dcTotalAsset + (decCurrentProfitLoss + decTotalProfitAndLoss);
                        dgvReport.Rows.Add();
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtAsset"].Value = "----------------------------------------";
                        dgvReport.Rows[dgvReport.Rows.Count - 1].DefaultCellStyle.Font = newFont;
                    }
                    else if (decTotalProfitAndLossOverAll > 0)
                    {
                        dgvReport.Rows.Add();
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtLiability"].Value = "----------------------------------------";
                        dgvReport.Rows[dgvReport.Rows.Count - 1].DefaultCellStyle.Font = newFont;
                        foreach (DataRow dRow in dtblProf.Rows)
                        {
                            if (dRow["Name"].ToString() == "Profit And Loss Account")
                            {
                                dgvReport.Rows.Add();
                                dgvReport.Rows[dgvReport.Rows.Count - 1].DefaultCellStyle.Font = newFont;
                                dgvReport.Rows[dgvReport.Rows.Count - 1].DefaultCellStyle.ForeColor = Color.DarkSlateGray;
                                dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtLiability"].Value = dRow[1].ToString();
                                dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["Amount2"].Value =Math.Round(decTotalProfitAndLoss + decCurrentProfitLoss,PublicVariables._inNoOfDecimalPlaces);
                                dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["GroupId2"].Value = dRow[0].ToString();
                            }
                        }
                        //------------ Liability ------------//
                        dgvReport.Rows.Add();
                        dgvReport.Rows[dgvReport.Rows.Count - 1].DefaultCellStyle.Font = newFont;
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtLiability"].Value = "Profit And Loss (Opening)";
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["Amount2"].Value = Math.Round(decTotalProfitAndLoss, inDecimalPlaces);
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["Amount2"].Style.ForeColor = Color.DarkSlateGray;
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtLiability"].Style.ForeColor = Color.DarkSlateGray;
                        dcTotalLiability += decOpeningOfProfitAndLoss;
                        //------------ Liability ------------//
                        dgvReport.Rows.Add();
                        dgvReport.Rows[dgvReport.Rows.Count - 1].DefaultCellStyle.Font = newFont;
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtLiability"].Value = "Current Period";
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["Amount2"].Value = Math.Round(decCurrentProfitLoss, inDecimalPlaces);
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["Amount2"].Style.ForeColor = Color.DarkSlateGray;
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtLiability"].Style.ForeColor = Color.DarkSlateGray;
                        dcTotalLiability = dcTotalLiability + (decCurrentProfitLoss + decTotalProfitAndLoss); //dcProfit;
                        dgvReport.Rows.Add();
                        dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtLiability"].Value = "----------------------------------------";
                        dgvReport.Rows[dgvReport.Rows.Count - 1].DefaultCellStyle.Font = newFont;
                    }
                    dgvReport.Rows.Add();
                    decimal dcDiffAsset = 0;
                    decimal dcDiffLiability = 0;
                    decimal dcTotalValue = dcTotalAsset;
                    if (dcTotalAsset != dcTotalLiability)
                    {
                        if (dcTotalAsset > dcTotalLiability)
                        {
                            //--------------- Liability exceeds so in asset side ----------------//
                            dgvReport.Rows.Add();
                            dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtLiability"].Value = "Difference";
                            dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["Amount2"].Value = Math.Round((dcTotalAsset - dcTotalLiability), inDecimalPlaces);
                            dgvReport.Rows[dgvReport.Rows.Count - 1].DefaultCellStyle.Font = newFont;
                            dgvReport.Rows[dgvReport.Rows.Count - 1].DefaultCellStyle.ForeColor = Color.DarkRed;
                            dcDiffLiability = dcTotalAsset - dcTotalLiability;
                        }
                        else
                        {
                            //--------------- Asset exceeds so in liability side ----------------//
                            dgvReport.Rows.Add();
                            dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtAsset"].Value = "Difference";
                            dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["Amount1"].Value = Math.Round((dcTotalLiability - dcTotalAsset), inDecimalPlaces); ;
                            dgvReport.Rows[dgvReport.Rows.Count - 1].DefaultCellStyle.Font = newFont;
                            dgvReport.Rows[dgvReport.Rows.Count - 1].DefaultCellStyle.ForeColor = Color.DarkRed;
                            dcDiffAsset = dcTotalLiability - dcTotalAsset;
                        }
                    }
                    dgvReport.Rows.Add();
                    dgvReport.Rows.Add();
                    dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["Amount1"].Value = "__________________________";
                    dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["Amount2"].Value = "__________________________";
                    dgvReport.Rows.Add();
                    dgvReport.Rows[dgvReport.Rows.Count - 1].DefaultCellStyle.Font = newFont;
                    dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtLiability"].Value = "Total";
                    dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["dgvtxtAsset"].Value = "Total";
                    dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["Amount1"].Value = Math.Round((dcTotalAsset + dcDiffAsset), inDecimalPlaces);
                    dgvReport.Rows[dgvReport.Rows.Count - 1].Cells["Amount2"].Value = Math.Round((dcTotalLiability + dcDiffLiability), inDecimalPlaces);
                    if (dgvReport.Columns.Count > 0)
                    {
                        dgvReport.Columns["Amount1"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                        dgvReport.Columns["Amount2"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                    }
                    decPrintOrNot = dcTotalAsset + dcDiffAsset;
                    decPrintOrNot1 = dcTotalLiability + dcDiffLiability;
                    if (inCurrenRowIndex >= 0 && dgvReport.Rows.Count > 0 && inCurrenRowIndex < dgvReport.Rows.Count)
                    {
                        if (dgvReport.Rows[inCurrenRowIndex].Cells[inCurentcolIndex].Visible)
                        {
                            dgvReport.CurrentCell = dgvReport.Rows[inCurrenRowIndex].Cells[inCurentcolIndex];
                        }
                        if (dgvReport.CurrentCell != null && dgvReport.CurrentCell.Visible)
                            dgvReport.CurrentCell.Selected = true;
                    }
                    inCurrenRowIndex = 0;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("BS :1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 40
0
 public void CreateProcessorException()
 {
     SettingsInfo s = new SettingsInfo(0, "Name", null,
         new SerialPortSettings(BaudRate.BR_57600, Parity.Even, StopBits.One, 0xA0, 0xA5));
 }
Ejemplo n.º 41
0
        /// <summary>
        /// Registers persistent application settings</summary>
        /// <param name="uid">Unique identifer for settings</param>
        /// <param name="settings">All settings</param>
        public void RegisterSettings(string uid, params PropertyDescriptor[] settings)
        {
            SettingsInfo settingsInfo;
            if (!m_settings.TryGetValue(uid, out settingsInfo))
            {
                settingsInfo = new SettingsInfo(uid);
                m_settings.Add(uid, settingsInfo);
            }

            foreach (PropertyDescriptor descriptor in settings)
                settingsInfo.Add(descriptor);
        }
Ejemplo n.º 42
0
 /// <summary>
 /// Function to invoke the Settings to copy
 /// </summary>
 /// <param name="strSettingsName"></param>
 /// <returns></returns>
 public string SettingsToCopyStatusView(string strSettingsName)
 {
     try
     {
         SettingsBll BllSettings = new SettingsBll();
         SettingsInfo infoSettings = new SettingsInfo();
         infoSettings = BllSettings.SettingsToCopyView(strSettingsName);
         strStatus = infoSettings.Status.ToString();
     }
     catch (Exception ex)
     {
         MessageBox.Show("ST5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return strStatus;
 }
Ejemplo n.º 43
0
 public SettingsWindow()
 {
     Settings = new SettingsInfo();
       InitializeComponent();
 }
 /// <summary>
 /// Function to set the calculation method by checking the settings
 /// </summary>
 public void CalculationMethod()
 {
     try
     {
         SettingsInfo InfoSettings = new SettingsInfo();
         SettingsBll BllSettings = new SettingsBll();
         //--------------- Selection Of Calculation Method According To Settings ------------------//
         if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "FIFO")
         {
             calculationMethod = "FIFO";
         }
         else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Average Cost")
         {
             calculationMethod = "Average Cost";
         }
         else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "High Cost")
         {
             calculationMethod = "High Cost";
         }
         else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Low Cost")
         {
             calculationMethod = "Low Cost";
         }
         else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Last Purchase Rate")
         {
             calculationMethod = "Last Purchase Rate";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("AGR:6" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 45
0
 public SelectedSettings(MemoryType memoryType, SettingsInfo settingsInfo)
 {
     MemoryType = memoryType;
     SettingsInfo = settingsInfo;
 }
Ejemplo n.º 46
0
 /// <summary>
 /// Function to get the status of settings
 /// </summary>
 public void CurrentSettings()
 {
     try
     {
         SettingsBll BllSettings = new SettingsBll();
         SettingsInfo infoSettings = new SettingsInfo();
         if (BllSettings.SettingsStatusCheck("AddConfirmationFor") == "Yes")
         {
             if (BllSettings.SettingsStatusCheck("Add") == "Yes")
             {
                 PublicVariables.isMessageAdd = true;
             }
             else
             {
                 PublicVariables.isMessageAdd = false;
             }
             if (BllSettings.SettingsStatusCheck("Edit") == "Yes")
             {
                 PublicVariables.isMessageEdit = true;
             }
             else
             {
                 PublicVariables.isMessageEdit = false;
             }
             if (BllSettings.SettingsStatusCheck("Delete") == "Yes")
             {
                 PublicVariables.isMessageDelete = true;
             }
             else
             {
                 PublicVariables.isMessageDelete = false;
             }
             if (BllSettings.SettingsStatusCheck("Close") == "Yes")
             {
                 PublicVariables.isMessageClose = true;
             }
             else
             {
                 PublicVariables.isMessageClose = false;
             }
         }
         else
         {
             PublicVariables.isMessageAdd = PublicVariables.isMessageClose = PublicVariables.isMessageDelete = PublicVariables.isMessageEdit = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MDI 3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// Function to fill the grid
        /// </summary>
        public void GridFill()
        {
            try
            {

                CurrencyInfo InfoCurrency = new CurrencyInfo();
                CurrencyBll BllCurrency = new CurrencyBll();
                InfoCurrency = BllCurrency.CurrencyView(1);
                int inDecimalPlaces = InfoCurrency.NoOfDecimalPlaces;
                string calculationMethod = string.Empty;
                SettingsInfo InfoSettings = new SettingsInfo();
                SettingsBll BllSettings = new SettingsBll();
                //--------------- Selection Of Calculation Method According To Settings ------------------//

                if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "FIFO")
                {
                    calculationMethod = "FIFO";
                }
                else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Average Cost")
                {
                    calculationMethod = "Average Cost";
                }
                else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "High Cost")
                {
                    calculationMethod = "High Cost";
                }
                else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Low Cost")
                {
                    calculationMethod = "Low Cost";
                }
                else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Last Purchase Rate")
                {
                    calculationMethod = "Last Purchase Rate";
                }

                // StockPostingSP spstock = new StockPostingSP();
                StockPostingBll BllStockPosting = new StockPostingBll();
                decimal decrackId = 0;
                DataSet dsstock = new DataSet();
                List<DataTable> list = new List<DataTable>();

                if (cmbRack.SelectedValue != null)
                {
                    decrackId = Convert.ToDecimal(cmbRack.SelectedValue.ToString());
                }

                list = BllStockPosting.StockReportGridFill1(txtproductName.Text, Convert.ToDecimal(cmbBrand.SelectedValue.ToString()), Convert.ToDecimal(cmbModel.SelectedValue.ToString()), (txtProductCode.Text), Convert.ToDecimal(cmbGodown.SelectedValue.ToString()), decrackId, Convert.ToDecimal(cmbSize.SelectedValue.ToString()), Convert.ToDecimal(cmbTax.SelectedValue.ToString()), Convert.ToDecimal(cmbProductgroup.SelectedValue.ToString()), txtBatchName.Text);

                if (list[0].Rows.Count > 0)
                {
                    decimal decTotal = 0;
                    for (int i = 0; i < list[0].Rows.Count; i++)
                    {
                        if (list[0].Rows[i]["stockvalue"].ToString() != string.Empty)
                        {
                            decTotal = decTotal + Convert.ToDecimal(list[0].Rows[i]["stockvalue"].ToString());
                        }

                    }

                    decTotal = Math.Round(decTotal, 2);
                    txtTotal.Text = decTotal.ToString();
                }
                else
                {
                    txtTotal.Text = "0.00";
                }

                dgvStockReport.DataSource = list[0];
                //if (dtbl.Columns.Count > 0)
                //{
                //    dgvStockReport.Columns["stockvalue"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                //}

            }
            catch (Exception ex)
            {
                MessageBox.Show("STKR:8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 48
0
 public void RemoveSettings(SettingsInfo settingsInfo)
 {
     try
     {
         XDocument doc = xmlFileManager.Open();
         XNamespace ns = doc.Root.GetDefaultNamespace();
         var elements = doc.Element(ns + "settings").Element(ns + "usersRecords").Elements(ns + "record");
         var element = elements.Where(x => Convert.ToInt32(x.Attribute("ID").Value, 10) == settingsInfo.Id).First();
         element.Remove();
         xmlFileManager.Save(doc);
     }
     catch (SettingsException ex)
     {
         throw ex;
     }
     catch (Exception ex)
     {
         throw new SettingsException(Resources.IncorrectFileWithSettings, ex);
     }
 }
Ejemplo n.º 49
0
        /// <summary>
        /// Function to fill Datagridview
        /// </summary>
        public void GridFill()
        {
            try
            {
                if (!isFormLoad)
                {
                    DateValidation objValidation = new DateValidation();
                    objValidation.DateValidationFunction(txtFromDate);
                    if (txtFromDate.Text == string.Empty)
                        txtFromDate.Text = PublicVariables._dtFromDate.ToString("dd-MMM-yyyy");
                    objValidation.DateValidationFunction(txttoDate);
                    if (txttoDate.Text == string.Empty)
                        txttoDate.Text = PublicVariables._dtToDate.ToString("dd-MMM-yyyy");
                    DateTime strFromDate = DateTime.Parse(txtFromDate.Text.ToString());
                    DateTime strTodate = DateTime.Parse(txttoDate.Text.ToString());
                    FinancialStatementBll bllFinancialStatement = new FinancialStatementBll();
                    DataSet dsetFinancial = new DataSet();
                    SettingsInfo InfoSettings = new SettingsInfo();
                    SettingsBll BllSettings = new SettingsBll();
                    dsetFinancial = bllFinancialStatement.CashFlow(strFromDate, strTodate);
                    DataTable dtbl = new DataTable();
                    Font newFont = new Font(dgvCashflow.Font, FontStyle.Bold);
                    CurrencyInfo InfoCurrency = new CurrencyInfo();
                    CurrencyBll BllCurrency = new CurrencyBll();
                    InfoCurrency = BllCurrency.CurrencyView(1);
                    int inDecimalPlaces = InfoCurrency.NoOfDecimalPlaces;
                    dgvCashflow.Rows.Clear();

                    for (int i = 0; i < 8; i++)
                    {
                        dtbl = dsetFinancial.Tables[i];
                        foreach (DataRow rw in dtbl.Rows)
                        {
                            dgvCashflow.Rows.Add();
                            dgvCashflow.Rows[dgvCashflow.Rows.Count - 1].Cells["dgvtxtParticulars"].Value = rw["accountGroupName"].ToString();
                            dgvCashflow.Rows[dgvCashflow.Rows.Count - 1].Cells["dgvtxtinflow"].Value = rw["Balance"].ToString();
                            dgvCashflow.Rows[dgvCashflow.Rows.Count - 1].Cells["dgvtxtID1"].Value = rw["accountGroupId"].ToString();
                        }
                    }
                    //-------------------------------Calculating TotalInflow-----------------------------------------
                    decimal dcTotalInflow = 0m;
                    if (dtbl.Rows.Count > 0)
                    {
                        for (int i = 0; i < dgvCashflow.Rows.Count; i++)
                        {
                            decimal dcTotalIn = decimal.Parse(dgvCashflow.Rows[i].Cells["dgvtxtinflow"].Value.ToString());
                            dcTotalInflow += dcTotalIn;
                        }
                        dcTotInflow = dcTotalInflow;
                    }
                    //-----------------Outflow------------------------------
                    int index = 0;
                    for (int i = 8; i < 15; i++)
                    {
                        dtbl = new DataTable();
                        dtbl = dsetFinancial.Tables[i];
                        foreach (DataRow rw in dtbl.Rows)
                        {
                            if (index < dgvCashflow.Rows.Count)
                            {
                                dgvCashflow.Rows[index].Cells["dgvtxtParticulars1"].Value = rw["accountGroupName1"].ToString();
                                dgvCashflow.Rows[index].Cells["dgvtxtoutflow"].Value = rw["Balance1"].ToString();
                                dgvCashflow.Rows[index].Cells["dgvtxtID2"].Value = rw["accountGroupId"].ToString();
                            }
                            else
                            {
                                dgvCashflow.Rows.Add();
                                dgvCashflow.Rows[dgvCashflow.Rows.Count - 1].Cells["dgvtxtParticulars1"].Value = rw["accountGroupName1"].ToString();
                                dgvCashflow.Rows[dgvCashflow.Rows.Count - 1].Cells["dgvtxtoutflow"].Value = rw["Balance1"].ToString();
                                dgvCashflow.Rows[dgvCashflow.Rows.Count - 1].Cells["dgvtxtID2"].Value = rw["accountGroupId"].ToString();
                            }
                            index++;
                        }
                    }
                    //-------------------------------Calculating TotalOutflow-----------------------------------------
                    decimal dcTotalOutflow = 0m;
                    if (dtbl.Rows.Count > 0)
                    {
                        for (int i = 0; i < dgvCashflow.Rows.Count - 1; i++)
                        {
                            decimal dcTotalIn = decimal.Parse(dgvCashflow.Rows[i].Cells["dgvtxtoutflow"].Value.ToString());
                            dcTotalOutflow += dcTotalIn;
                        }
                        dcTotOutflow = dcTotalOutflow;
                    }
                    dgvCashflow.Rows.Add();
                    dgvCashflow.Rows[dgvCashflow.Rows.Count - 1].Cells["dgvtxtinflow"].Value = "_______________________";
                    dgvCashflow.Rows[dgvCashflow.Rows.Count - 1].Cells["dgvtxtoutflow"].Value = "_______________________";
                    dgvCashflow.Rows.Add();
                    dgvCashflow.Rows[dgvCashflow.Rows.Count - 1].DefaultCellStyle.Font = newFont;
                    dgvCashflow.Rows[dgvCashflow.Rows.Count - 1].Cells["dgvtxtParticulars"].Value = "Total";
                    dgvCashflow.Rows[dgvCashflow.Rows.Count - 1].Cells["dgvtxtParticulars1"].Value = "Total";
                    dgvCashflow.Rows[dgvCashflow.Rows.Count - 1].Cells["dgvtxtinflow"].Value = Math.Round((dcTotalInflow), inDecimalPlaces);
                    dgvCashflow.Rows[dgvCashflow.Rows.Count - 1].Cells["dgvtxtoutflow"].Value = Math.Round((dcTotalOutflow), inDecimalPlaces);
                    if (dgvCashflow.Columns.Count > 0)
                    {
                        dgvCashflow.Columns["dgvtxtinflow"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                        dgvCashflow.Columns["dgvtxtoutflow"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                    }
                    if (inCurrenRowIndex >= 0 && dgvCashflow.Rows.Count > 0 && inCurrenRowIndex < dgvCashflow.Rows.Count)
                    {
                        if (dgvCashflow.Rows[inCurrenRowIndex].Cells[inCurentcolIndex].Visible)
                        {
                            dgvCashflow.CurrentCell = dgvCashflow.Rows[inCurrenRowIndex].Cells[inCurentcolIndex];
                        }
                        if (dgvCashflow.CurrentCell != null && dgvCashflow.CurrentCell.Visible)
                            dgvCashflow.CurrentCell.Selected = true;
                    }
                    inCurrenRowIndex = 0;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("CF:01" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 50
0
        /// <summary>
        /// Save or edit function,checking the invalid entries here
        /// </summary>
        public void SaveOrEdit()
        {
            SettingsBll BllSettings = new SettingsBll();
            SettingsInfo infoSettings = new SettingsInfo();
            try
            {
                foreach (Control ctrl in this.Controls)
                {
                    if (ctrl is CheckBox)
                    {
                        CheckBox cb = (CheckBox)ctrl;
                        strControlls = cb.Text.Replace(" ", string.Empty);
                        if (cb.Checked)
                        {
                            infoSettings.Status = strTrue;
                            infoSettings.SettingsId = BllSettings.SettingsGetId(strControlls);
                            if (cb.Text == "Tax")
                            {
                                formMDI.MDIObj.taxToolStripMenuItem.Enabled = true;
                            }
                            if (cb.Text == "Budget")
                            {
                                formMDI.MDIObj.budgetToolStripMenuItem.Enabled = true;
                            }
                            if (cb.Text == "Payroll")
                            {
                                formMDI.MDIObj.payrollToolStripMenuItem.Enabled = true;
                                formMDI.MDIObj.payrollToolStripMenuItem1.Enabled = true;
                                foreach (ToolStripMenuItem toolItem in formMDI.MDIObj.payrollToolStripMenuItem1.DropDownItems)
                                {
                                    toolItem.Enabled = true;
                                }
                            }
                            if (cb.Text == "Multi Currency")
                            {
                                formMDI.MDIObj.currencyToolStripMenuItem.Enabled = true;
                            }
                            if (cb.Text == "Allow Batch")
                            {
                                formMDI.MDIObj.batchToolStripMenuItem.Enabled = true;
                            }
                            if (cb.Text == "Allow Size")
                            {
                                formMDI.MDIObj.sizeToolStripMenuItem.Enabled = true;
                            }
                            if (cb.Text == "Allow Godown")
                            {
                                formMDI.MDIObj.godownToolStripMenuItem.Enabled = true;
                                if (cbxAllowRack.Checked)
                                {
                                    formMDI.MDIObj.rackToolStripMenuItem.Enabled = true;
                                }

                            }
                            if (cb.Text == "Allow Rack")
                            {
                                formMDI.MDIObj.rackToolStripMenuItem.Enabled = true;
                            }
                            if (cb.Text == "Allow Model No")
                            {
                                formMDI.MDIObj.modelNumberToolStripMenuItem.Enabled = true;
                            }

                        }
                        else
                        {
                            infoSettings.Status = strFalse;
                            infoSettings.SettingsId = BllSettings.SettingsGetId(strControlls);
                            if (cb.Text == "Tax")
                            {
                                formMDI.MDIObj.taxToolStripMenuItem.Enabled = false;
                            }
                            if (cb.Text == "Budget")
                            {
                                formMDI.MDIObj.budgetToolStripMenuItem.Enabled = false;
                            }
                            if (cb.Text == "Payroll")
                            {
                                formMDI.MDIObj.payrollToolStripMenuItem.Enabled = false;
                                formMDI.MDIObj.payrollToolStripMenuItem1.Enabled = false;
                                foreach (ToolStripMenuItem toolItem in formMDI.MDIObj.payrollToolStripMenuItem1.DropDownItems)
                                {
                                    toolItem.Enabled = false;
                                }
                            }
                            if (cb.Text == "MultiCurrency")
                            {
                                formMDI.MDIObj.currencyToolStripMenuItem.Enabled = false;
                            }
                            if (cb.Text == "Allow Batch")
                            {
                                formMDI.MDIObj.batchToolStripMenuItem.Enabled = false;
                            }
                            if (cb.Text == "Allow Size")
                            {
                                formMDI.MDIObj.sizeToolStripMenuItem.Enabled = false;
                            }
                            if (cb.Text == "Allow Godown")
                            {
                                formMDI.MDIObj.godownToolStripMenuItem.Enabled = false;

                                if (cbxAllowRack.Checked == false)
                                {
                                    formMDI.MDIObj.rackToolStripMenuItem.Enabled = false;
                                }
                            }
                            if (cb.Text == "Allow Rack")
                            {
                                formMDI.MDIObj.rackToolStripMenuItem.Enabled = false;
                            }
                            if (cb.Text == "Allow Model No")
                            {
                                formMDI.MDIObj.modelNumberToolStripMenuItem.Enabled = false;
                            }
                        }
                        BllSettings.SettingsEdit(infoSettings);

                    }
                    if (ctrl is ComboBox)
                    {
                        ComboBox cmb = (ComboBox)ctrl;
                        strControlls = ctrl.Name.Replace("cmb", string.Empty);
                        if (cmb.SelectedIndex > -1)
                        {
                            infoSettings.Status = cmb.SelectedItem.ToString();
                            infoSettings.SettingsId = BllSettings.SettingsGetId(strControlls);
                        }
                        BllSettings.SettingsEdit(infoSettings);
                    }

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("ST3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 51
0
 /// <summary>
 /// Function to fill Datagridview after calculation
 /// </summary>
 public void GridFill()
 {
     try
     {
         if (!isFormLoad)
         {
             DateValidation objValidation = new DateValidation();
             objValidation.DateValidationFunction(txtFundFlowFromDate);
             if (txtFundFlowFromDate.Text == string.Empty)
                 txtFundFlowFromDate.Text = PublicVariables._dtFromDate.ToString("dd-MMM-yyyy");
             objValidation.DateValidationFunction(txtFundflowToDate);
             if (txtFundflowToDate.Text == string.Empty)
                 txtFundflowToDate.Text = PublicVariables._dtToDate.ToString("dd-MMM-yyyy");
             //-------------------------------------First gridfill-------------------------------------//
             DateTime strFromDate = Convert.ToDateTime(txtFundFlowFromDate.Text.ToString());
             DateTime strTodate = Convert.ToDateTime(txtFundflowToDate.Text.ToString());
             FinancialStatementBll bllFinancialStatement = new FinancialStatementBll();
             DataSet dsetFinancial = new DataSet();
             SettingsInfo InfoSettings = new SettingsInfo();
             SettingsBll BllSettings = new SettingsBll();
             //--------------- Selection Of Calculation Method According To Settings ------------------//
             if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "FIFO")
             {
                 strCalculationMethod = "FIFO";
             }
             else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Average Cost")
             {
                 strCalculationMethod = "Average Cost";
             }
             else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "High Cost")
             {
                 strCalculationMethod = "High Cost";
             }
             else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Low Cost")
             {
                 strCalculationMethod = "Low Cost";
             }
             else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Last Purchase Rate")
             {
                 strCalculationMethod = "Last Purchase Rate";
             }
             dsetFinancial = bllFinancialStatement.FundFlow(strFromDate, strTodate);
             DataTable dtbl = new DataTable();
             Font newFont = new Font(dgvFundFlow.Font, FontStyle.Bold);
             CurrencyInfo InfoCurrency = new CurrencyInfo();
             CurrencyBll BllCurrency = new CurrencyBll();
             InfoCurrency = BllCurrency.CurrencyView(1);
             int inDecimalPlaces = InfoCurrency.NoOfDecimalPlaces;
             dgvFundFlow.Rows.Clear();
             ////-------------------Source--------------------------------------------------------------
             dtbl = dsetFinancial.Tables[0];
             foreach (DataRow rw in dtbl.Rows)
             {
                 dgvFundFlow.Rows.Add();
                 dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].Cells["dgvtxtSource"].Value = rw["Name"].ToString();
                 dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = rw["Balance"].ToString();
                 dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].Cells["dgvtxtgroupId1"].Value = rw["ID"].ToString();
             }
             decimal dcTotalAsset = 0;
             if (dtbl.Rows.Count > 0)
             {
                 dcTotalAsset = decimal.Parse(dtbl.Compute("Sum(Balance)", string.Empty).ToString());
             }
             ////-----------------Application------------------------------------------------------------
             dtbl = new DataTable();
             dtbl = dsetFinancial.Tables[1];
             int index = 0;
             foreach (DataRow rw in dtbl.Rows)
             {
                 if (index < dgvFundFlow.Rows.Count)
                 {
                     dgvFundFlow.Rows[index].Cells["dgvtxtApplication"].Value = rw["Name"].ToString();
                     dgvFundFlow.Rows[index].Cells["dgvtxtAmount2"].Value = rw["Balance"].ToString();
                     dgvFundFlow.Rows[index].Cells["dgvtxtgroupId2"].Value = rw["ID"].ToString();
                 }
                 else
                 {
                     dgvFundFlow.Rows.Add();
                     dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].Cells["dgvtxtApplication"].Value = rw["Name"].ToString();
                     dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = rw["Balance"].ToString();
                     dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].Cells["dgvtxtgroupId2"].Value = rw["ID"].ToString();
                 }
                 index++;
             }
             decimal dcTotalLiability = 0;
             if (dtbl.Rows.Count > 0)
             {
                 dcTotalLiability = Convert.ToDecimal(dtbl.Compute("Sum(Balance)", string.Empty).ToString());
             }
             //-------------------- Closing Stock -----------------------//  With Calculation
             dcClosingStock = bllFinancialStatement.StockValueGetOnDate(Convert.ToDateTime(txtFundflowToDate.Text), strCalculationMethod, false, false);
             dcClosingStock = Math.Round(dcClosingStock, inDecimalPlaces);
             //---------------------Opening Stock-----------------------
             decimal dcOpeninggStock = bllFinancialStatement.StockValueGetOnDate(Convert.ToDateTime(txtFundFlowFromDate.Text), strCalculationMethod, true, false);
             //------------- Profit Or Loss -----------// With Calculation
             decimal dcProfit = 0;
             DataSet dsetProfitAndLoss = new DataSet();
             dsetProfitAndLoss = bllFinancialStatement.ProfitAndLossAnalysisUpToaDateForBalansheet(Convert.ToDateTime(txtFundFlowFromDate.Text), Convert.ToDateTime(txtFundflowToDate.Text));
             DataTable dtblProfit = new DataTable();
             dtblProfit = dsetProfitAndLoss.Tables[0];
             for (int i = 0; i < dsetProfitAndLoss.Tables.Count; ++i)
             {
                 dtbl = dsetProfitAndLoss.Tables[i];
                 decimal dcSum = 0;
                 if (i == 0 || (i % 2) == 0)
                 {
                     if (dtbl.Rows.Count > 0)
                     {
                         dcSum = Convert.ToDecimal(dtbl.Compute("Sum(Debit)", string.Empty).ToString());
                         dcProfit = dcProfit - dcSum;
                     }
                 }
                 else
                 {
                     if (dtbl.Rows.Count > 0)
                     {
                         dcSum = Convert.ToDecimal(dtbl.Compute("Sum(Credit)", string.Empty).ToString());
                         dcProfit = dcProfit + dcSum;
                     }
                 }
             }
             //---------------------NetProfit/NetLoss Calculation--------------------------
             dcProfit = dcProfit + dcClosingStock - dcOpeninggStock;
             if (dcProfit > 0)
             {
                 //------------ Liability ------------//
                 dgvFundFlow.Rows.Add();
                 dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].Cells["dgvtxtSource"].Value = "Net Profit";
                 dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = Math.Round(dcProfit, inDecimalPlaces);
                 dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].Cells["dgvtxtAmount1"].Style.ForeColor = Color.Green;
                 dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].Cells["dgvtxtSource"].Style.ForeColor = Color.Green;
                 //dcTotalLiability += dcProfit;
             }
             else
             {
                 //-------------- Asset ---------------//
                 dgvFundFlow.Rows.Add();
                 dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].Cells["dgvtxtApplication"].Value = "Net Loss";
                 dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = -Math.Round(dcProfit, inDecimalPlaces);
                 dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].Cells["dgvtxtAmount2"].Style.ForeColor = Color.Red;
                 dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].Cells["dgvtxtApplication"].Style.ForeColor = Color.Red;
             }
             if (dcProfit > 0)
             {
                 dcTotalAsset += (dcProfit);
             }
             else
             {
                 dcTotalLiability += (-dcProfit);
             }
             decimal dcTotalValue = dcTotalAsset;
             dgvFundFlow.Rows.Add();
             dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = "_______________________";
             dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = "_______________________";
             dgvFundFlow.Rows.Add();
             dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].DefaultCellStyle.Font = newFont;
             dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].Cells["dgvtxtApplication"].Value = "Total";
             dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].Cells["dgvtxtSource"].Value = "Total";
             dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = Math.Round((dcTotalAsset), inDecimalPlaces);
             dgvFundFlow.Rows[dgvFundFlow.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = Math.Round((dcTotalLiability), inDecimalPlaces);
             //----------------------------------------Second gridfill----------------------------------------------
             //--------------------------------------Current Assets-------------------------------------------
             Font newFont2 = new Font(dgvFundFlow2.Font, FontStyle.Bold);
             dgvFundFlow2.Rows.Clear();
             dtbl = dsetFinancial.Tables[3];
             decimal decWC = 0;
             foreach (DataRow rw in dtbl.Rows)
             {
                 dgvFundFlow2.Rows.Add();
                 dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtgroupId"].Value = rw["ID"].ToString();
                 dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtParticulars"].Value = rw["Name"].ToString();
                 dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtOpeningBalance"].Value = rw["OpeningBalance"].ToString() + "Dr";
                 dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtop"].Value = rw["OpeningBalance"].ToString();
                 dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtcb"].Value = rw["ClosingBalance"].ToString();
                 decimal decOB = Convert.ToDecimal(rw["OpeningBalance"].ToString());
                 decimal decCB = Convert.ToDecimal(rw["ClosingBalance"].ToString());
                 decCB = decCB + dcClosingStock;
                 if (decCB > 0)
                 {
                     dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtClosingBalance"].Value = Math.Round(decCB, inDecimalPlaces).ToString() + "Dr";
                     dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtcb"].Value = Math.Round(decCB, inDecimalPlaces).ToString();
                 }
                 else
                 {
                     decCB = -1 * decCB;
                     dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtClosingBalance"].Value = Math.Round(decCB, inDecimalPlaces).ToString() + "Dr";
                     dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtcb"].Value = Math.Round(decCB, inDecimalPlaces).ToString();
                 }
                 decWC = decOB - decCB;
                 dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtWorkingCapitalIncrease"].Value = Math.Round(decWC, inDecimalPlaces).ToString();
             }
             //--------------------------------------Current Liability-------------------------------------------
             dtbl = dsetFinancial.Tables[5];
             decimal decWCCL = 0;
             foreach (DataRow rw in dtbl.Rows)
             {
                 dgvFundFlow2.Rows.Add();
                 dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtgroupId"].Value = rw["ID"].ToString();
                 dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtParticulars"].Value = rw["Name"].ToString();
                 decimal decOp = Convert.ToDecimal(rw["OpeningBalance"].ToString());
                 decimal decCb = Convert.ToDecimal(rw["ClosingBalance"].ToString());
                 dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtOpeningBalance"].Value = decOp.ToString() + "Cr";
                 dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtop"].Value = rw["OpeningBalance"].ToString();
                 dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtcb"].Value = rw["ClosingBalance"].ToString();
                 if (decCb > 0)
                 {
                     dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtClosingBalance"].Value = decCb.ToString() + "Cr";
                     dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtcb"].Value = decCb.ToString();
                 }
                 else
                 {
                     decCb = -1 * decCb;
                     dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtClosingBalance"].Value = decCb.ToString() + "Cr";
                     dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtcb"].Value = decCb.ToString();
                 }
                 decimal decOB = Convert.ToDecimal(rw["OpeningBalance"].ToString());
                 decimal decCB = Convert.ToDecimal(rw["ClosingBalance"].ToString());
                 decWCCL = decOp - decCb;
                 dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtWorkingCapitalIncrease"].Value = decWCCL.ToString();
             }
             //-----------------Calculating Working capital---------------
             decimal decOpen = 0;
             decimal decClose = 0;
             decimal decWork = 0;
             decOpen = Convert.ToDecimal(dgvFundFlow2.Rows[0].Cells[3].Value.ToString()) - Convert.ToDecimal(dgvFundFlow2.Rows[1].Cells[3].Value.ToString());
             decClose = Convert.ToDecimal(dgvFundFlow2.Rows[0].Cells[5].Value.ToString()) - Convert.ToDecimal(dgvFundFlow2.Rows[1].Cells[5].Value.ToString());
             decWork = Convert.ToDecimal(dgvFundFlow2.Rows[0].Cells[6].Value.ToString()) - Convert.ToDecimal(dgvFundFlow2.Rows[1].Cells[6].Value.ToString());
             decimal decW1 = Convert.ToDecimal(dgvFundFlow2.Rows[0].Cells[6].Value.ToString());
             decimal decW2 = Convert.ToDecimal(dgvFundFlow2.Rows[1].Cells[6].Value.ToString());
             dgvFundFlow2.Rows.Add();
             dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtParticulars"].Value = "Working Capital";
             if (decOpen > 0)
             {
                 dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtOpeningBalance"].Value = decOpen.ToString() + "Dr";
             }
             else
             {
                 decOpen *= -1;
                 dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtOpeningBalance"].Value = decOpen.ToString() + "Cr";
             }
             if (decClose > 0)
             {
                 dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtClosingBalance"].Value = decClose.ToString() + "Dr";
             }
             else
             {
                 decClose *= -1;
                 dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtClosingBalance"].Value = decClose.ToString() + "Cr";
             }
             dgvFundFlow2.Rows[dgvFundFlow2.Rows.Count - 1].Cells["dgvtxtWorkingCapitalIncrease"].Value = decWork.ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("FF:06" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function for check settings
 /// </summary>
 public void InitialSettings()
 {
     try
     {
         SettingsBll BllSettings = new SettingsBll();
         SettingsInfo info = new SettingsInfo();
         List<DataTable> listObj = new List<DataTable>();
         listObj = BllSettings.SettingsViewAll();
         if (listObj[0].Rows.Count > 0)
         {
             foreach (DataRow item in listObj[0].Rows)
             {
                 info.SettingsName = item["settingsName"].ToString();
                 info.Status = item["status"].ToString();
                 if (info.SettingsName == "AllowBatch" && info.Status == "Yes")
                 {
                     cmbAllowBatch.Enabled = true;
                 }
                 if (info.SettingsName == "AllowBatch" && info.Status == "No")
                 {
                     cmbAllowBatch.Enabled = false;
                 }
                 if (info.SettingsName == "AllowSize" && info.Status == "Yes")
                 {
                     cmbSize.Enabled = true;
                     btnSizeAdd.Enabled = true;
                 }
                 if (info.SettingsName == "AllowSize" && info.Status == "No")
                 {
                     cmbSize.Enabled = false;
                     btnSizeAdd.Enabled = false;
                 }
                 if (info.SettingsName == "AllowModelNo" && info.Status == "Yes")
                 {
                     cmbModalNo.Enabled = true;
                     btnModalNo.Enabled = true;
                 }
                 if (info.SettingsName == "AllowModelNo" && info.Status == "No")
                 {
                     cmbModalNo.Enabled = false;
                     btnModalNo.Enabled = false;
                 }
                 if (info.SettingsName == "AllowGodown" && info.Status == "Yes")
                 {
                     cmbDefaultGodown.Enabled = true;
                     btnDefaultGodownAdd.Enabled = true;
                     dgvProductCreation.Columns["dgvcmbtgodown"].Visible = true;
                 }
                 if (info.SettingsName == "AllowGodown" && info.Status == "No")
                 {
                     cmbDefaultGodown.Enabled = false;
                     btnDefaultGodownAdd.Enabled = false;
                     dgvProductCreation.Columns["dgvcmbtgodown"].Visible = false;
                 }
                 if (info.SettingsName == "AllowRack" && info.Status == "Yes")
                 {
                     cmbDefaultRack.Enabled = true;
                     btnDefaultAdd.Enabled = true;
                     dgvProductCreation.Columns["dgvcmbrack"].Visible = true;
                 }
                 if (info.SettingsName == "AllowRack" && info.Status == "No")
                 {
                     cmbDefaultRack.Enabled = false;
                     btnDefaultAdd.Enabled = false;
                     dgvProductCreation.Columns["dgvcmbrack"].Visible = false;
                 }
                 if (info.SettingsName == "Tax" && info.Status == "No")
                 {
                     cmbTax.Enabled = false;
                     btnTaxAdd.Enabled = false;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PC:74" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// Function to fill Datagridview after calculation
        /// </summary>
        public void GridFill()
        {
            try
            {
                if (!isFormLoad)
                {
                    string calculationMethod = string.Empty;
                    SettingsInfo InfoSettings = new SettingsInfo();
                    SettingsBll BllSettings = new SettingsBll();
                    //--------------- Selection Of Calculation Method According To Settings ------------------//
                    if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "FIFO")
                    {
                        calculationMethod = "FIFO";
                    }
                    else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Average Cost")
                    {
                        calculationMethod = "Average Cost";
                    }
                    else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "High Cost")
                    {
                        calculationMethod = "High Cost";
                    }
                    else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Low Cost")
                    {
                        calculationMethod = "Low Cost";
                    }
                    else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Last Purchase Rate")
                    {
                        calculationMethod = "Last Purchase Rate";
                    }
                    FinancialStatementBll bllFinancialStatement = new FinancialStatementBll();

                    DataTable dtbl1 = new DataTable();
                    CurrencyInfo InfoCurrency = new CurrencyInfo();
                    CurrencyBll BllCurrency = new CurrencyBll();
                    int inDecimalPlaces = InfoCurrency.NoOfDecimalPlaces;
                    decimal dcClosingStock = bllFinancialStatement.StockValueGetOnDate(Convert.ToDateTime(txtTodate.Text), calculationMethod, false, false);
                    dcClosingStock = Math.Round(dcClosingStock, inDecimalPlaces);
                    //---------------------Opening Stock-----------------------
                    decimal dcOpeninggStock = bllFinancialStatement.StockValueGetOnDate(PublicVariables._dtFromDate, calculationMethod, true, true);
                    decimal dcProfit = 0;
                    DataSet dsetProfitAndLoss = new DataSet();
                    dsetProfitAndLoss = bllFinancialStatement.ProfitAndLossAnalysisUpToaDateForBalansheet(PublicVariables._dtFromDate, DateTime.Parse(txtTodate.Text));
                    DataTable dtblProfit = new DataTable();
                    dtblProfit = dsetProfitAndLoss.Tables[0];
                    for (int i = 0; i < dsetProfitAndLoss.Tables.Count; ++i)
                    {
                        dtbl1 = dsetProfitAndLoss.Tables[i];
                        decimal dcSum = 0;
                        if (i == 0 || (i % 2) == 0)
                        {
                            if (dtbl1.Rows.Count > 0)
                            {
                                dcSum = decimal.Parse(dtbl1.Compute("Sum(Debit)", string.Empty).ToString());
                            }
                        }
                        else
                        {
                            if (dtbl1.Rows.Count > 0)
                            {
                                dcSum = decimal.Parse(dtbl1.Compute("Sum(Credit)", string.Empty).ToString());
                            }
                        }
                    }
                    DateValidation objValidation = new DateValidation();
                    objValidation.DateValidationFunction(txtTodate);
                    if (txtTodate.Text == string.Empty)
                        txtTodate.Text = PublicVariables._dtToDate.ToString("dd-MMM-yyyy");
                    Font newFont = new Font(dgvTrailBalance.Font, FontStyle.Bold);

                    DataSet DsetTrailbalance = new DataSet();
                    DataTable dtbl = new DataTable();
                    decimal dcTotalCredit = 0;
                    decimal dcTotalDebit = 0;
                    DateValidation objvalidation = new DateValidation();
                    objvalidation.DateValidationFunction(txtFromDate);
                    if (txtFromDate.Text == string.Empty)
                    {
                        txtFromDate.Text = PublicVariables._dtFromDate.ToString("dd-MMM-yyyy");
                    }
                    objvalidation.DateValidationFunction(txtTodate);
                    if (txtTodate.Text == string.Empty)
                    {
                        txtTodate.Text = PublicVariables._dtToDate.ToString("dd-MMM-yyyy");
                    }
                    DataTable dtblTrail = new DataTable();
                    DataTable dtblTrail1 = new DataTable();
                    DataTable dtblProfitAndLossAcc = new DataTable();
                    DataTable dtblProfitAndLossAcc1 = new DataTable();
                    DataSet dsTrial = new DataSet();
                    Font newfont = new Font(dgvTrailBalance.Font, FontStyle.Bold);

                    dgvTrailBalance.Rows.Clear();
                    dsTrial = bllFinancialStatement.TrialBalance(DateTime.Parse(txtFromDate.Text), DateTime.Parse(txtTodate.Text), 0);
                    dtblTrail = dsTrial.Tables[0];
                    dtblProfitAndLossAcc = dsTrial.Tables[1];
                    if (dgvTrailBalance.RowCount > 0)
                    {
                        dcTotalCredit = decimal.Parse(dtblTrail.Compute("Sum(credit)", string.Empty).ToString());
                        dcTotalDebit = decimal.Parse(dtblTrail.Compute("Sum(debit)", string.Empty).ToString());
                    }
                    for (int i = 0; i < dtblTrail.Rows.Count; ++i)
                    {
                        dgvTrailBalance.Rows.Add();
                        if (Convert.ToDecimal(dtblTrail.Rows[i]["accountGroupId"].ToString()) != 6)
                        {
                            dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtAccountGroupId"].Value = dtblTrail.Rows[i]["accountGroupId"];
                            dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["accountGroupName"].Value = dtblTrail.Rows[i]["name"];
                            dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["openingBalance"].Value = dtblTrail.Rows[i]["OpeningBalance"];
                            dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtBalance"].Value = dtblTrail.Rows[i]["Balance"];
                            dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["credit"].Value = dtblTrail.Rows[i]["credit"];
                            dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["debit"].Value = dtblTrail.Rows[i]["debit"];
                            dcTotalCredit += decimal.Parse(dtblTrail.Rows[i]["credit"].ToString());
                            dcTotalDebit += decimal.Parse(dtblTrail.Rows[i]["debit"].ToString());
                        }
                        else
                        {
                            decimal decOpBalance = dcOpeninggStock + Convert.ToDecimal(dtblTrail.Rows[i]["OpBalance"].ToString());
                            decimal decBalance = dcOpeninggStock + Convert.ToDecimal(dtblTrail.Rows[i]["Balance1"].ToString());
                            string strOpBalance = string.Empty;
                            string strBalance = string.Empty;
                            if (decOpBalance < 0)
                            {
                                strOpBalance = Math.Round(decOpBalance, PublicVariables._inNoOfDecimalPlaces).ToString() + "Cr";
                            }
                            else
                            {
                                strOpBalance = Math.Round(decOpBalance, PublicVariables._inNoOfDecimalPlaces).ToString() + "Dr";
                            }
                            if (decBalance < 0)
                            {
                                strBalance = Math.Round(decBalance, PublicVariables._inNoOfDecimalPlaces).ToString() + "Cr";
                            }
                            else
                            {
                                strBalance = Math.Round(decBalance, PublicVariables._inNoOfDecimalPlaces).ToString() + "Dr";
                            }
                            dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtAccountGroupId"].Value = dtblTrail.Rows[i]["accountGroupId"];
                            dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["accountGroupName"].Value = dtblTrail.Rows[i]["name"];
                            dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["openingBalance"].Value = strOpBalance;
                            dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtBalance"].Value = strBalance;
                            dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["credit"].Value = dtblTrail.Rows[i]["credit"];
                            dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["debit"].Value = dtblTrail.Rows[i]["debit"];
                            dcTotalCredit += decimal.Parse(dtblTrail.Rows[i]["credit"].ToString());
                            dcTotalDebit += decimal.Parse(dtblTrail.Rows[i]["debit"].ToString());
                        }
                    }
                    decimal OpeningProfit;
                    dtblProfitAndLossAcc1 = dsTrial.Tables[2];
                    if (dgvTrailBalance.RowCount > 0)
                    {
                        decimal dcTotalCredit1 = decimal.Parse(dtblTrail.Compute("Sum(credit)", string.Empty).ToString());
                        decimal dcTotalDebit1 = decimal.Parse(dtblTrail.Compute("Sum(debit)", string.Empty).ToString());
                        OpeningProfit = dcTotalCredit1 + dcTotalDebit1;
                    }
                    DataSet DsetBalanceSheet = new DataSet();
                    DsetBalanceSheet = bllFinancialStatement.BalanceSheet(PublicVariables._dtFromDate, DateTime.Parse(txtTodate.Text));
                    DataTable dtblProf = new DataTable();
                    decimal dcProfitOpening = 0;
                    dtblProf = DsetBalanceSheet.Tables[2];
                    decimal decProfitLedger = 0;
                    if (dtblProf.Rows.Count > 0)
                    {
                        decProfitLedger = decimal.Parse(dtblProf.Compute("Sum(Balance)", string.Empty).ToString());
                    }
                    DataTable dtblProfitLedgerOpening = new DataTable();
                    dtblProfitLedgerOpening = DsetBalanceSheet.Tables[3];
                    decimal decProfitLedgerOpening = 0;
                    foreach (DataRow dRow in dtblProfitLedgerOpening.Rows)
                    {
                        decProfitLedgerOpening += decimal.Parse(dRow["Balance"].ToString());
                    }
                    decimal decTotalProfitAndLoss = decProfitLedger;
                    decimal OpeningProfit1;
                    decimal openingBalance;
                    dgvTrailBalance.Rows.Add();
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtSlNo"].Value = "  ";
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["accountGroupName"].Value = "Profit and Loss";
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtAccountGroupId"].Value = "0";
                    openingBalance = Convert.ToDecimal(dtblProfitAndLossAcc.Rows[0]["OpeningBalance"].ToString());
                    {
                        if (openingBalance > 0)
                        {
                            dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["openingBalance"].Value = openingBalance + "Dr";
                        }
                        else
                            dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["openingBalance"].Value = (-1) * openingBalance + "Cr";
                    }
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtSlNo"].Value = dgvTrailBalance.Rows.Count.ToString();
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].DefaultCellStyle.ForeColor = Color.Blue;
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].DefaultCellStyle.Font = new Font(dgvTrailBalance.Font, FontStyle.Regular);
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["credit"].Value = dtblProfitAndLossAcc.Rows[0]["credit"].ToString();
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["debit"].Value = dtblProfitAndLossAcc.Rows[0]["debit"].ToString();
                    OpeningProfit1 = (Convert.ToDecimal(dtblProfitAndLossAcc.Rows[0]["OpeningBalance"].ToString())) + Convert.ToDecimal(dtblProfitAndLossAcc.Rows[0]["debit"].ToString()) - Convert.ToDecimal(dtblProfitAndLossAcc.Rows[0]["credit"].ToString());
                    {
                        if (OpeningProfit1 > 0)
                        {
                            dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtBalance"].Value = decTotalProfitAndLoss + dcProfit + "Dr";
                        }
                        else
                            dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtBalance"].Value = (-1) * decTotalProfitAndLoss - dcProfit + "Cr";
                    };
                    dcTotalCredit = dcTotalCredit + Convert.ToDecimal(dtblProfitAndLossAcc.Rows[0]["credit"].ToString());
                    dcTotalDebit = dcTotalDebit + Convert.ToDecimal(dtblProfitAndLossAcc.Rows[0]["debit"].ToString());
                    //=================================Net profit and NetLoss transation for previousyear==============
                    decimal decprofitLossbal = 0;
                    decimal decbalance = 0;
                    decimal decProfitAndLossOfPrevious = decProfitLedgerOpening;
                    dgvTrailBalance.Rows.Add();
                    if (dcProfitOpening > 0)
                    {
                        dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["openingBalance"].Value = dcProfitOpening + "Dr";
                        decprofitLossbal = dcProfitOpening;
                    }
                    if (dcProfitOpening <= 0)
                    {
                        dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["openingBalance"].Value = (-1) * dcProfitOpening + "Cr";
                        decprofitLossbal = dcProfitOpening;
                    }
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtSlNo"].Value = "  ";
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["accountGroupName"].Value = "Profit and Loss Opening";
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["openingBalance"].Value = "0.00Dr";
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].DefaultCellStyle.ForeColor = Color.Brown;
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].DefaultCellStyle.Font = new Font(dgvTrailBalance.Font, FontStyle.Regular);
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtAccountGroupId"].Value = "0";
                    if (decProfitAndLossOfPrevious > 0)
                    {
                        dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["debit"].Value = decProfitAndLossOfPrevious;
                        dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["credit"].Value = "0.00";
                        decbalance = (decProfitAndLossOfPrevious);
                    }
                    if (decProfitAndLossOfPrevious <= 0)
                    {
                        dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["credit"].Value = (-1) * (decProfitAndLossOfPrevious);
                        dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["debit"].Value = "0.00";
                        decbalance = ((decProfitAndLossOfPrevious));
                    }
                    if (decbalance >= 0)
                    {
                        dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtBalance"].Value = decbalance + decprofitLossbal + "Dr";
                    }
                    if (decbalance < 0)
                    {
                        decbalance = -(decbalance);
                        dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtBalance"].Value = decbalance + decprofitLossbal + "Cr";
                    }
                    dgvTrailBalance.Rows.Add();
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtSlNo"].Value = "  ";
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["accountGroupName"].Value = "Total:";
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["dgvtxtSlNo"].Value = string.Empty;
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].DefaultCellStyle.ForeColor = Color.Red;
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].DefaultCellStyle.Font = new Font(dgvTrailBalance.Font, FontStyle.Bold);
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["credit"].Value = dcTotalCredit;
                    dgvTrailBalance.Rows[dgvTrailBalance.Rows.Count - 1].Cells["debit"].Value = dcTotalDebit;
                    if (dgvTrailBalance.Columns.Count > 0)
                    {
                        dgvTrailBalance.Columns["credit"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                        dgvTrailBalance.Columns["debit"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                        dgvTrailBalance.Columns["openingBalance"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                        dgvTrailBalance.Columns["dgvtxtBalance"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                    }
                    dgvTrailBalance.ScrollBars = ScrollBars.Both;
                    dgvTrailBalance.ClearSelection();
                    if (inCurrenRowIndex > 0 && dgvTrailBalance.Rows.Count > 0 && inCurrenRowIndex < dgvTrailBalance.Rows.Count)
                    {
                        if (dgvTrailBalance.Rows[inCurrenRowIndex].Cells[inCurrentColIndex].Visible)
                        {
                            dgvTrailBalance.CurrentCell = dgvTrailBalance.Rows[inCurrenRowIndex].Cells[inCurrentColIndex];
                        }
                        else
                        {
                            dgvTrailBalance.CurrentCell = dgvTrailBalance.Rows[inCurrenRowIndex].Cells["debit"];
                        }
                        dgvTrailBalance.CurrentCell.Selected = true;
                    }
                    inCurrenRowIndex = 0;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Tb:2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 54
0
		public virtual void ProcessRequest(System.Web.HttpContext context)
		{
			try
			{
				if (HttpContext.Current.Items["PortalSettings"] != null)
				{
					_ps = (DotNetNuke.Entities.Portals.PortalSettings)(HttpContext.Current.Items["PortalSettings"]);
					_pid = _ps.PortalId;
				}
				else
				{
					string DomainName = null;
					DotNetNuke.Entities.Portals.PortalAliasInfo objPortalAliasInfo = null;
					string sUrl = HttpContext.Current.Request.RawUrl.Replace("http://", string.Empty).Replace("https://", string.Empty);
					objPortalAliasInfo = DotNetNuke.Entities.Portals.PortalSettings.GetPortalAliasInfo(HttpContext.Current.Request.Url.Host);
					_pid = objPortalAliasInfo.PortalID;
					_ps = DotNetNuke.Entities.Portals.PortalController.GetCurrentPortalSettings();


				}

				//Dim sc As New Social.SocialSettings
				//_mainSettings = sc.LoadSettings[_ps.PortalId]
				_mainSettings = DataCache.MainSettings(ModuleId);
				//  If context.Request.IsAuthenticated Then
				_isValid = true;
				if (AdminRequired & ! context.Request.IsAuthenticated)
				{
					_isValid = false;
					return;
				}
				if (AdminRequired && context.Request.IsAuthenticated)
				{
					//_isValid = DotNetNuke.Security.PortalSecurity.IsInRole(_ps.AdministratorRoleName)
					DotNetNuke.Entities.Modules.ModuleController objMC = new DotNetNuke.Entities.Modules.ModuleController();
					DotNetNuke.Entities.Modules.ModuleInfo objM = objMC.GetModule(ModuleId, TabId);
					string roleIds = Permissions.GetRoleIds(objM.AuthorizedEditRoles.Split(';'), PortalId);
					_isValid = Modules.ActiveForums.Permissions.HasAccess(roleIds, ForumUser.UserRoles);
				}
				else if (AdminRequired & ! context.Request.IsAuthenticated)
				{
					_isValid = false;
					return;
				}
				string p = HttpContext.Current.Request.Params["p"];
				if (! (string.IsNullOrEmpty(p)))
				{
					_params = Utilities.JSON.ConvertFromJSONAssoicativeArrayToHashTable(p);
				}

				if (context.Request.Files.Count == 0)
				{
					string jsonPost = string.Empty;
					string prop = string.Empty;
					bool propComplete = true;
					string val = string.Empty;
					string tmp = string.Empty;
					bool bObj = false;
					//Arrays
					List<string> slist = null;
					//Dim pairs As NameValueCollection = Nothing
					Hashtable pairs = null;
					Hashtable subPairs = null;

					Hashtable ht = new Hashtable();
					int idx = 0;
					string parentProp = string.Empty;
					string skip = "{}[]:," + ((char)(34)).ToString();
					using (System.IO.StreamReader sr = new System.IO.StreamReader(context.Request.InputStream, System.Text.Encoding.UTF8))
					{
						while ( ! (sr.EndOfStream))
						{
							char c = (char)(sr.Read());
							if (idx > 0 && c == '[')
							{
								c = (char)(sr.Read());
								bObj = true;
							}
							if (idx > 0 && c == '{')
							{
								if (pairs == null)
								{
									parentProp = prop;
									prop = string.Empty;
									tmp = string.Empty;
									//pairs = New NameValueCollection
									pairs = new Hashtable();
								}
								else if (subPairs == null)
								{
									string subString = c.ToString();
									while ( c != '}')
									{
										c = (char)(sr.Read());
										subString += c;
										if (c == '}')
										{
											break;
										}
									}
									subPairs = Utilities.JSON.ConvertFromJSONAssoicativeArrayToHashTable(subString);
									pairs.Add(prop, subPairs);
									prop = string.Empty;
									tmp = string.Empty;
									subPairs = null;
									c = (char)(sr.Read());
								}
							}

							if (idx > 0 && bObj == true && ! (c == '{'))
							{
								string subItem = string.Empty;
								while ( c != ']')
								{
									if (slist == null)
									{
										slist = new List<string>();
									}
									if (skip.IndexOf(c) == -1)
									{
										subItem += c;
									}

									c = (char)(sr.Read());
									if (c == ',' || c == ']')
									{
										slist.Add(subItem);
										subItem = string.Empty;
									}
									if (c == ']')
									{
										c = (char)(sr.Read());
										bObj = false;
										break;

									}
								}
							}
							if (c == ':')
							{
								prop = tmp;
								tmp = string.Empty;
							}
							if (skip.IndexOf(c) == -1)
							{
								tmp += c;
							}
							if (c == ',' || c == '}')
							{
								if (! (string.IsNullOrEmpty(tmp)))
								{
									tmp = HttpUtility.UrlDecode(tmp);
								}
								if (slist != null)
								{
									ht.Add(prop, slist);
									slist = null;
								}
								else if (pairs != null && c == ',' && ! (string.IsNullOrEmpty(prop)))
								{
									pairs.Add(prop, tmp);
								}
								else if (pairs != null && c == '}')
								{
									if (! (string.IsNullOrEmpty(tmp)))
									{
										pairs.Add(prop, tmp);
									}
									ht.Add(parentProp, pairs);
									parentProp = string.Empty;
									pairs = null;
								}
								else if (! (string.IsNullOrEmpty(prop)))
								{
									ht.Add(prop, tmp);
								}

								prop = string.Empty;
								tmp = string.Empty;
							}

							idx += 1;

						}
						if (pairs != null & ! (string.IsNullOrEmpty(parentProp)))
						{
							ht.Add(parentProp, pairs);
						}
						else if (! (string.IsNullOrEmpty(prop)) && ! (string.IsNullOrEmpty(tmp)))
						{
							ht.Add(prop, HttpUtility.UrlDecode(tmp));
						}
						else if (! (string.IsNullOrEmpty(prop)) && slist != null)
						{
							ht.Add(prop, slist);
						}

						//jsonPost = sr.ReadToEnd()
						sr.Close();
					}
					_params = ht;
					//End If
				}
				else
				{
					Hashtable ht = new Hashtable();
					foreach (string s in context.Request.Params.AllKeys)
					{
						if (! (ht.ContainsKey(s)))
						{
							ht.Add(s, context.Request.Params[s]);
						}

					}
					_params = ht;
				}

				if (HttpContext.Current.Request.IsAuthenticated)
				{
					UserId = UserController.GetUserIdByUserName(PortalId, HttpContext.Current.User.Identity.Name);
				}
				else
				{
					UserId = -1;
				}

			}
			catch (Exception ex)
			{
				_isValid = false;
				Exceptions.LogException(ex);

			}



		}
Ejemplo n.º 55
0
        /// <summary>
        /// Pull out persisted settings and set property descriptor values</summary>
        /// <remarks>marked 'internal' for use by SettingsLoadSaveDialog only</remarks>
        /// <param name="stream">Persisted settings</param>
        /// <returns>true if successful otherwise false</returns>
        protected bool Deserialize(Stream stream)
        {
            // create XML DOM from stream
            // if failed, display message box and return
            try
            {
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(stream);

                XmlElement root = xmlDoc.DocumentElement;

                // get all the blocks
                XmlNodeList blocks = root.SelectNodes("block");
                if (blocks == null || blocks.Count == 0)
                    throw new Exception("The setting file is empty");

                foreach (XmlElement block in blocks)
                {
                    try
                    {
                        string id = block.GetAttribute("id");

                        SettingsInfo info;
                        if (!m_settings.TryGetValue(id, out info))
                        {
                            info = new SettingsInfo(id);
                            m_settings.Add(id, info);
                        }

                        // get a list of value element in each block
                        XmlNodeList valueNodes = block.SelectNodes("value");

                        // skip over empty block
                        if (valueNodes == null || valueNodes.Count == 0)
                            continue;

                        foreach (XmlElement xmlElement in valueNodes)
                        {
                            string name = xmlElement.GetAttribute("name");
                            string valueString = GetElementValueString(xmlElement);

                            info.Add(name, valueString);
                        }
                    }
                    catch (Exception ex)
                    {
                        Outputs.WriteLine(OutputMessageType.Error, ex.Message);
                    }
                }

                OnReloaded();
            }
            catch (Exception ex)
            {
                Outputs.WriteLine(
                    OutputMessageType.Error,
                    "Can't load settings".Localize() + ": {0}",
                    ex.Message);

                return false;
            }

            return true;
        }
        /// <summary>
        /// Function to fill Datagridview
        /// </summary>
        public void Gridfill()
        {
            try
            {
                if (!isFormLoad)
                {
                    DateValidation objValidation = new DateValidation();
                    objValidation.DateValidationFunction(txtFromDate);
                    if (txtFromDate.Text == string.Empty)
                        txtFromDate.Text = PublicVariables._dtFromDate.ToString("dd-MMM-yyyy");
                    objValidation.DateValidationFunction(txtToDate);
                    if (txtToDate.Text == string.Empty)
                        txtToDate.Text = PublicVariables._dtToDate.ToString("dd-MMM-yyyy");
                    Font newFont = new Font(dgvProfitAndLoss.Font, FontStyle.Bold);
                    CurrencyInfo InfoCurrency = new CurrencyInfo();
                    CurrencyBll BllCurrency = new CurrencyBll();
                    InfoCurrency = BllCurrency.CurrencyView(1);
                    int inDecimalPlaces = InfoCurrency.NoOfDecimalPlaces;
                    dgvProfitAndLoss.Rows.Clear();
                    FinancialStatementBll bllFinancialStatement = new FinancialStatementBll();

                    DataTable dtblFinancial = new DataTable();
                    DataSet DsetProfitAndLoss = new DataSet();
                    SettingsInfo infoSettings = new SettingsInfo();
                    SettingsBll BllSettings = new SettingsBll();
                    //---------check  calculation method
                    if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "FIFO")
                    {
                        calculationMethod = "FIFO";
                    }
                    else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Average Cost")
                    {
                        calculationMethod = "Average Cost";
                    }
                    else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "High Cost")
                    {
                        calculationMethod = "High Cost";
                    }
                    else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Low Cost")
                    {
                        calculationMethod = "Low Cost";
                    }
                    else if (BllSettings.SettingsStatusCheck("StockValueCalculationMethod") == "Last Purchase Rate")
                    {
                        calculationMethod = "Last Purchase Rate";
                    }
                    DsetProfitAndLoss = bllFinancialStatement.ProfitAndLossAnalysis(DateTime.Parse(txtFromDate.Text), DateTime.Parse(txtToDate.Text));
                    //---- Opening Stock
                    dgvProfitAndLoss.Rows.Add();
                    decimal dcOpeningStock = bllFinancialStatement.StockValueGetOnDate(DateTime.Parse(txtFromDate.Text), DateTime.Parse(txtToDate.Text), calculationMethod, true, false);
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtExpenses"].Value = "Opening Stock";
                    if (dcOpeningStock > 0)
                    {
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = Math.Round(dcOpeningStock, inDecimalPlaces);
                    }
                    else
                    {
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = -(Math.Round(dcOpeningStock, inDecimalPlaces));
                    }
                    //Closing Stock
                    decimal dcClosingStock = 0;
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtIncome"].Value = "Closing Stock";
                    dcClosingStock = bllFinancialStatement.StockValueGetOnDate(DateTime.Parse(txtToDate.Text), calculationMethod, false, false);
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = Math.Round(dcClosingStock, inDecimalPlaces);
                    /// ---Purchase Account  - Debit
                    dtblFinancial = new DataTable();
                    dtblFinancial = DsetProfitAndLoss.Tables[0];
                    dgvProfitAndLoss.Rows.Add();
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtExpenses"].Value = "Purchase Accounts";
                    decimal dcPurchaseAccount = 0m;
                    if (dtblFinancial.Rows.Count > 0)
                    {
                        foreach (DataRow rw in dtblFinancial.Rows)
                        {
                            decimal dcBalance = decimal.Parse(rw["Debit"].ToString().ToString());
                            dcPurchaseAccount += dcBalance;
                        }
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtGroupId1"].Value = "11";
                    }
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = dcPurchaseAccount.ToString();
                    //---Sales Account  -Credit
                    dtblFinancial = new DataTable();
                    dtblFinancial = DsetProfitAndLoss.Tables[1];
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtIncome"].Value = "Sales Accounts";
                    decimal dcSalesAccount = 0m;
                    if (dtblFinancial.Rows.Count > 0)
                    {
                        foreach (DataRow rw in dtblFinancial.Rows)
                        {
                            decimal dcBalance = decimal.Parse(rw["Credit"].ToString().ToString());
                            dcSalesAccount += dcBalance;
                        }
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtGroupId2"].Value = "10";
                    }
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = dcSalesAccount.ToString();
                    dgvProfitAndLoss.Rows.Add();
                    dgvProfitAndLoss.Rows.Add();
                    //---Direct Expense
                    dtblFinancial = new DataTable();
                    dtblFinancial = DsetProfitAndLoss.Tables[2];
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtExpenses"].Value = "Direct Expenses";
                    decimal dcDirectExpense = 0m;
                    if (dtblFinancial.Rows.Count > 0)
                    {
                        foreach (DataRow rw in dtblFinancial.Rows)
                        {
                            decimal dcBalance = Convert.ToDecimal(rw["Debit"].ToString());
                            dcDirectExpense += dcBalance;
                        }
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtGroupId1"].Value = "13";
                    }
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = dcDirectExpense.ToString();
                    //----Direct Income
                    dtblFinancial = new DataTable();
                    dtblFinancial = DsetProfitAndLoss.Tables[3];
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtIncome"].Value = "Direct Incomes";
                    decimal dcDirectIncoome = 0m;
                    if (dtblFinancial.Rows.Count > 0)
                    {
                        foreach (DataRow rw in dtblFinancial.Rows)
                        {
                            decimal dcBalance = Convert.ToDecimal(rw["Credit"].ToString());
                            dcDirectIncoome += dcBalance;
                        }
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtGroupId2"].Value = "12";
                    }
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = dcDirectIncoome.ToString();
                    dgvProfitAndLoss.Rows.Add();
                    dgvProfitAndLoss.Rows.Add();
                    dgvProfitAndLoss.Rows.Add();
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = "_______________________";
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = "_______________________";
                    dgvProfitAndLoss.Rows.Add();
                    decimal dcTotalExpense = 0;
                    decimal dcTotalIncome = 0;
                    dcTotalExpense = dcOpeningStock + dcPurchaseAccount + dcDirectExpense;
                    dcTotalIncome = dcClosingStock + dcSalesAccount + dcDirectIncoome;
                    dcTotalExpense = Math.Round(dcTotalExpense, inDecimalPlaces);
                    dcTotalIncome = Math.Round(dcTotalIncome, inDecimalPlaces);
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].DefaultCellStyle.Font = newFont;
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtExpenses"].Value = "Total";
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtIncome"].Value = "Total";
                    decimal dcGrossProfit = 0;
                    decimal dcGrossLoss = 0;
                    if (dcTotalExpense > dcTotalIncome)
                    {
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = dcTotalExpense.ToString();
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = dcTotalExpense.ToString();
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtIncome"].Value = "Gross Loss b/d ";
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtAmount2"].Value = dcTotalExpense - dcTotalIncome;
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtAmount2"].Style.ForeColor = Color.Red;
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtIncome"].Style.ForeColor = Color.Red;
                        dgvProfitAndLoss.Rows.Add();
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtExpenses"].Value = "Gross Loss b/d ";
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = dcTotalExpense - dcTotalIncome;
                        dcGrossLoss = dcTotalExpense - dcTotalIncome;
                    }
                    else
                    {
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = dcTotalIncome.ToString();
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = dcTotalIncome.ToString();
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtExpenses"].Value = "Gross Profit c/d ";
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtAmount1"].Value = dcTotalIncome - dcTotalExpense;
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtAmount1"].Style.ForeColor = Color.Green;
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtExpenses"].Style.ForeColor = Color.Green;
                        dgvProfitAndLoss.Rows.Add();
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtIncome"].Value = "Gross Profit c/d ";
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = dcTotalIncome - dcTotalExpense;
                        dcGrossProfit = dcTotalIncome - dcTotalExpense;
                    }
                    dgvProfitAndLoss.Rows.Add();
                    ///------Indirect Expense
                    dtblFinancial = new DataTable();
                    dtblFinancial = DsetProfitAndLoss.Tables[4];
                    dgvProfitAndLoss.Rows.Add();
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtExpenses"].Value = "Indirect Expenses";
                    decimal dcIndirectExpense = 0;
                    if (dtblFinancial.Rows.Count > 0)
                    {
                        foreach (DataRow rw in dtblFinancial.Rows)
                        {
                            decimal dcBalance = Convert.ToDecimal(rw["Debit"].ToString());
                            dcIndirectExpense += dcBalance;
                        }
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtGroupId1"].Value = "15";
                    }
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = dcIndirectExpense.ToString();
                    ///---Indirect Income
                    dtblFinancial = new DataTable();
                    dtblFinancial = DsetProfitAndLoss.Tables[5];
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtIncome"].Value = "Indirect Incomes";
                    decimal dcIndirectIncome = 0m;
                    if (dtblFinancial.Rows.Count > 0)
                    {
                        foreach (DataRow rw in dtblFinancial.Rows)
                        {
                            decimal dcBalance = Convert.ToDecimal(rw["Credit"].ToString());
                            dcIndirectIncome += dcBalance;
                        }
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtGroupId2"].Value = "14";
                    }
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = dcIndirectIncome.ToString();
                    //---- Calculating Grand total
                    decimal dcGrandTotalExpense = dcGrossLoss + dcIndirectExpense;
                    decimal dcGrandTotalIncome = dcGrossProfit + dcIndirectIncome;
                    dgvProfitAndLoss.Rows.Add();
                    dgvProfitAndLoss.Rows.Add();
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = "_______________________";
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = "_______________________";
                    dgvProfitAndLoss.Rows.Add();
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtExpenses"].Value = "Grand Total";
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtIncome"].Value = "Grand Total";
                    dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].DefaultCellStyle.Font = newFont;
                    if (dcGrandTotalExpense > dcGrandTotalIncome)
                    {
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = dcGrandTotalExpense.ToString();
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = dcGrandTotalExpense.ToString();
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtIncome"].Value = "Net Loss ";
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtAmount2"].Value = dcGrandTotalExpense - dcGrandTotalIncome;
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtIncome"].Style.ForeColor = Color.Red;
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtAmount2"].Style.ForeColor = Color.Red;
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].DefaultCellStyle.Font = newFont;
                        decgranExTotal = dcGrandTotalExpense;
                    }
                    else
                    {
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount1"].Value = dcGrandTotalIncome.ToString();
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 1].Cells["dgvtxtAmount2"].Value = dcGrandTotalIncome.ToString();
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtExpenses"].Value = "Net Profit";
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtAmount1"].Value = dcGrandTotalIncome - dcGrandTotalExpense;
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtExpenses"].Style.ForeColor = Color.Green;
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].Cells["dgvtxtAmount1"].Style.ForeColor = Color.Green;
                        dgvProfitAndLoss.Rows[dgvProfitAndLoss.Rows.Count - 3].DefaultCellStyle.Font = newFont;
                        decgranIncTotal = dcGrandTotalIncome;
                    }
                    if (dgvProfitAndLoss.Columns.Count > 0)
                    {
                        dgvProfitAndLoss.Columns["dgvtxtAmount1"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                        dgvProfitAndLoss.Columns["dgvtxtAmount2"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                    }
                    if (inCurrenRowIndex >= 0 && dgvProfitAndLoss.Rows.Count > 0 && inCurrenRowIndex < dgvProfitAndLoss.Rows.Count)
                    {
                        if (dgvProfitAndLoss.Rows[inCurrenRowIndex].Cells[inCurrentColunIndex].Visible)
                        {
                            dgvProfitAndLoss.CurrentCell = dgvProfitAndLoss.Rows[inCurrenRowIndex].Cells[inCurrentColunIndex];
                        }
                        else
                        {
                            dgvProfitAndLoss.CurrentCell = dgvProfitAndLoss.Rows[inCurrenRowIndex].Cells["dgvtxtExpenses"];
                        }
                        dgvProfitAndLoss.CurrentCell.Selected = true;
                    }
                    inCurrenRowIndex = 0;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PAL :01" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 57
0
        public void AddNewSettings(SettingsInfo settingsInfo)
        {
            try
            {
                XDocument doc = xmlFileManager.Open();
                XNamespace ns = doc.Root.GetDefaultNamespace();

                if (settingsInfo == null)
                    throw new ArgumentNullException("settingsInfo");

                settingsInfo.Id = Settings.Select(n => n.Id).Max() + 1;

                doc.Element(ns + "settings").Element(ns + "usersRecords").Add(new XElement(ns + "record",
                    new XAttribute("ID", settingsInfo.Id),
                    new XAttribute("processorRef", settingsInfo.Processor.Id),
                    new XElement(ns + "name", settingsInfo.Name),
                    settingsInfo.SerialPortSettings.ToXElement(ns)));

                xmlFileManager.Save(doc);
            }
            catch (SettingsException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new SettingsException(Resources.IncorrectFileWithSettings, ex);
            }
        }
Ejemplo n.º 58
0
 public void CreateSerialPortSettingsException()
 {
     SettingsInfo s = new SettingsInfo(0, "Name",
         new Processor(0, "Name", 0x1000, 0x40000, 0x3E000, 0x3FFFF), null);
 }
Ejemplo n.º 59
0
        public void UpdateSettings(SettingsInfo settingsInfo)
        {
            try
            {
                var p = Settings.First(n => n.Name == settingsInfo.Name);
                if (p != null && p.Id != settingsInfo.Id)
                    throw new SettingsException(Resources.SettingsNameAlreadyExists);

                XDocument doc = xmlFileManager.Open();
                XNamespace ns = doc.Root.GetDefaultNamespace();
                var elements = doc.Element(ns + "settings").Element(ns + "usersRecords").Elements(ns + "record");
                var element = elements.Where(x => Convert.ToInt32(x.Attribute("ID").Value, 10) == settingsInfo.Id).First();
                element.UpdateXElement(settingsInfo, ns);
                xmlFileManager.Save(doc);
            }
            catch (SettingsException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new SettingsException(Resources.IncorrectFileWithSettings, ex);
            }
        }
Ejemplo n.º 60
0
 public void CreateIdException()
 {
     SettingsInfo s = new SettingsInfo(-1, "Name",
         new Processor(0, "Name", 0x1000, 0x40000, 0x3E000, 0x3FFFF),
         new SerialPortSettings(BaudRate.BR_57600, Parity.Even, StopBits.One, 0xA0, 0xA5));
 }