Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    if (Session["login"].ToString().Equals("") || Session["userLoggedIn"].ToString().Equals(""))
                    {
                        Response.Redirect("~/LoggedInPage.aspx");
                    }
                    else
                    {
                        LoginBO user = (LoginBO)Session["login"];
                        departmentID = user.DepID;

                        if (!IsPostBack)
                        {
                            destinationBL             = new DestinationBL();
                            Session["items"]          = destinationBL.getDisbursementItems(departmentID);
                            disbursementGV.DataSource = Session["items"];
                            disbursementGV.DataBind();
                        }
                    }
                }//End of Ispost backevent
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Beispiel #2
0
        protected void disbursementGV_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                LoginBO user = (LoginBO)Session["login"];
                departmentID = user.DepID;

                HiddenField hdn = (HiddenField)disbursementGV.Rows[e.RowIndex].FindControl("HiddenField1");
                HiddenField hdf = (HiddenField)disbursementGV.Rows[e.RowIndex].FindControl("HiddenField2");

                int     itemID         = Convert.ToInt32(hdn.Value);
                int     disbursementID = Convert.ToInt32(hdf.Value);
                TextBox txtQuantity    = disbursementGV.Rows[e.RowIndex].Cells[2].Controls[0] as TextBox;
                string  qty            = txtQuantity.Text;
                int     quantity       = Convert.ToInt32(qty);
                destinationBL = new DestinationBL();
                destinationBL.updateDisbursement(departmentID, disbursementID, itemID, quantity);
                disbursementGV.EditIndex = -1;
                Session["items"]         = destinationBL.getDisbursementItems(departmentID);

                //Bind in the gridview
                disbursementGV.DataSource = Session["items"];
                disbursementGV.DataBind();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
        private void tlbMenu_DeleteClick()
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                if (XtraMessageBox.Show("Be sure to delete the record?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (!ValidarIngreso())
                    {
                        DestinationBE objE_Destination = new DestinationBE();
                        objE_Destination.IdDestination = int.Parse(gvDestination.GetFocusedRowCellValue("IdDestination").ToString());
                        objE_Destination.Login         = Parametros.strUsuarioLogin;
                        objE_Destination.Machine       = WindowsIdentity.GetCurrent().Name.ToString();
                        objE_Destination.IdCompany     = Parametros.intEmpresaId;

                        DestinationBL objBL_Destination = new DestinationBL();
                        objBL_Destination.Elimina(objE_Destination);
                        XtraMessageBox.Show("The record was successfully deleted.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Cargar();
                    }
                }
                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        void ExportarExcel(string filename)
        {
            Excel._Application xlApp;
            Excel._Workbook    xlLibro;
            Excel._Worksheet   xlHoja;
            Excel.Sheets       xlHojas;
            xlApp    = new Excel.Application();
            filename = Path.Combine(Directory.GetCurrentDirectory(), "Excel\\Destination.xlsx");
            xlLibro  = xlApp.Workbooks.Open(filename, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
            xlHojas  = xlLibro.Sheets;
            xlHoja   = (Excel._Worksheet)xlHojas[1];

            Cursor.Current = Cursors.WaitCursor;

            try
            {
                int Row       = 6;
                int Secuencia = 1;

                List <DestinationBE> lstDestination = null;
                lstDestination = new DestinationBL().ListaTodosActivo(Parametros.intEmpresaId);
                if (lstDestination.Count > 0)
                {
                    xlHoja.Shapes.AddPicture(Path.Combine(Directory.GetCurrentDirectory(), "Logo.jpg"), Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoCTrue, 1, 1, 100, 60);

                    foreach (var item in lstDestination)
                    {
                        xlHoja.Cells[Row, 1] = item.IdDestination;
                        xlHoja.Cells[Row, 2] = item.NameDestination;
                        xlHoja.Cells[Row, 3] = item.NumberLineCertificate;

                        Row       = Row + 1;
                        Secuencia = Secuencia + 1;
                    }
                }

                xlLibro.SaveAs("C:\\Excel\\Destination.xlsx", Excel.XlFileFormat.xlWorkbookDefault, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Excel.XlSaveAsAccessMode.xlExclusive, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);

                xlLibro.Close(true, Missing.Value, Missing.Value);
                xlApp.Quit();

                Cursor.Current = Cursors.Default;
                BSUtils.OpenExcel("C:\\Excel\\Destination.xlsx");
                //XtraMessageBox.Show("It was imported correctly \n The file was generated C:\\Excel\\Destination.xlsx", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                xlLibro.Close(false, Missing.Value, Missing.Value);
                xlApp.Quit();
                Cursor.Current = Cursors.Default;
                MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Beispiel #5
0
 protected void Confirm_Click(object sender, EventArgs e)
 {
     try
     {
         LoginBO user = (LoginBO)Session["login"];
         departmentID  = user.DepID;
         destinationBL = new DestinationBL();
         destinationBL.confirmDisbursement(departmentID);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
 }
Beispiel #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["userLoggedIn"].Equals("") || Session["login"].Equals(""))
     {
         Response.Redirect("~/LoggedInPage.aspx");
     }
     else
     {
         collectionPointID          = Int32.Parse(Request.QueryString["collectionPointID"]);
         destinationBL              = new DestinationBL();
         collectionPoint.Text       = destinationBL.getCollectionPointName(collectionPointID);
         Session["collectionPoint"] = collectionPoint.Text;
         destinationBOs             = destinationBL.getCollectionPointDeptList(collectionPointID);
         GVDestination.DataSource   = destinationBOs;
         GVDestination.DataBind();
     }
 }
Beispiel #7
0
        private void frmManDestinationEdit_Load(object sender, EventArgs e)
        {
            if (pOperacion == Operacion.Nuevo)
            {
                this.Text = "Destination - New";
            }
            else if (pOperacion == Operacion.Modificar)
            {
                this.Text = "Destination - Update";
                DestinationBE objE_Destination = null;
                objE_Destination = new DestinationBL().Selecciona(IdDestination);
                if (objE_Destination != null)
                {
                    txtDescripcion.Text = objE_Destination.NameDestination.Trim();
                    txtNumberLineCertificate.EditValue = objE_Destination.NumberLineCertificate;
                }
            }

            txtDescripcion.Select();
        }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["userLoggedIn"].Equals("") || Session["login"].Equals(""))
                {
                    Response.Redirect("~/LoggedInPage.aspx");
                }
                else
                {
                    collectionPoint.Text = Session["collectionPoint"].ToString();
                    destinationBL        = new DestinationBL();

                    departmentID = Int32.Parse(Request.QueryString["departmentID"]);
                    string departmentName = destinationBL.getDepartmentName(departmentID);

                    DepartmentName.Text = departmentName;

                    Session["items"]          = destinationBL.getDisbursementItems(departmentID);
                    disbursementGV.DataSource = Session["items"];
                    disbursementGV.DataBind();
                }
            }
        }
Beispiel #9
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                if (!ValidarIngreso())
                {
                    DestinationBL objBL_Destination = new DestinationBL();
                    DestinationBE objDestination    = new DestinationBE();

                    objDestination.IdDestination         = IdDestination;
                    objDestination.NameDestination       = txtDescripcion.Text;
                    objDestination.NumberLineCertificate = Convert.ToInt32(txtNumberLineCertificate.Text);
                    objDestination.FlagState             = true;
                    objDestination.Login     = Parametros.strUsuarioLogin;
                    objDestination.Machine   = WindowsIdentity.GetCurrent().Name.ToString();
                    objDestination.IdCompany = Parametros.intEmpresaId;

                    if (pOperacion == Operacion.Nuevo)
                    {
                        objBL_Destination.Inserta(objDestination);
                    }
                    else
                    {
                        objBL_Destination.Actualiza(objDestination);
                    }

                    this.Close();
                }
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }