示例#1
0
        private static void LoadReferencedAssemblies(SortedDictionary <string, Assembly> LoadedAssembliesByName,
                                                     SortedDictionary <string, Assembly> LoadedAssembliesByLocation,
                                                     SortedDictionary <string, AssemblyName> ReferencedAssemblies)
        {
            do
            {
                AssemblyName[] References = new AssemblyName[ReferencedAssemblies.Count];
                ReferencedAssemblies.Values.CopyTo(References, 0);
                ReferencedAssemblies.Clear();

                foreach (AssemblyName AN in References)
                {
                    if (LoadedAssembliesByName.ContainsKey(AN.FullName))
                    {
                        continue;
                    }

                    try
                    {
                        Assembly A = AppDomain.CurrentDomain.Load(AN);
                        LoadedAssembliesByName[A.FullName]     = A;
                        LoadedAssembliesByLocation[A.Location] = A;

                        try
                        {
                            foreach (AssemblyName AN2 in A.GetReferencedAssemblies())
                            {
                                ReferencedAssemblies[AN2.FullName] = AN2;
                            }
                        }
                        catch (Exception)
                        {
                            // Referenced assemblies might not be accessible.
                        }
                    }
                    catch (BadImageFormatException ex)
                    {
                        LogException(ex);
                    }
                    catch (Exception)
                    {
                        string s = AN.ToString();

                        if (s.StartsWith("System.") ||
                            s.StartsWith("Microsoft.") ||
                            s.StartsWith("Windows.") ||
                            s.StartsWith("SQLitePCLRaw.") ||
                            s.StartsWith("SkiaSharp") ||
                            s.StartsWith("Gma.QrCodeNet.Encoding") ||
                            s.StartsWith("Esent.Interop"))
                        {
                            continue;
                        }

                        Log.Error("Unable to load assembly " + s + ".", AN.FullName);
                    }
                }
            }while (ReferencedAssemblies.Count > 0);
        }
示例#2
0
        private void Total()
        {
            decimal AN, R, D, CE, PPC, Otro;

            AN = R = D = CE = PPC = Otro = decimal.Zero;

            foreach (var item in dgvDatos.Rows)
            {
                if (!item.IsFilteredOut)
                {
                    if (item.Cells["C"].Value.ToString().Equals("Artículo nuevo"))
                    {
                        AN += item.Cells["Diferencia ($)"].Value == DBNull.Value ? decimal.Zero : Convert.ToDecimal(item.Cells["Diferencia ($)"].Value);
                    }
                    else if (item.Cells["C"].Value.ToString().Equals("Remate"))
                    {
                        R += item.Cells["Diferencia ($)"].Value == DBNull.Value ? decimal.Zero : Convert.ToDecimal(item.Cells["Diferencia ($)"].Value);
                    }
                    else if (item.Cells["C"].Value.ToString().Equals("Devolución"))
                    {
                        D += item.Cells["Diferencia ($)"].Value == DBNull.Value ? decimal.Zero : Convert.ToDecimal(item.Cells["Diferencia ($)"].Value);
                    }
                    else if (item.Cells["C"].Value.ToString().Equals("Compra especial"))
                    {
                        CE += item.Cells["Diferencia ($)"].Value == DBNull.Value ? decimal.Zero : Convert.ToDecimal(item.Cells["Diferencia ($)"].Value);
                    }
                    else if (item.Cells["C"].Value.ToString().Equals("PPC"))
                    {
                        PPC += item.Cells["Diferencia ($)"].Value == DBNull.Value ? decimal.Zero : Convert.ToDecimal(item.Cells["Diferencia ($)"].Value);
                    }
                    else
                    {
                        Otro += item.Cells["Diferencia ($)"].Value == DBNull.Value ? decimal.Zero : Convert.ToDecimal(item.Cells["Diferencia ($)"].Value);
                    }
                }
            }

            txtAN.Text         = AN.ToString("C0");
            txtRemate.Text     = R.ToString("C0");
            txtDevolucion.Text = D.ToString("C0");
            txtCE.Text         = CE.ToString("C0");
            txtPPC.Text        = PPC.ToString("C0");
            txtOtros.Text      = Otro.ToString("C0");
        }
示例#3
0
        /// <summary>
        /// Initializes the inventory engine, registering types and interfaces available in <paramref name="Assemblies"/>.
        /// </summary>
        /// <param name="Folder">Name of folder containing assemblies to load, if they are not already loaded.</param>
        private static void Initialize()
        {
            string Folder = Path.GetDirectoryName(typeof(App).GetTypeInfo().Assembly.Location);

            string[] DllFiles = Directory.GetFiles(Folder, "*.dll", SearchOption.TopDirectoryOnly);
            Dictionary <string, Assembly>     LoadedAssemblies     = new Dictionary <string, Assembly>(StringComparer.CurrentCultureIgnoreCase);
            Dictionary <string, AssemblyName> ReferencedAssemblies = new Dictionary <string, AssemblyName>(StringComparer.CurrentCultureIgnoreCase);

            foreach (string DllFile in DllFiles)
            {
                try
                {
                    Assembly A = Assembly.LoadFile(DllFile);
                    LoadedAssemblies[A.GetName().FullName] = A;

                    foreach (AssemblyName AN in A.GetReferencedAssemblies())
                    {
                        ReferencedAssemblies[AN.FullName] = AN;
                    }
                }
                catch (Exception ex)
                {
                    Log.Critical(ex);
                }
            }

            do
            {
                AssemblyName[] References = new AssemblyName[ReferencedAssemblies.Count];
                ReferencedAssemblies.Values.CopyTo(References, 0);
                ReferencedAssemblies.Clear();

                foreach (AssemblyName AN in References)
                {
                    if (LoadedAssemblies.ContainsKey(AN.FullName))
                    {
                        continue;
                    }

                    try
                    {
                        Assembly A = Assembly.Load(AN);
                        LoadedAssemblies[A.GetName().FullName] = A;

                        foreach (AssemblyName AN2 in A.GetReferencedAssemblies())
                        {
                            ReferencedAssemblies[AN2.FullName] = AN2;
                        }
                    }
                    catch (Exception)
                    {
                        Log.Error("Unable to load assembly " + AN.ToString() + ".");
                    }
                }
            }while (ReferencedAssemblies.Count > 0);

            Assembly[] Assemblies = new Assembly[LoadedAssemblies.Count];
            LoadedAssemblies.Values.CopyTo(Assemblies, 0);

            Types.Initialize(Assemblies);
        }
