public static void AddNewRowSingleColumn(int OpCode, string SpName, ref GridView dg, ref bool k_blnIsAddingNew, ref HtmlGenericControl DivError, ref Label _LblError)
    {
        string g_strErrorMessage = "";

        try
        {
            DataTable GridTable = GeneralBL.FillDataGrid(OpCode, SpName, ref g_strErrorMessage, "");
            //if ((GridTable.Rows.Count == 0) || (GridTable == null))
            //{
            //    DataRow dr = GridTable.NewRow();
            //    GridTable.Rows.Add(dr);
            //    dg.DataSource = GridTable;
            //    dg.DataBind();
            //}

            DataRow NewRow  = GridTable.NewRow();
            Label   lblName = new Label();
            if (dg.Rows.Count == 0)
            {
                lblName.Text = "";
            }

            /************************************************************
             * Here We have Two Options If the User is on First Pasge then
             */
            //Label lblName = (Label)dg.Rows[0].FindControl(ControlName);

            int nNewItemIndex = dg.Rows.Count;

            if (nNewItemIndex < dg.PageSize)
            {
                if (lblName.Text == "")
                {
                    dg.EditIndex = nNewItemIndex;
                }
                else
                {
                    dg.EditIndex = nNewItemIndex;
                }
            }
            else
            {
                int r            = GridTable.Rows.Count;
                int m_pageNumber = r / nNewItemIndex;
                dg.PageIndex = m_pageNumber;
                r            = (r - nNewItemIndex * m_pageNumber);
                dg.EditIndex = r;
            }
            GridTable.Rows.Add(NewRow);
            GridTable.AcceptChanges();
            dg.DataSource = GridTable;
            dg.DataBind();
            k_blnIsAddingNew = true;
        }
        catch (Exception exp)
        {
            DivError.Visible = true;
            _LblError.Text   = exp.Message;
        }
    }
    public static bool dgRowDeleting(int _OpCode, string SpName, string _RecFieldID, ref GridView dg, ref GridViewDeleteEventArgs e, ref HtmlGenericControl DivError, ref Label _LblError)
    {
        bool _isretval = false;

        try
        {
            string g_strErrorMessage = "";
            if (GeneralBL.isEmptyorNull(dg.DataKeys[e.RowIndex].Value) != "")
            {
                GeneralBL.Delete(_OpCode, SpName, _RecFieldID, Convert.ToInt32(dg.DataKeys[e.RowIndex].Value), ref g_strErrorMessage, "");
                if (g_strErrorMessage.Length > 0)
                {
                    DivError.Visible = true;
                    _LblError.Text   = g_strErrorMessage.Replace("Error : ", "");
                }
                else
                {
                    _isretval = true;
                }
            }
            else
            {
                DivError.Visible = true;
                _LblError.Text   = "No Record Found to delete.";
            }
        }
        catch (Exception exp)
        {
            DivError.Visible = true;
            _LblError.Text   = exp.Message;
        }
        return(_isretval);
    }
    public static bool dgRowDeleting(int _OpCode, string SpName, string _RecFieldID, string _RecFieldValue, ref HtmlGenericControl DivError, ref Label _LblError)
    {
        bool _isretval = false;

        try
        {
            string g_strErrorMessage = "";

            GeneralBL.Delete(_OpCode, SpName, _RecFieldID, _RecFieldValue, ref g_strErrorMessage, "");
            if (g_strErrorMessage.Length > 0)
            {
                DivError.Visible = true;
                _LblError.Text   = g_strErrorMessage.Replace("Error : ", "");
            }
            else
            {
                _isretval = true;
            }
        }
        catch (Exception exp)
        {
            DivError.Visible = true;
            _LblError.Text   = exp.Message;
        }
        return(_isretval);
    }
        protected void GetDataSourceInvoices()
        {
            var lstRoles = (List <Roles>)Session["CCFNRoles"];
            var rolesCSV = "";

            lstRoles.ForEach(rol => rolesCSV += (rol.Name + ", "));
            rolesCSV            = rolesCSV.TrimEnd(',', ' ');
            RadGrid1.DataSource = GeneralBL.GetLog(txtRFC.Text, txtNombre.Text, txtFolio.Text, cmbActionId.SelectedValue, dteDesde.SelectedDate, dteHasta.SelectedDate);
        }
Beispiel #5
0
        protected void GetDataSourceInvoices()
        {
            var lstRoles = (List <Roles>)Session["CCFNRoles"];
            var rolesCSV = "";

            lstRoles.ForEach(rol => rolesCSV += (rol.Name + ", "));
            rolesCSV            = rolesCSV.TrimEnd(',', ' ');
            RadGrid1.DataSource = GeneralBL.GetInvoices(rolesCSV.Contains("ADMINISTRADOR"), ((Users)Session["CCFNUser"]).RFC, txtSerie.Text, txtFolio.Text, dteDesde.SelectedDate, dteHasta.SelectedDate, ((Users)Session["CCFNUser"]).UserId, txtSucursal.Text, txtCodigoCliente.Text, txtRFC.Text);
        }
 public static string FillDataTable()
 {
     try
     {
         DataSet ds = GeneralBL.FillDataSet(40, "SP_RoomType", ref strErrorMessge, strErrorType);
         return(ds.GetXml());
     }
     catch (Exception exp)
     {
         return(strErrorMessge = exp.Message);
     }
 }
 public static string LoadRawItems(string Value)
 {
     try
     {
         strErrorType = strErrorType = "";
         DataSet ds = GeneralBL.FillDataSet(4, "SPR_RawItems", ref strErrorType, strErrorType);
         return(ds.GetXml());
     }
     catch (Exception exp)
     {
         return(strErrorMessage = exp.Message);
     }
 }
Beispiel #8
0
 public static string LoadItemscategory()
 {
     try
     {
         strErrorType = strErrorType = "";
         DataSet ds = GeneralBL.FillDataSet(5, "SPR_ItemsCategory", ref strErrorType, strErrorType);
         return(ds.GetXml());
     }
     catch (Exception exp)
     {
         return(strErrorMessage = exp.Message);
     }
 }
Beispiel #9
0
    public static string EditSuppilers(int SuppliersID)
    {
        try
        {
            strErrorMessage = strErrorType = "";

            DataSet ds = GeneralBL.FillDataSet(4, SuppliersID, "@SuppliersID", "SPR_Suppliers", ref strErrorMessage, strErrorType);
            return(ds.GetXml());
        }
        catch (Exception exp)
        {
            return(strErrorMessage = exp.Message);
        }
    }
Beispiel #10
0
    public static string EditCustomer(int CustomerID)
    {
        try
        {
            strErrorMessage = strErrorType = "";

            DataSet ds = GeneralBL.FillDataSet(5, CustomerID, "@CustomerID", "SPR_Customers", ref strErrorMessage, strErrorType);
            return(ds.GetXml());
        }
        catch (Exception exp)
        {
            return(strErrorMessage = exp.Message);
        }
    }
Beispiel #11
0
 protected void chkRecibos_Click(object sender, EventArgs e)
 {
     if ((bool)chkRecibos.Checked)
     {
         var lstRoles = (List <Roles>)Session["CCFNRoles"];
         var rolesCSV = "";
         lstRoles.ForEach(rol => rolesCSV += (rol.Name + ", "));
         rolesCSV            = rolesCSV.TrimEnd(',', ' ');
         RadGrid1.DataSource = GeneralBL.GetInvoicesRecibos(rolesCSV.Contains("ADMINISTRADOR"), ((Users)Session["CCFNUser"]).RFC, txtSerie.Text, txtFolio.Text, dteDesde.SelectedDate, dteHasta.SelectedDate, ((Users)Session["CCFNUser"]).UserId, txtSucursal.Text, txtCodigoCliente.Text, txtRFC.Text);
     }
     else
     {
         GetDataSourceInvoices();
     }
     RadGrid1.DataBind();
     //Response.Write("<script language='javascript'>alert('"+ chkRecibos.Checked + "');</script>");
 }
 public static string insertItems(string Items)
 {
     try
     {
         GeneralBL.AddUpdate(200, "@Items", Items, "SPR_RawItems", ref strErrorMessage);
         if (strErrorMessage.Length < 1)
         {
             return(strErrorMessage);
         }
         else
         {
             return(strErrorMessage);
         }
     }
     catch (Exception exp)
     {
         return(strErrorMessage = exp.Message);
     }
 }