示例#4
0
    protected void Submit_Click(object sender, EventArgs e)
    {
        try
        {
            string AC, AN;
            AN = AC = "";

            if (DdlCRDR.SelectedValue == "1")
            {
                if (txtLoanBrCode.Text.Trim().ToString() == "")
                {
                    lblMessage.Text = "Select branch first...!!";
                    ModalPopup.Show(this.Page);
                    return;
                }
            }

            if (DdlCRDR.SelectedValue == "0")
            {
                lblMessage.Text = "Select transaction type...!!";
                ModalPopup.Show(this.Page);
                return;
            }

            if (ddlPMTMode.SelectedValue == "0")
            {
                lblMessage.Text = "Select payment mode first...!!!";
                ModalPopup.Show(this.Page);
                return;
            }

            if (ddlPMTMode.SelectedValue == "7")
            {
                if (TxtPtype.Text.Trim().ToString() == "")
                {
                    lblMessage.Text = "Enter product type first...!!";
                    ModalPopup.Show(this.Page);
                    return;
                }

                if (TxtAccNo.Text.Trim().ToString() == "")
                {
                    lblMessage.Text = "Enter account number first...!!";
                    ModalPopup.Show(this.Page);
                    return;
                }
            }

            if (TxtNarration.Text.Trim().ToString() == "")
            {
                lblMessage.Text = "Enter narration first...!!";
                ModalPopup.Show(this.Page);
                return;
            }

            if (Convert.ToDouble(TxtAmount.Text.Trim().ToString() == "" ? "0" : TxtAmount.Text.Trim().ToString()) <= 0.00)
            {
                lblMessage.Text = "Enter proper amount First...!!";
                ModalPopup.Show(this.Page);
                return;
            }

            //If Account Number is blank Then Set Acc No and Cust No to Zero
            string YN = CC.GetIntACCYN(ViewState["LoanBrCode"].ToString(), TxtPtype.Text);
            if (Convert.ToInt32(ViewState["GlCode"].ToString() == "" ? "0" : ViewState["GlCode"].ToString()) >= 100 && YN != "Y")
            {
                AC = "0";
                AN = TxtPname.Text.ToString();
            }
            else
            {
                AC = TxtAccNo.Text.Trim().ToString();
                AN = TxtCustName.Text.ToString();
            }

            //Check Amount is grater than zero or not
            if (Convert.ToDouble(TxtAmount.Text.Trim().ToString() == "" ? "0" : TxtAmount.Text.Trim().ToString()) > 0.00)
            {
                if (txtLoanBrCode.Text.Trim().ToString() == "")
                {
                    ResBrCode = Session["BRCD"].ToString();
                }
                else
                {
                    ResBrCode = txtLoanBrCode.Text.Trim().ToString();
                }

                //Insert Data into Temporary Table (Avs_TempMultiTransfer) in Database here
                if (ddlPMTMode.SelectedValue == "0")
                {
                    ddlPMTMode.Focus();

                    lblMessage.Text = "Select payment mode first...!!";
                    ModalPopup.Show(this.Page);
                    return;
                }
                else if (ddlPMTMode.SelectedValue == "3")
                {
                    resultout = MV.InsertIntoTable(Session["BRCD"].ToString(), Session["BRCD"].ToString(), Session["BRCD"].ToString(), ResBrCode.ToString(), txtCustNo.Text.Trim().ToString() == "" ? "0" : txtCustNo.Text.Trim().ToString(), "99", "99", "0", "", TxtAmount.Text.Trim().ToString(), DdlCRDR.SelectedValue == "1" ? "1" : "2", "3", "CR", "99/0", TxtNarration.Text.ToString(), "0", "1900-01-01", Session["EntryDate"].ToString(), Session["MID"].ToString());
                }
                else if (ddlPMTMode.SelectedValue == "7")
                {
                    resultout = MV.InsertIntoTable(Session["BRCD"].ToString(), Session["BRCD"].ToString(), Session["BRCD"].ToString(), ResBrCode.ToString(), txtCustNo.Text.Trim().ToString() == "" ? "0" : txtCustNo.Text.Trim().ToString(), ViewState["GlCode"].ToString(), TxtPtype.Text.Trim().ToString(), AC.Trim().ToString(), AN.ToString(), TxtAmount.Text.Trim().ToString(), DdlCRDR.SelectedValue == "1" ? "1" : "2", "7", "TR", TxtPtype.Text.Trim().ToString() + "/" + AC.Trim().ToString() + " - " + AN.ToString() + "", TxtNarration.Text.ToString(), "0", "1900-01-01", Session["EntryDate"].ToString(), Session["MID"].ToString());
                }

                if (resultout > 0)
                {
                    ddlPMTMode.Enabled = false;
                    lblMessage.Text    = "Successfully Added...!!";
                    ModalPopup.Show(this.Page);
                }
            }
            else
            {
                lblMessage.Text = "Enter Amount First...!!";
                ModalPopup.Show(this.Page);
                return;
            }

            if (resultout > 0)
            {
                DivBranch.Visible         = false;
                DdlCRDR.SelectedValue     = "0";
                ddlActivity.SelectedValue = "0";
                Getinfo();
                BindTransGrid();
                ClearText();
                DdlCRDR.Focus();
                return;
            }
        }
        catch (Exception Ex)
        {
            ExceptionLogging.SendErrorToText(Ex);
        }
    }