Beispiel #13
0
 public static string insertCategory(string CategoryName)
 {
     try
     {
         GeneralBL.AddUpdate(1, "@CategoryName", CategoryName, "SPR_ItemsCategory", ref strErrorMessage);
         if (strErrorMessage.Length < 1)
         {
             return(strErrorMessage);
         }
         else
         {
             return(strErrorMessage);
         }
     }
     catch (Exception exp)
     {
         return(strErrorMessage = exp.Message);
     }
 }
Beispiel #14
0
 public static string InsertCustomer(string Customer, string Email, string CellNo, string Cnic, string Address)
 {
     try
     {
         GeneralBL.AddUpdate(1, "@CustomerName", Customer, "@Email", Email, "@CellPhone", CellNo, "@CNIC", Cnic, "@Address", Address, "SPR_Customers", ref strErrorMessage);
         if (strErrorMessage.Length < 1)
         {
             return(strErrorMessage);
         }
         else
         {
             return(strErrorMessage);
         }
     }
     catch (Exception exp)
     {
         return(strErrorMessage = exp.Message);
     }
 }
Beispiel #15
0
    public static string LoadCustomer(string Search)
    {
        try
        {
            strErrorType = strErrorType = "";

            //SqlParameter[] paramstostore = new SqlParameter[2];
            //paramstostore[0] = new SqlParameter("@OpCode", SqlDbType.Int);
            //paramstostore[0].Value = 5;
            //paramstostore[1] = new SqlParameter("@Amount", SqlDbType.VarChar);
            //paramstostore[1].Value = Search;
            DataSet ds = GeneralBL.FillDataSet(8, Search, "@CustomerName", "SPR_Customers", ref strErrorType, strErrorType);
            return(ds.GetXml());
        }
        catch (Exception exp)
        {
            return(strErrorMessage = exp.Message);
        }
    }
Beispiel #16
0
 public static string insertSuppliers(string Suppliers, string Address, string Contact, string Status)
 {
     try
     {
         GeneralBL.AddUpdate(1, "@Suppliers", Suppliers, "@Address", Address, "@Contact", Contact, "@Status", Status, "SPR_Suppliers", ref strErrorMessage);
         if (strErrorMessage.Length < 1)
         {
             return(strErrorMessage);
         }
         else
         {
             return(strErrorMessage);
         }
     }
     catch (Exception exp)
     {
         return(strErrorMessage = exp.Message);
     }
 }
Beispiel #17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         var invoiceId     = int.Parse(Request["FacturaId"].ToString());
         var invoice       = GeneralBL.GetInvoice(invoiceId);
         var lstParameters = ParameterBL.GetParameters();
         var filesPath     = lstParameters.Where(p => p.Name.Equals("FilesPath")).FirstOrDefault().Value;
         if (Request["FileType"].ToString() == "PDF")
         {
             GeneralBL.Log((int)Constants.Actions.DESCARGA_PDF, ((Users)Session["CCFNUser"]).UserId, "", invoiceId);
             var fileInfo = new FileInfo(filesPath + "\\" + invoice.PDF);
             Response.Clear();
             Response.ClearHeaders();
             Response.ClearContent();
             Response.AddHeader("Content-Disposition", "attachment; filename=" + invoice.PDF);
             Response.AddHeader("Content-Length", fileInfo.Length.ToString());
             Response.ContentType = "text/plain";
             Response.Flush();
             Response.TransmitFile(filesPath + "\\" + invoice.PDF);
             Response.End();
         }
         else if (Request["FileType"].ToString() == "XML")
         {
             GeneralBL.Log((int)Constants.Actions.DESCARGA_XML, ((Users)Session["CCFNUser"]).UserId, "", invoiceId);
             var fileInfo = new FileInfo(filesPath + "\\" + invoice.XML);
             Response.Clear();
             Response.ClearHeaders();
             Response.ClearContent();
             Response.AddHeader("Content-Disposition", "attachment; filename=" + invoice.XML);
             Response.AddHeader("Content-Length", fileInfo.Length.ToString());
             Response.ContentType = "text/plain";
             Response.Flush();
             Response.TransmitFile(filesPath + "\\" + invoice.XML);
             Response.End();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Beispiel #18
0
 public static string CheckStatus(string SuppliersID)
 {
     try
     {
         strErrorMessage = strErrorType = "";
         GeneralBL.AddUpdate(100, "@SuppliersID", SuppliersID, "SPR_Suppliers", ref strErrorMessage);
         if (strErrorMessage.Length < 1)
         {
             return(strErrorMessage);
         }
         else
         {
             return(strErrorMessage);
         }
     }
     catch (Exception exp)
     {
         return(strErrorMessage = exp.Message);
     }
 }
Beispiel #19
0
 public static string DeleteSuppliers(string SuppliersID)
 {
     try
     {
         strErrorMessage = strErrorType = "";
         GeneralBL.Delete(3, "SPR_Suppliers", "@SuppliersID", SuppliersID, ref strErrorMessage, strErrorType);
         if (strErrorMessage.Length < 1)
         {
             return(strErrorMessage);
         }
         else
         {
             return(strErrorMessage);
         }
     }
     catch (Exception exp)
     {
         return(strErrorMessage = exp.Message);
     }
 }
Beispiel #20
0
 public static string DeleteCustomer(string CustomerID)
 {
     try
     {
         strErrorMessage = strErrorType = "";
         GeneralBL.Delete(3, "SPR_Customers", "@CustomerID", CustomerID, ref strErrorMessage, strErrorType);
         if (strErrorMessage.Length < 1)
         {
             return(strErrorMessage);
         }
         else
         {
             return(strErrorMessage);
         }
     }
     catch (Exception exp)
     {
         return(strErrorMessage = exp.Message);
     }
 }
Beispiel #21
0
 public static string UpdateSuppilers(string SuppliersID, string Suppliers, string Address, string Contact, string Status)
 {
     try
     {
         strErrorMessage = strErrorType = "";
         GeneralBL.AddUpdate(2, "@SuppliersID", SuppliersID, "@Suppliers", Suppliers, "@Address", Address, "@Contact", Contact, "@Status", Status, "SPR_Suppliers", ref strErrorMessage);
         if (strErrorMessage.Length < 1)
         {
             return(strErrorMessage);
         }
         else
         {
             return(strErrorMessage);
         }
     }
     catch (Exception exp)
     {
         return(strErrorMessage = exp.Message);
     }
 }
Beispiel #22
0
 public static string DeleteAllCustomer(string checkAll)
 {
     try
     {
         strErrorMessage = strErrorType = "";
         GeneralBL.Delete(13, "SPR_Customers", "@CustomerDel", checkAll, ref strErrorMessage, strErrorType);
         if (strErrorMessage.Length < 1)
         {
             return(strErrorMessage);
         }
         else
         {
             return(strErrorMessage);
         }
     }
     catch (Exception exp)
     {
         return(strErrorMessage = exp.Message);
     }
 }
Beispiel #23
0
 public static string DeleteCategory(string CategoryID)
 {
     try
     {
         strErrorMessage = strErrorType = "";
         GeneralBL.Delete(3, "SPR_ItemsCategory", "@CategoryID", CategoryID, ref strErrorMessage, strErrorType);
         if (strErrorMessage.Length < 1)
         {
             return(strErrorMessage);
         }
         else
         {
             return(strErrorMessage);
         }
     }
     catch (Exception exp)
     {
         return(strErrorMessage = exp.Message);
     }
 }
Beispiel #24
0
 public static string UpdateCategory(string CategoryID, string CategoryName)
 {
     try
     {
         strErrorMessage = strErrorType = "";
         GeneralBL.AddUpdate(2, "@CategoryID", CategoryID, "@CategoryName", CategoryName, "SPR_ItemsCategory", ref strErrorMessage);
         if (strErrorMessage.Length < 1)
         {
             return(strErrorMessage);
         }
         else
         {
             return(strErrorMessage);
         }
     }
     catch (Exception exp)
     {
         return(strErrorMessage = exp.Message);
     }
 }
 // Fill Grid New Version
 public static void FillDirectGrid(int OpCode, string _spName, ref HtmlGenericControl DivError, ref Label _LblError, ref GridView dg, ref int k_intTotalRowsNumbers, int EditCol, int delcol)
 {
     try
     {
         string g_strErrorMessage = "";
         DivError.Visible = false;
         _LblError.Text   = "";
         dg.DataSource    = null;
         dg.DataBind();
         DataTable dt = GeneralBL.FillDataGrid(OpCode, _spName, ref g_strErrorMessage, "2");
         if (g_strErrorMessage.Length < 1)
         {
             if (GeneralBL.isdtEmptyNull(dt) == true)
             {
                 if (EditCol != -1)
                 {
                     dg.Columns[EditCol].Visible = true;
                 }
                 if (delcol != -1)
                 {
                     dg.Columns[delcol].Visible = true;
                 }
                 k_intTotalRowsNumbers = dt.Rows.Count;
             }
             dg.DataSource = dt;
             dg.DataBind();
         }
         else
         {
             DivError.Visible = true;
             _LblError.Text   = g_strErrorMessage.Replace("Error : ", "");
         }
     }
     catch (Exception exp)
     {
         DivError.Visible = true;
         _LblError.Text   = exp.Message;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var lstFacturas = Request["Facturas"];
                var files       = GeneralBL.GetInvoiceFiles(lstFacturas, ((Users)Session["CCFNUser"]).UserId);

                if (files.Rows.Count > 0)
                {
                    var lstParameters = ParameterBL.GetParameters();
                    var filesPath     = lstParameters.Where(p => p.Name.Equals("FilesPath")).FirstOrDefault().Value;

                    var memStream = new MemoryStream();

                    using (var archive = new ZipArchive(memStream, ZipArchiveMode.Create, true, null))
                    {
                        foreach (DataRow row in files.Rows)
                        {
                            if (File.Exists(filesPath + row["RFC"] + "\\" + row["PDF"]))
                            {
                                using (var entry = archive.CreateEntry(row["PDF"].ToString()))
                                {
                                    using (var stream = new MemoryStream(File.ReadAllBytes(filesPath + row["RFC"] + "\\" + row["PDF"])))
                                    {
                                        var writer = new BinaryWriter(entry.Open());
                                        writer.Write(stream.ToArray());
                                        writer.Flush();
                                    }
                                }
                            }

                            if (File.Exists(filesPath + row["RFC"] + "\\" + row["XML"]))
                            {
                                using (var entry = archive.CreateEntry(row["XML"].ToString()))
                                {
                                    using (var stream = new MemoryStream(File.ReadAllBytes(filesPath + row["RFC"] + "\\" + row["XML"])))
                                    {
                                        var writer = new BinaryWriter(entry.Open());
                                        writer.Write(stream.ToArray());
                                        writer.Flush();
                                    }
                                }
                            }
                        }
                    }

                    memStream.Seek(0, SeekOrigin.Begin);
                    if (memStream != null && memStream.Length > 0)
                    {
                        Response.Clear();
                        Response.AddHeader("content-disposition", "attachment; filename=facturas.zip");
                        Response.ContentType = "application/zip";
                        Response.BinaryWrite(memStream.ToArray());
                        Response.End();
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }