コード例 #1
0
        /// <summary>
        /// Adicionar el(los) plan(es) de negocio seleccionado(s) al acta seleccionada en "AcreditacionActa.aspx".
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_Adicionar_Click(object sender, EventArgs e)
        {
            //Inicializar variables.
            ClientScriptManager cm = this.ClientScript;
            DataTable           rs = new DataTable();
            int Estado             = 0;
            var idActaAcreditacion = string.Empty;

            if (Session["idActaAcreditacion"].ToString() != null)
            {
                idActaAcreditacion = Session["idActaAcreditacion"].ToString();
            }

            foreach (GridViewRow fila in gvPlanesNegocio.Rows)
            {
                CheckBox    box = (CheckBox)fila.FindControl("chckplanopera");
                HiddenField hdf = (HiddenField)fila.FindControl("hdf_proyecto");

                // 2015/06/26 Roberto Alvarado
                // Se obtiene el Id_Proyecto de esta manera que si se obtiene el valor, ya que en hdf esta siempre como ''
                string idProyecto = gvPlanesNegocio.DataKeys[fila.RowIndex].Value.ToString();

                if (box != null && hdf != null)
                {
                    if (box.Checked)
                    {
                        //txtSQL = "select CodEstado from proyecto where Id_proyecto = '" + hdf.Value + "'";
                        txtSQL = "select CodEstado from proyecto where Id_proyecto = '" + idProyecto + "'";
                        rs     = consultas.ObtenerDataTable(txtSQL, "text");

                        if (rs.Rows.Count > 0)
                        {
                            var cosEstado = rs.Rows[0]["CodEstado"].ToString();
                            if (!String.IsNullOrEmpty(cosEstado))
                            {
                                //if (Int32.Parse(rs.Rows[0]["Estado"].ToString()) == Constantes.CONST_Aprobacion_Acreditacion)
                                if (Int32.Parse(cosEstado) == Constantes.CONST_Aprobacion_Acreditacion)
                                {
                                    Estado = 1;
                                }
                            }
                        }
                        rs = null;

                        //txtSQL = " insert into AcreditacionActaproyecto values (" + CodActa + ", " + hdf.Value + ", " + Estado + ")";
                        txtSQL = " insert into AcreditacionActaproyecto values (" + idActaAcreditacion + ", " + idProyecto + ", " + Estado + ")";
                        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString);
                        try
                        {
                            //NEW RESULTS:

                            SqlCommand cmd = new SqlCommand(txtSQL, con);

                            if (con != null)
                            {
                                if (con.State != ConnectionState.Open)
                                {
                                    con.Open();
                                }
                            }
                            cmd.CommandType = CommandType.Text;
                            cmd.ExecuteNonQuery();
                            cmd.Dispose();
                        }
                        catch (SqlException ex)
                        {
                            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "alert('Error al agregar los planes de negocio al acta.')", true);
                        }
                        finally
                        {
                            con.Close();
                            con.Dispose();
                        }
                    }
                }
            }

            //Recargar la página padre y cerrar la ventana actual.
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>window.opener.location=window.opener.location;window.close();</script>");
        }
コード例 #2
0
    protected void GV_inventario_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        //indice de la fila
        GridViewRow         row = GV_inventario.Rows[e.RowIndex];
        ClientScriptManager cm  = this.ClientScript;

        //traer valor textbox
        var tb_referencia = row.FindControl("tb_referencia") as TextBox;

        FileUpload fu_imagen = (FileUpload)row.FindControl("fu_imagen");



        int id = Convert.ToInt32(GV_inventario.DataKeys[e.RowIndex].Values[0].ToString());
        //EncapInventario inventario = new EncapInventario();//



        string urlExistente  = ((Image)row.FindControl("I_editar")).ImageUrl;
        string nombreArchivo = System.IO.Path.GetFileName(fu_imagen.PostedFile.FileName);
        string Ruta          = "~\\Inventario\\" + nombreArchivo;

        if (nombreArchivo == "")
        {
            e.NewValues["Imagen"] = urlExistente;
        }
        else
        if ((nombreArchivo != ""))
        {
            string extension = System.IO.Path.GetExtension(fu_imagen.PostedFile.FileName);

            string saveLocationAdmin = HttpContext.Current.Server.MapPath("~\\Inventario\\") + nombreArchivo;

            if (!(extension.Equals(".jpg") || extension.Equals(".jpeg") || extension.Equals(".png") || extension.Equals(".gif")))
            {
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert ('tipo de archivo no valido ' );</script>");
                e.Cancel = true;
            }
            //verificar existencia de un arhivo con el mismo nombre
            if (System.IO.File.Exists(saveLocationAdmin))
            {
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert ('Imagen Existente' );</script>");
                e.Cancel = true;
            }
            try
            {
                if (urlExistente != "")
                {
                    File.Delete(Server.MapPath(urlExistente));
                }
                fu_imagen.PostedFile.SaveAs(saveLocationAdmin);
                e.NewValues["Imagen"] = Ruta;
            }
            catch (Exception exc)

            {
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert ('Error' );</script>");
                return;
            }

            ValidarControles();
        }

        var db       = new Mapeo();
        var consulta = (from x in db.inventario where (x.Referencia == tb_referencia.Text) select x.Referencia).Count();


        //referencia Existente
        if (consulta == 1)
        {
            //si el valorexistente es el mismo
            if (Label4.Text == tb_referencia.Text)
            {
                //agrego valor que habia antes
                e.NewValues["Referencia"] = Label4.Text;
            }
            else
            {
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert ('Referencia Existente' );</script>");
                e.Cancel = true;
            }
        }
    }
コード例 #3
0
        protected override void OnInit(EventArgs e)
        {
            if (ThisCustomer == null)
            {
                ThisCustomer = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer;
            }

            //Build and register the RadWindow Script block
            string gridID = ctrlSearch.FindControl("grdProducts").ClientID;
            string ajxID  = radAjaxMgr.ClientID;

            StringBuilder sb = new StringBuilder();

            #region RadWindow Javascript Functions
            sb.Append("<script type=\"text/javascript\">                                                                                        \r\n");
            /*Instantiates a new modale window with the Edit Product page in edit mode*/
            sb.Append("function ShowEditForm(id, rowIndex)                                                                                      \r\n");
            sb.Append("{                                                                                                                        \r\n");
            sb.Append("     var grid = $find(\"" + gridID + "\");                                                                               \r\n");
            sb.Append("                                                                                                                         \r\n");
            sb.Append("     var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();                                \r\n");
            sb.Append("     grid.get_masterTableView().selectItem(rowControl, true);                                                            \r\n");
            sb.Append("                                                                                                                         \r\n");
            sb.Append("     window.radopen(\"entityEditProducts.aspx?iden=\" + id + \"&entityName=CATEGORY\", \"rdwEditProduct\");              \r\n");
            sb.Append("     return false;                                                                                                       \r\n");
            sb.Append("}                                                                                                                        \r\n");
            /*Instantiates a new modal window with the Edit Product page in insert mode*/
            sb.Append("function ShowInsertForm()                                                                                                \r\n");
            sb.Append("{                                                                                                                        \r\n");
            sb.Append("     window.radopen(\"entityEditProducts.aspx?entityName=CATEGORY\", \"rdwEditProduct\");                                \r\n");
            sb.Append("     return false;                                                                                                       \r\n");
            sb.Append("}                                                                                                                        \r\n");
            /*Instantiates a new modal window with the Edit Variant page in edit mode*/
            sb.Append("function VariantShowEditForm(id, rowIndex, parentID)                                                                     \r\n");
            sb.Append("{                                                                                                                        \r\n");
            sb.Append("     window.radopen(\"entityEditProductVariant.aspx?VariantID=\" + id + \"&entityName=CATEGORY&ProductID=\" + parentID, \"rdwEditProduct\");        \r\n");
            sb.Append("     return false;                                                                                                       \r\n");
            sb.Append("}                                                                                                                        \r\n");
            /*Instantiates a new modal window with the Edit Variant page in insert mode*/
            sb.Append("function VariantShowInsertForm(parentID)                                                                                 \r\n");
            sb.Append("{                                                                                                                        \r\n");
            sb.Append("     window.radopen(\"entityEditProductVariant.aspx?entityName=CATEGORY&ProductID=\" + parentID, \"rdwEditProduct\");          \r\n");
            sb.Append("     return false;                                                                                                       \r\n");
            sb.Append("}                                                                                                                        \r\n");
            /*Accepts a callback from the modal window to update the grid*/
            sb.Append("function refreshGrid(arg)                                                                                                \r\n");
            sb.Append("{                                                                                                                        \r\n");
            sb.Append("     if(!arg)                                                                                                            \r\n");
            sb.Append("     {                                                                                                                   \r\n");
            sb.Append("             $find(\"" + ajxID + "\").ajaxRequest(arg);                                                                  \r\n");
            sb.Append("     }                                                                                                                   \r\n");
            sb.Append("     else                                                                                                                \r\n");
            sb.Append("     {                                                                                                                   \r\n");
            sb.Append("             $find(\"" + ajxID + "\").ajaxRequest(arg);                                                                  \r\n");
            sb.Append("     }                                                                                                                   \r\n");
            sb.Append("}                                                                                                                        \r\n");

            sb.Append("</script>                                                                                                                \r\n");
            #endregion

            ClientScriptManager cs = Page.ClientScript;

            cs.RegisterClientScriptBlock(this.Page.GetType(), Guid.NewGuid().ToString(), sb.ToString());

            base.OnInit(e);
        }
コード例 #4
0
    protected void lnkrepPrint_Click(object sender, EventArgs e)
    {
        GridView gv     = grdvReprint;
        int      index  = gv.SelectedIndex;
        int      _genid = Convert.ToInt32(gv.DataKeys[index].Value.ToString());

        LetterGen     gObj   = new LetterGen("EBAnamespace");
        Type          cstype = this.GetType();
        List <string> _eList = new List <string>();

        try
        {
            foreach (ListItem Li in ListBox2.Items)
            {
                _eList.Add(Li.Text);
            }

            string _empList = gObj.createEmplCSV(_eList);

            string[]            _Letter = gObj.reprintLetters(_genid, _empList);
            ClientScriptManager cs      = Page.ClientScript;

            string _filepath = "C:\\EBATemp\\";
            string _file     = _filepath + "Print.xml";


            int _seq = 0;

            foreach (string _lt in _Letter)
            {
                try
                {
                    if (!cs.IsClientScriptBlockRegistered(_seq + "SaveExcel"))
                    {
                        cs.RegisterClientScriptBlock(typeof(Page), _seq + "SaveExcel", "SaveTextFile('" + _lt.Replace(Environment.NewLine, "") + "', '" + _file.Replace("\\", "\\\\") + "');", true);
                    }

                    if (!cs.IsClientScriptBlockRegistered(_seq + "PrintWord"))
                    {
                        cs.RegisterClientScriptBlock(typeof(Page), _seq + "PrintWord", "PrintWord('" + _file.Replace("\\", "\\\\") + "');", true);
                    }
                }
                finally
                {
                    EndProcess();
                    if (!cs.IsClientScriptBlockRegistered(_seq + "DeleteFile"))
                    {
                        cs.RegisterClientScriptBlock(typeof(Page), _seq + "DeleteFile", "DeleteFile('" + _file.Replace("\\", "\\\\") + "');", true);
                    }
                }
                _seq++;
            }
        }
        catch (Exception ex)
        {
            errorDiv2.Visible = true;
            lbl_error1.Text   = "Some error occured while printing letters - " + ex.Message;
        }
        finally
        {
            grdvltrPending.DataBind();
            grdvLtrPendingreprint.DataBind();
        }
    }
コード例 #5
0
        private void RegisterJSBaseScript()
        {
            #region Javascript
            string jsBaseScript =
                @"<script language=""javascript"">

	function _addHandler(target, eventName, handler, capture) 
	{  
		capture = (capture) ? capture : false;  
		if ( target.addEventListener ) 
			target.addEventListener(eventName, handler, capture);  
		else if ( target.attachEvent ) 
			target.attachEvent('on' + eventName, handler); 
	}  

	function CompositeList(title, isDefault, listID)
	{
		this.list = null;
		
		this.title = title;
		
		this.isDefault = isDefault != null ? isDefault : false;
		this.listID = listID != null ? listID : '';
			
		this.lists = new Array();
		
		this.defaultSubListTitle = '';
	}
	
	CompositeList.prototype.getChildList = function( title )
	{
		for(i=0;i<this.lists.length;i++)
		{
			if( title == this.lists[i].title )
				return this.lists[i];
		}	

		return null;	
	}
	
	CompositeList.prototype.getDefaultChildList = function()
	{
		for(i=0;i<this.lists.length;i++)
		{
			if( defaultSubListTitle == this.lists[i].title )
				return this.lists[i];
		}	

		return null;	
	}	
	
	function fillDDL( ddl, list)
	{
		ddl.list = list;
		ddl.innerHTML = '';

		var agt=navigator.userAgent.toLowerCase();
		var is_ie = ((agt.indexOf('msie') != -1) && (agt.indexOf('opera') == -1));
		
		for(i=0;i<list.lists.length;i++)
		{
			option = document.createElement('OPTION');
			option.text = list.lists[i].title;
			option.value = list.lists[i].title;
			if(is_ie)
				ddl.add(option);
			else
				ddl.appendChild(option);
			
			if( list.lists[i].isDefault )
			{
				list.defaultSubListTitle = list.lists[i].title;
				ddl.selectedIndex = i;
			}				
		}
		
		if( ddl.childDDL != null && ddl.childDDL.length > 0)
			fillDDL( ddl.childDDL, list.getChildList(ddl.value))
	}
	
	function fillChildDDL(e)
	{
		//handy script from http://www.quirksmode.org/js/events_properties.html
		var targ;
		if (!e) var e = window.event;
		if (e.target) targ = e.target;
		else if (e.srcElement) targ = e.srcElement;
		if (targ.nodeType == 3) // defeat Safari bug
			targ = targ.parentNode;


		ddl = targ;

		if(!ddl.list)
			ddl.list = getMasterListByListID( ddl.listID );

		fillDDL( ddl.childDDL, ddl.list.getChildList(ddl.value) );
	}

	function getMasterListByListID( listID )
	{
		for(i=0;i<FCCompositeLists.length;i++)
		{
			//alert(listID + ' - ' + FCCompositeLists[i].listID);
			if( listID == FCCompositeLists[i].listID )
				return FCCompositeLists[i];
		}	

		//alert('did not find list :' + listID);

		return null;
	}	
</script>";
            ClientScriptManager cs = Page.ClientScript;
            cs.RegisterClientScriptBlock(this.GetType(), "FCCompositeList", jsBaseScript);
            #endregion
        }
コード例 #6
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ClientScriptManager script = Page.ClientScript;
            Button btn = sender as Button;

            if (btn.Text == "Next" || hdnPrev.Value == "0")
            {
                string module = lbAvailableModules.SelectedItem.Value as string;
                BindFolderFilesDropDown(module);
                if (!script.IsClientScriptBlockRegistered(GetType(), "divShow1"))
                {
                    script.RegisterClientScriptBlock(this.GetType(), "divShow1", "<script>$(function(){$('#div1').hide();$('#div2').show(); counter=1;$('#' + NewPackage.Settings.next).val('Next');});</script>");
                }
                btn.Text = "Submit";
            }
            else if (btn.Text == "Submit" && hdnPrev.Value != "0")
            {
                string            rootPath = HostingEnvironment.ApplicationPhysicalPath;
                ModuleInfoPackage package  = new ModuleInfoPackage();
                package.Description             = this.PackageDetails1.Description;
                package.Version                 = this.PackageDetails1.FirstVersion + "." + this.PackageDetails1.SecondVersion + "." + this.PackageDetails1.LastVersion;
                package.ReleaseNotes            = this.PackageDetails1.ReleaseNotes;
                package.Owner                   = this.PackageDetails1.Owner;
                package.Organization            = this.PackageDetails1.Organization;
                package.URL                     = this.PackageDetails1.Url;
                package.Email                   = this.PackageDetails1.Email;
                package.FriendlyName            = this.txtfriendlyname.Text;
                package.ModuleName              = this.txtmodulename.Text;
                package.BusinessControllerClass = this.txtbusinesscontrollerclass.Text;
                if (lbAvailableModules.SelectedItem != null)
                {
                    package.FolderName = lbAvailableModules.SelectedItem.Value as string;
                }
                package.License            = this.PackageDetails1.License;
                package.CompatibleVersions = this.txtcompatibleversions.Text;
                //Populate ModuleElement and add to package
                ModuleElement moduleElement = new ModuleElement();
                moduleElement.FriendlyName = this.txtfriendlyname.Text;
                moduleElement.CacheTime    = this.txtCacheTime.Text;
                moduleElement.Controls     = GetControls(package.FolderName);
                package.ModuleElements.Add(moduleElement);
                package.FileNames.AddRange(GetSelectedItems(this.lstAssembly, Path.Combine(rootPath, "bin\\")));
                package.FileNames.AddRange(GetSelectedItems(this.lstFolderFiles, Path.Combine(rootPath, "Modules\\" + package.FolderName + "\\")));
                string tempFolderPath = rootPath + GetTempPath();
                if (this.hdnInstallScriptFileName.Value != null && this.hdnInstallScriptFileName.Value.Length > 0)
                {
                    string       InstalltempPath = Path.Combine(tempFolderPath, hdnInstallScriptFileName.Value);
                    StreamReader reader          = new StreamReader(InstalltempPath);
                    string       InstallScript   = reader.ReadToEnd();
                    reader.Close();
                    string       InstallfilePath = tempFolderPath + package.Version + ".SqlDataProvider";
                    StreamWriter writer          = File.CreateText(InstallfilePath);
                    writer.Write(InstallScript);
                    writer.Flush();
                    writer.Close();
                    writer.Dispose();
                    package.FileNames.Add(InstallfilePath);
                }
                else if (!string.IsNullOrEmpty(this.InstallScriptTxt.Text))
                {
                    try
                    {
                        string       filePath = tempFolderPath + package.Version + ".SqlDataProvider";
                        StreamWriter writer   = File.CreateText(filePath);
                        writer.Write(this.InstallScriptTxt.Text);
                        writer.Flush();
                        writer.Close();
                        writer.Dispose();
                        package.FileNames.Add(filePath);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
                if (this.hdnUnInstallSQLFileName.Value != null && this.hdnUnInstallSQLFileName.Value.Length > 0)
                {
                    string       UnInstalltempPath = Path.Combine(tempFolderPath, hdnUnInstallSQLFileName.Value);
                    StreamReader reader            = new StreamReader(UnInstalltempPath);
                    string       UnInstallScript   = reader.ReadToEnd();
                    reader.Close();
                    string       UnInstallfilePath = tempFolderPath + "Uninstall.SqlDataProvider";
                    StreamWriter writer            = File.CreateText(UnInstallfilePath);
                    writer.Write(UnInstallScript);
                    writer.Flush();
                    writer.Close();
                    writer.Dispose();
                    package.FileNames.Add(UnInstallfilePath);
                }
                else if (!string.IsNullOrEmpty(this.UnistallScriptTxt.Text))
                {
                    string       filePath = tempFolderPath + "Uninstall.SqlDataProvider";
                    StreamWriter writer   = File.CreateText(filePath);
                    writer.Write(this.UnistallScriptTxt.Text);
                    writer.Flush();
                    writer.Close();
                    writer.Dispose();
                    package.FileNames.Add(filePath);
                }

                if (!string.IsNullOrEmpty(this.hdnSrcZipFile.Value) && this.hdnSrcZipFile.Value.Trim().Length > 1)
                {
                    package.FileNames.Add(Path.Combine(tempFolderPath, this.hdnSrcZipFile.Value));
                }
                ModuleSfeWriter moduleWriter = new ModuleSfeWriter(package);
                try
                {
                    moduleWriter.CreatePackage(package.FolderName, "SFE_" + package.FolderName, package.FileNames, this.Context.Response, tempFolderPath, package);
                    if (script.IsClientScriptBlockRegistered(GetType(), "script1"))
                    {
                        script.RegisterClientScriptBlock(GetType(), "script1", "<script>$(function(){ counter=0;});</script>");
                    }
                }
                catch (Exception)
                {
                    //ReturnBack();
                }

                // ReturnBack();
            }
        }
コード例 #7
0
    protected void lnkPrev_Click(object sender, EventArgs e)
    {
        string _ltrType = ddlLetterType.SelectedItem.Text;
        string _ltrCode = ddlLetterType.SelectedItem.Value;

        clearMessages();

        LetterGen gObj   = new LetterGen("EBAnamespace");
        Type      cstype = this.GetType();

        try
        {
            int                 _version = LettersGenDAL.getTemplateVersion(_ltrCode);
            string[]            _Letter  = gObj.generateLetter(_ltrCode, _version, true);
            ClientScriptManager cs       = Page.ClientScript;

            string _filepath = "C:\\EBATemp\\";
            string _file     = _filepath + "Print.xml";


            int _seq = 0;

            foreach (string _lt in _Letter)
            {
                if (_seq == 2)
                {
                    break;
                }
                try
                {
                    if (!cs.IsClientScriptBlockRegistered(_seq + "SaveExcel"))
                    {
                        cs.RegisterClientScriptBlock(typeof(Page), _seq + "SaveExcel", "SaveTextFile('" + _lt.Replace(Environment.NewLine, "") + "', '" + _file.Replace("\\", "\\\\") + "');", true);
                    }

                    if (!cs.IsClientScriptBlockRegistered(_seq + "PrintWord"))
                    {
                        cs.RegisterClientScriptBlock(typeof(Page), _seq + "PrintWord", "PrintWord('" + _file.Replace("\\", "\\\\") + "');", true);
                    }
                }
                finally
                {
                    EndProcess();
                    if (!cs.IsClientScriptBlockRegistered(_seq + "DeleteFile"))
                    {
                        cs.RegisterClientScriptBlock(typeof(Page), _seq + "DeleteFile", "DeleteFile('" + _file.Replace("\\", "\\\\") + "');", true);
                    }
                }
                _seq++;
            }
        }
        catch (Exception ex)
        {
            clearMessages();
            errorDiv1.Visible = true;
            lbl_error.Text    = "Some error occured while printing letters - " + ex.Message;
        }
        finally
        {
        }
    }
コード例 #8
0
    protected void BT_Enviar_Click(object sender, EventArgs e)
    {
        ClientScriptManager cm = this.ClientScript;

        string fileName     = System.IO.Path.GetFileName(FU_Foto.PostedFile.FileName);
        string extension    = System.IO.Path.GetExtension(FU_Foto.PostedFile.FileName);
        string saveLocation = Server.MapPath("~\\Images\\ProfilePictures\\") + DateTime.Now.ToFileTime().ToString() + extension;

        E_user e_user = new E_user();

        e_user.Id_rol      = 2;
        e_user.Name        = TB_Nombre.Text;
        e_user.Last_name   = TB_Apellido.Text;
        e_user.User_name   = TB_User.Text;
        e_user.Pass        = TB_Pass.Text;
        e_user.Mail        = TB_Correo.Text;
        e_user.Id_ruta     = int.Parse(DDL_NumRuta.SelectedValue);
        e_user.Activo      = CB_Activo.Checked;
        e_user.Profile_pic = saveLocation;

        //---------------------------------//

        E_user euser = new DAO_Admin().getUserLogin(TB_User.Text);

        try
        {
            if (euser.User_name == TB_User.Text)
            {
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('El usuario ya existe');</script>");
                return;
            }
        }
        catch (NullReferenceException)
        {
        }

        E_user euser_mail = new DAO_Admin().getMailUser(TB_Correo.Text);

        try {
            if (euser_mail.Mail == TB_Correo.Text)
            {
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('El correo ya existe');</script>");
                return;
            }
        }catch (NullReferenceException)
        {
        }

        //---------------------------------//
        if (!(extension.Equals(".jpg") || extension.Equals(".jpeg") || extension.Equals(".png")))
        {
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Tipo de archivo no valido o no subio archivo');</script>");
            return;
        }

        if (System.IO.File.Exists(saveLocation))
        {
            File.Delete(saveLocation);
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ya existe un archivo en el servidor con ese nombre');</script>");
            return;
        }

        try
        {
            FU_Foto.PostedFile.SaveAs(saveLocation);
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('El archivo ha sido cargado');</script>");
        }
        catch (Exception exc)
        {
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Error: ');</script>");
            return;
        }
        try
        {
            if (e_user.Profile_pic == " ")
            {
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('No ha subido ninguna foto');</script>");
                return;
            }
        }
        catch (NullReferenceException)
        {
        }

        //---------------------------------//

        e_user.LastModified     = DateTime.Now;
        e_user.Sesion           = ((E_user)Session["validUser"]).User_name;
        e_user.Pasaporte_numero = 0;

        //---------------------------------//
        //Generador de usuario ahora en User/QRCode.aspx.cs
        e_user.Qr_hash = RNG_Gen.RNG_gen();

        Send_Mail mail = new Send_Mail();

        mail.sendMail(e_user.Mail, e_user.Token, "Su usuario: " + e_user.User_name, "Su contraseña: " + e_user.Pass, "Bienvenido al programa.");
        new DAO_Admin().addUser(e_user);
        cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('El usuario ha sido registrado');</script>");

        //-------------------------------//

        TB_Pass.Text     = String.Empty;
        TB_Nombre.Text   = String.Empty;
        TB_Correo.Text   = String.Empty;
        TB_Apellido.Text = String.Empty;
        TB_User.Text     = String.Empty;
    }
コード例 #9
0
        /// <summary>
        /// Adds the jQuery, jCrop, webcropimage.js and jCrop CSS references as specified in the matching properties.
        /// </summary>
        protected void AddFileReferences()
        {
            ClientScriptManager cs = Page.ClientScript;

            string jQueryVer = "1.8.2";
            string ext       = (DebugMode ? ".min.js" : ".js");

            if (string.IsNullOrEmpty(this.ScriptPath))
            {
                this.ScriptPath = "~/scripts/";
            }


            string jQueryGoogle   = "<script src=\"//ajax.googleapis.com/ajax/libs/jquery/" + jQueryVer + "/jquery" + ext + "\" type=\"text/javascript\"></script>\n";
            string jQueryFolder   = "<script src=\"" + ResolveClientUrl(this.ScriptPath.TrimEnd('/') + "/jquery-" + jQueryVer + ext) + "\" type=\"text/javascript\"></script>\n";
            string jQueryResource = "<script src=\"" + cs.GetWebResourceUrl(this.GetType(), "Imazen.Crop.jquery-" + jQueryVer + ext) + "\" type=\"text/javascript\"></script>\n";

            string jQueryFallbackResource = "\n<script>!window.jQuery && document.write(unescape('%3Cscript src=\"" +
                                            cs.GetWebResourceUrl(this.GetType(), "Imazen.Crop.jquery-" + jQueryVer + ext) +
                                            "\"%3E%3C/script%3E'))</script>\n";

            string jCropFolder   = "<script src=\"" + ResolveClientUrl(this.ScriptPath.TrimEnd('/') + "/jquery.Jcrop" + ext) + "\" type=\"text/javascript\"></script>\n";
            string jCropResource = "<script src=\"" + cs.GetWebResourceUrl(this.GetType(), "Imazen.Crop.jquery.Jcrop" + ext) + "\" type=\"text/javascript\"></script>\n";

            string jCropFallbackResource = "\n<script>!$.Jcrop && document.write(unescape('%3Cscript src=\"" +
                                           cs.GetWebResourceUrl(this.GetType(), "Imazen.Crop.jquery.Jcrop" + ext) +
                                           "\"%3E%3C/script%3E'))</script>\n";

            string webCropFolder   = "<script src=\"" + ResolveClientUrl(this.ScriptPath.TrimEnd('/') + "/webcropimage.js") + "\" type=\"text/javascript\"></script>\n";
            string webCropResource = "<script src=\"" + cs.GetWebResourceUrl(this.GetType(), "Imazen.Crop.webcropimage.js") + "\" type=\"text/javascript\"></script>\n";

            string webCropFallbackResource = "\n<script>!window.webcropimage && document.write(unescape('%3Cscript src=\"" +
                                             cs.GetWebResourceUrl(this.GetType(), "Imazen.Crop.webcropimage.js") +
                                             "\"%3E%3C/script%3E'))</script>\n";

            string jCropCssResource = cs.GetWebResourceUrl(this.GetType(), "Imazen.Crop.jquery.Jcrop.css");
            string jCropCssFolder   = ResolveClientUrl(this.ScriptPath.TrimEnd('/') + "/jquery.Jcrop.css");

            string jQueryBlock = null;

            if (JQueryInclude == JQueryIncludeMode.Embedded)
            {
                jQueryBlock = jQueryResource;
            }
            if (JQueryInclude == JQueryIncludeMode.Google)
            {
                jQueryBlock = jQueryGoogle + jQueryFallbackResource;
            }
            if (JQueryInclude == JQueryIncludeMode.ScriptFolder)
            {
                jQueryBlock = jQueryFolder + jQueryFallbackResource;
            }

            string jCropBlock = null;

            if (JCropInclude == JCropIncludeMode.Embedded)
            {
                jCropBlock = jCropResource;
            }
            else if (JCropInclude == JCropIncludeMode.ScriptFolder)
            {
                jCropBlock = jCropFolder + jCropFallbackResource;
            }

            string webBlock = null;

            if (this.WebCropInclude == WebCropImageIncludeMode.Embedded)
            {
                webBlock = webCropResource;
            }
            else if (this.webCropInclude == WebCropImageIncludeMode.ScriptFolder)
            {
                webBlock = webCropFolder + webCropFallbackResource;
            }

            string jCropCss = null;

            if (JCropCssInclude == JCropCssIncludeMode.Embedded)
            {
                jCropCss = jCropCssResource;
            }
            else if (JCropCssInclude == JCropCssIncludeMode.ScriptFolder)
            {
                jCropCss = jCropCssFolder;
            }


            if (this.IsInUpdatePanel)
            {
                if (jQueryBlock != null && !cs.IsClientScriptBlockRegistered("jquery"))
                {
                    cs.RegisterClientScriptBlock(this.GetType(), "jquery", jQueryBlock, false);
                }

                if (jCropBlock != null && !cs.IsClientScriptBlockRegistered("cropJS"))
                {
                    cs.RegisterClientScriptBlock(this.GetType(), "cropJS", jCropBlock);
                }

                if (webBlock != null && !cs.IsClientScriptBlockRegistered("webcropimage"))
                {
                    cs.RegisterClientScriptBlock(this.GetType(), "webcropimage", webBlock);
                }
            }
            else
            {
                if (jQueryBlock != null && !cs.IsClientScriptBlockRegistered("jquery"))
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "jquery", jQueryBlock, false);
                }

                if (jCropBlock != null && !cs.IsClientScriptBlockRegistered("cropJS"))
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "cropJS", jCropBlock, false);
                }

                if (webBlock != null && !cs.IsClientScriptBlockRegistered("webcropimage"))
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "webcropimage", webBlock, false);
                }
            }


            if (jCropCss != null)
            {
                Page.Header.Controls.Add(new LiteralControl("<link href=\"" + jCropCss + "\" type=\"text/css\" rel=\"stylesheet\" />\r\n"));
            }
        }
コード例 #10
0
        /// <summary>
        /// Handles the Click event of the B_Grabar control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void B_Grabar_Click(object sender, EventArgs e)
        {
            foreach (ListItem item in LB_Para.Items)
            {
                if (item.Selected)
                {
                    CodTareaPrograma = "" + CONST_PostIt;
                    ParaQuien        = item.Value;
                    Proyecto         = "" + codProyecto;
                    NomTarea         = TB_Tarea.Text;
                    Descripcion      = TB_Descripcion.Text;
                    Recurrente       = "0";
                    if (DD_Email.SelectedValue == "1")
                    {
                        RecordatorioEmail = true;
                    }
                    else
                    {
                        RecordatorioEmail = false;
                    }
                    NivelUrgencia        = "1";
                    RecordatorioPantalla = false;
                    RequiereRespuesta    = false;
                    CodContactoAgendo    = "" + CodUsuario;
                    DocumentoRelacionado = " ";

                    string conexionStr = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;

                    int last_id = 0;

                    using (var con = new SqlConnection(conexionStr))
                    {
                        using (var com = con.CreateCommand())
                        {
                            com.CommandText = "MD_NuevaTareaInsert";
                            com.CommandType = System.Data.CommandType.StoredProcedure;
                            com.Parameters.AddWithValue("@CodTareaPrograma", CodTareaPrograma);
                            com.Parameters.AddWithValue("@CodContacto", ParaQuien);
                            com.Parameters.AddWithValue("@CodProyecto", Proyecto);
                            com.Parameters.AddWithValue("@NomTareaUsuario", NomTarea);
                            com.Parameters.AddWithValue("@Descripcion", Descripcion);
                            com.Parameters.AddWithValue("@Recurrente", Recurrente);
                            com.Parameters.AddWithValue("@RecordatorioEmail", RecordatorioEmail);
                            com.Parameters.AddWithValue("@NivelUrgencia", NivelUrgencia);
                            com.Parameters.AddWithValue("@RecordatorioPantalla", RecordatorioPantalla);
                            com.Parameters.AddWithValue("@RequiereRespuesta", RequiereRespuesta);
                            com.Parameters.AddWithValue("@CodContactoAgendo", CodContactoAgendo);
                            com.Parameters.AddWithValue("@DocumentoRelacionado", DocumentoRelacionado);

                            SqlParameter retval = com.Parameters.Add("@UltimoRegistroInsertado", SqlDbType.Int);
                            retval.Direction = ParameterDirection.ReturnValue;


                            try
                            {
                                con.Open();
                                com.ExecuteNonQuery(); // MISSING
                                last_id = (int)retval.Value;
                            }
                            catch (Exception ex)
                            {
                                throw;
                            }
                            finally
                            {
                                com.Dispose();
                                con.Close();
                                con.Dispose();
                            }
                        }
                    }

                    TareaUsuarioRepeticion(last_id);

                    if (RecordatorioEmail.Equals(true))
                    {
                        try
                        {
                            Consultas consulta = new Consultas();
                            String    txtSQL1  = " SELECT email FROM contacto where id_contacto=  '" + ParaQuien + "'";
                            var       resul    = consulta.ObtenerDataTable(txtSQL1, "text");
                            String    wdato    = resul.Rows[0].ItemArray[0].ToString();

                            enviarPorEmail(wdato.ToString(), "Envío módulo de tareas", item.Text + " Tarea Pendiente Fondo Emprender " + NomTarea + " " + Descripcion);
                        }
                        catch (Exception ex) {
                            errorMessageDetail = ex.Message;
                        }
                    }
                }
            }

            ClientScriptManager cm = this.ClientScript;

            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>window.opener.location.href = window.opener.location.href; window.close();</script>");
        }
コード例 #11
0
        /// <summary>
        /// Recoger las sesiones
        /// </summary>
        private void recogeSession()
        {
            try
            {
                try
                {
                    codProyecto = HttpContext.Current.Session["EvalCodProyectoPOst"].ToString();
                }
                catch (Exception)
                {
                    codProyecto = "";
                }

                if (String.IsNullOrEmpty(codProyecto))
                {
                    codProyecto = HttpContext.Current.Session["CodProyecto"].ToString();
                }

                try
                {
                    CodUsuario = Int32.Parse(HttpContext.Current.Session["EvalCodUsuario"].ToString());
                }
                catch (FormatException)
                {
                    CodUsuario = usuario.IdContacto;
                }
                catch (Exception)
                {
                    CodUsuario = usuario.IdContacto;
                }
                try
                {
                    Accion = HttpContext.Current.Session["EvalAccion"].ToString();
                }
                catch (Exception)
                {
                    Accion = "Adicionar";
                }
                try
                {
                    codGrupo = usuario.CodGrupo;
                }
                catch (Exception)
                {
                    codGrupo = -1;
                }
                try
                {
                    tabEval = HttpContext.Current.Session["tabEval"].ToString();
                }
                catch (Exception)
                {
                    tabEval = "";
                }
                try
                {
                    CONST_PostIt = Int32.Parse(HttpContext.Current.Session["EvalConsPOST"].ToString());
                }
                catch (FormatException)
                {
                    CONST_PostIt = Constantes.CONST_PostIt;
                }
                catch (Exception)
                {
                    CONST_PostIt = Constantes.CONST_PostIt;
                }
                try
                {
                    txtCampo = HttpContext.Current.Session["Campo"].ToString();
                }
                catch (Exception)
                {
                    txtCampo = "nulo";
                }
            }
            catch (Exception)
            {
                ClientScriptManager cm = this.ClientScript;
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>window.close();</script>");
            }
        }
コード例 #12
0
    protected void BTN_Agregar_Click(object sender, EventArgs e)
    {
        ClientScriptManager cm = this.ClientScript;

        cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Debe iniciar sesion.');window.location=\"Login_Visitante.aspx\"</script>");
    }
コード例 #13
0
 public void RegisterClientScriptBlock(Type type, string key, string script)
 {
     _clientScriptManager.RegisterClientScriptBlock(type, key, script);
 }
コード例 #14
0
        /// <summary>
        /// Handles the Click event of the btncargar control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void btncargar_Click(object sender, EventArgs e)
        {
            ClientScriptManager cm = this.ClientScript;

            string nombreArchivo;
            string extencionArchivo;

            if (!fld_cargar.HasFile)
            {
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('No ha subido ningun archivo');</script>");
                return;
            }
            else
            {
                if (fld_cargar.PostedFile.ContentLength > 10485760)
                {
                    cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('El tamaño del archivo debe ser menor a 10 Mb.');</script>");
                    return;
                }
                else
                {
                    #region Iniciar con el procesamiento del archivo.

                    nombreArchivo    = System.IO.Path.GetFileName(fld_cargar.PostedFile.FileName);
                    extencionArchivo = System.IO.Path.GetExtension(fld_cargar.PostedFile.FileName);

                    if (string.IsNullOrEmpty(nombreArchivo))
                    {
                        cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('No ha subido ningun archivo');</script>");
                        return;
                    }
                    if (!(extencionArchivo.Equals(".xls") || extencionArchivo.Equals(".XLS") || extencionArchivo.Equals(".xlsx") || extencionArchivo.Equals(".XLSX")))
                    {
                        cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Tipo De Archivo No Valido');</script>");
                        return;
                    }

                    string saveLocation = string.Format(Server.MapPath(@"\FonadeDocumentos\CargueMasivo\{0}"), nombreArchivo);

                    if ((System.IO.File.Exists(saveLocation)))
                    {
                        System.IO.File.Delete(saveLocation);
                    }

                    if (!(System.IO.File.Exists(saveLocation)))
                    {
                        fld_cargar.PostedFile.SaveAs(saveLocation);
                    }
                    else
                    {
                        cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ya se encuantra almacenado un archivo con este nombre');</script>");
                        return;
                    }

                    DataTable dt = Excel.recogerExcel(saveLocation, "cargue");
                    if (dt.Rows.Count > 0)
                    {
                        error = string.Empty;

                        foreach (DataRow dr in dt.Rows)
                        {
                            // 2015/07/09 Roberto Alvarado
                            //txtSQL = string.Format("SELECT id_empresa FROM empresa where codproyecto={0}", Convert.IsDBNull(dr[1]) ? 0 : dr[1]);
                            txtSQL = string.Format("SELECT id_empresa FROM empresa where codproyecto={0}", Convert.IsDBNull(dr[0]) ? 0 : dr[0]);

                            SqlDataReader reader = instruccion(txtSQL, 1);
                            if (reader != null && !Convert.IsDBNull(dr[1]))
                            {
                                if (reader.Read())
                                {
                                    string idempresa = reader[0].ToString();
                                    txtSQL = "select * from contratoempresa where codempresa=" + idempresa;
                                    reader = instruccion(txtSQL, 1);
                                    if (reader.Read())
                                    {
                                        txtSQL = string.Format("Update contratoempresa set Numerocontrato={0}, ObjetoContrato='{1}'," +
                                                               "ValorInicialEnPesos={2}, PlazoContratoMeses={3},NumeroAPContrato={4}, FechaAP=CONVERT(DATETIME,'{5}',102), FechaFirmaDelContrato=CONVERT(DATETIME,'{6}',102), " + "NumeroPoliza='{7}',CompaniaSeguros='{8}', FechaDeInicioContrato=CONVERT(DATETIME,'{9}',102) where codempresa={10}",
                                                               dr[2].ToString(), dr[3].ToString(), dr[4].ToString(), dr[5].ToString(), dr[6].ToString(), dr[7].ToString(),
                                                               dr[8].ToString(), dr[9].ToString(), dr[10].ToString(), dr[11].ToString(), idempresa);
                                        instruccion(txtSQL, 2);
                                    }
                                    else
                                    {
                                        txtSQL =
                                            string.Format("insert into contratoempresa (codempresa,Numerocontrato,ObjetoContrato,ValorInicialEnPesos," + "PlazoContratoMeses, NumeroAPContrato,FechaAP,FechaFirmaDelContrato,NumeroPoliza,CompaniaSeguros," +
                                                          "FechaDeInicioContrato)values({0},{1},'{2}',{3},{4},{5},CONVERT(DATETIME,'{6}',102),CONVERT(DATETIME,'{7}',102),'{8}','{9}',CONVERT(DATETIME,'{10}',102))", idempresa,
                                                          dr[2] ?? string.Empty, dr[3] ?? string.Empty, dr[4] ?? string.Empty, dr[5] ?? string.Empty, dr[6] ?? string.Empty,
                                                          dr[7] ?? string.Empty, dr[8] ?? string.Empty, dr[9] ?? string.Empty, dr[10] ?? string.Empty, dr[11] ?? string.Empty);
                                        instruccion(txtSQL, 2);
                                    }
                                }
                                else
                                {
                                    if (string.IsNullOrEmpty(error))
                                    {
                                        error = dr[0].ToString() + " - " + dr[1].ToString();
                                    }
                                    else
                                    {
                                        error += dr[0].ToString() + " - " + dr[1].ToString();
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('el archivo de excel no posee la informacion de la manera correcta {0}');</script>");
                        return;
                    }

                    if ((System.IO.File.Exists(saveLocation)))
                    {
                        System.IO.File.Delete(saveLocation);
                    }

                    if (string.IsNullOrEmpty(error))
                    {
                        cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('El archivo ha sido cargado Satisfactoriamente');</script>");
                        return;
                    }
                    else
                    {
                        cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Los Siguientes Contratos: " + error + " no han sido cargado debido a no estar asociados a una empresa. Por favor Verificar');</script>");
                        return;
                    }

                    #endregion
                }
            }
        }
コード例 #15
0
    protected void B_agregarproducto_Click(object sender, EventArgs e)
    {
        ClientScriptManager cm = this.ClientScript;

        L_productos producto = new L_productos();

        //producto.Fotos(Session["fotos"].ToString());


        DataTable fotos;


        if (Session["fotos"] == null)
        {
            fotos = new DataTable();
            fotos.Columns.Add("ruta");
            fotos.Columns.Add("descripcion");
            Session["fotos"] = fotos;
        }

        fotos = (DataTable)Session["fotos"];

        L_productos datos = new L_productos();

        datos.Fotosnombre(System.IO.Path.GetFileName(FU_imagen.PostedFile.FileName), System.IO.Path.GetExtension(FU_imagen.PostedFile.FileName), Server.MapPath("~\\imagenes") + "\\" + System.IO.Path.GetFileName(FU_imagen.PostedFile.FileName));
        U_pro tad = new U_pro();


        /*  if (!(extencion.Equals(".jpg") || extencion.Equals(".gif") || extencion.Equals(".jpge") || extencion.Equals(".png")))
         * {
         *    cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Tipo de archivo no valido');</script>");
         *    return;
         * }
         * if (System.IO.File.Exists(saveLocation))
         * {
         *    cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ya existe un archivo en el servidor con ese nombre');</script>");
         *    return;
         * }*/
        cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert(tad.mensaje);</script>");



        FU_imagen.PostedFile.SaveAs(Server.MapPath("~\\imagenes") + "\\" + System.IO.Path.GetFileName(FU_imagen.PostedFile.FileName));

        U_pro       dar  = new U_pro();
        L_productos user = new L_productos();

        user.Agregar(("~\\imagenes") + "\\" + System.IO.Path.GetFileName(FU_imagen.PostedFile.FileName), TB_marcaprod.Text, TB_potenciaprod.Text, Int32.Parse(TB_valorprod.Text), Int32.Parse(TB_cantidadprod.Text), Int32.Parse(DDL_categoria.SelectedValue), Int32.Parse(DDL_proveedor.SelectedValue));

        /* E_Producto nuevo = new E_Producto();
         * Dao_Motobombas producto = new Dao_Motobombas();
         *
         * nuevo.Url_imagen = ("~\\imagenes") + "\\" + nombreArchivo;
         * nuevo.Marca = TB_marcaprod.Text;
         * nuevo.Referencia = TB_potenciaprod.Text;
         * nuevo.Valor = Int32.Parse(TB_valorprod.Text);
         * nuevo.Cantidad = Int32.Parse(TB_cantidadprod.Text);
         * nuevo.Id_categoria = Int32.Parse(DDL_categoria.SelectedValue);
         * nuevo.Proveedor_producto = Int32.Parse(DDL_proveedor.SelectedValue);
         * producto.insertarProducto(nuevo);
         *
         * cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Agregado correctamente');window.location=\"AgregarProducto.aspx\"</script>");
         * }
         * catch (Exception exc)
         * {
         * cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Error:Algunos datos incorrectos ');</script>");
         * return;
         * }*/
        cm.RegisterClientScriptBlock(this.GetType(), "", dar.Mensaje1);
    }
コード例 #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            txtWorkOrder.Focus();

            Page.Form.DefaultButton = btnSend.UniqueID;

            var ctrlName = Request.Params[Page.postEventSourceID];
            var args     = Request.Params[Page.postEventArgumentID];

            //HandleCustomPostbackEvent(ctrlName, args);
            //lblOrder.Visible = false;

            Thread.CurrentThread.CurrentCulture   = CultureInfo.CreateSpecificCulture("en-US");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
            base.InitializeCulture();

            if (!IsPostBack)
            {
                Session["save"] = null;
                formName        = Request.Url.AbsoluteUri.Split('/').Last();
                if (formName.Contains('?'))
                {
                    formName = formName.Split('?')[0];
                }

                if (Session["user"] == null)
                {
                    Response.Redirect(ConfigurationManager.AppSettings["UrlBase"] + "/WebPages/Login/whLogIni.aspx");
                }

                _operator = Session["user"].ToString();

                if (Session["ddlIdioma"] != null)
                {
                    _idioma = Session["ddlIdioma"].ToString();
                }
                else
                {
                    _idioma = "INGLES";
                }

                CargarIdioma();

                string strTitulo = mensajes("encabezado");
                Label  control   = (Label)Page.Controls[0].FindControl("lblPageTitle");
                control.Text = strTitulo;
                if (control != null)
                {
                    control.Text = strTitulo;
                }

                Ent_ttccol301 data = new Ent_ttccol301()
                {
                    user    = _operator,
                    come    = strTitulo,
                    refcntd = 0,
                    refcntu = 0
                };

                List <Ent_ttccol301> datalog = new List <Ent_ttccol301>();
                datalog.Add(data);

                _idalttccol301.insertarRegistro(ref datalog, ref strError);
            }

            csType      = this.GetType();
            scriptBlock = Page.ClientScript;

            StringBuilder script = new StringBuilder();

            // Crear el script para la ejecucion de la forma
            script.Append("<script type=\"text/javascript\">function button_click(objTextBox,objBtnID) {");
            script.Append("if(window.event.keyCode==13)");
            script.Append("{");
            script.Append("document.getElementById(objBtnID).focus();");
            script.Append("document.getElementById(objBtnID).click();");
            script.Append("}}");
            script.Append("</script>");

            scriptBlock.RegisterClientScriptBlock(csType, "button_click", script.ToString(), false);
            this.txtWorkOrder.Attributes.Add("onkeypress", "button_click(this," + this.btnSend.ClientID + ")");
        }
コード例 #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            Users oUser = new Users(intProfile, dsn);

            oPlatform        = new Platforms(intProfile, dsn);
            oOrganization    = new Organizations(intProfile, dsn);
            oProjectRequest  = new ProjectRequest(intProfile, dsn);
            oRequest         = new Requests(intProfile, dsn);
            oProject         = new Projects(intProfile, dsn);
            oFunction        = new Functions(intProfile, dsn, intEnvironment);
            oVariable        = new Variables(intEnvironment);
            oApplication     = new Applications(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oAppPage         = new AppPages(intProfile, dsn);
            oApprove         = new ProjectRequest_Approval(intProfile, dsn, intEnvironment);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);



            ClientScriptManager cm = Page.ClientScript;
            String cbReference     = cm.GetCallbackEventReference(this, "arg", "ReceiveServerData", "");
            String callbackScript  = "function CallCheck(arg, context) {" + cbReference + "; }";

            cm.RegisterClientScriptBlock(this.GetType(), "CallCheck", callbackScript, true);


            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }

            lblTitle.Text = "Manage Prioritization";
            if (!IsPostBack)
            {
                ds = oOrganization.Gets(1);
                ddlOrganization.DataValueField = "organizationid";
                ddlOrganization.DataTextField  = "name";
                ddlOrganization.DataSource     = ds;
                ddlOrganization.DataBind();
                ddlOrganization.Items.Insert(0, new ListItem("-- SELECT --", "0"));
            }


            QuestionOrder();
            ResponseOrder();

            if ((Request.QueryString["bd"] != null && Request.QueryString["bd"] != "") && (Request.QueryString["oid"] != null && Request.QueryString["oid"] != ""))
            {
                panShow.Visible               = true;
                ddlBaseDisc.SelectedValue     = Request.QueryString["bd"];
                ddlOrganization.SelectedValue = Request.QueryString["oid"];
                LoadQAs(ddlBaseDisc.SelectedItem.Value, Int32.Parse(ddlOrganization.SelectedValue), false);
            }

            if (Request.QueryString["coll"] != "" && Request.QueryString["coll"] != null)
            {
                chkAll.Checked = true;
                LoadQAs(ddlBaseDisc.SelectedItem.Value, Int32.Parse(ddlOrganization.SelectedValue), true);
            }

            btnView.Attributes.Add("onclick", "return ValidateDropDown('" + ddlBaseDisc.ClientID + "','Please make a selection for the project type') " +
                                   " && ValidateDropDown('" + ddlOrganization.ClientID + "','Please make a selection for organization');");

            btnCopy.Attributes.Add("onclick", "return OpenWindow('PRIORITIZATION_QA','?bd=" + ddlBaseDisc.SelectedItem.Value + "&oid=" + ddlOrganization.SelectedValue + " ');");
        }
コード例 #18
0
    /// <summary>
    /// 弹出js信息
    /// </summary>
    /// <param name="msg"></param>
    public static void Show(string msg)
    {
        ClientScriptManager csm = ((Page)(HttpContext.Current.Handler)).ClientScript;

        csm.RegisterClientScriptBlock(typeof(Page), "", "window.onload=function(){ alert('" + msg + "')};", true);
    }
コード例 #19
0
    protected void lnkrePrint_onclick(Object sender, EventArgs e)
    {
        clearMessages();

        LinkButton  btn   = (LinkButton)sender;
        GridViewRow row   = (GridViewRow)btn.NamingContainer;
        int         _lgid = Convert.ToInt32(grdvLtrPendingreprint.DataKeys[row.RowIndex].Value);

        //string _tempId = grdvLtrPendingreprint.DataKeys[row.RowIndex].Values["lgLetterId"].ToString();
        // string _tempId = grdvLtrPendingreprint.Rows[row.RowIndex].Cells[1].Text;

        LetterGen gObj   = new LetterGen("EBAnamespace");
        Type      cstype = this.GetType();

        try
        {
            string[]            _Letter = gObj.reprintLetters(_lgid);
            ClientScriptManager cs      = Page.ClientScript;

            string _filepath = "C:\\EBATemp\\";
            string _file     = _filepath + "Print.xml";


            int _seq = 0;

            foreach (string _lt in _Letter)
            {
                try
                {
                    if (!cs.IsClientScriptBlockRegistered(_seq + "SaveExcel"))
                    {
                        cs.RegisterClientScriptBlock(typeof(Page), _seq + "SaveExcel", "SaveTextFile('" + _lt.Replace(Environment.NewLine, "") + "', '" + _file.Replace("\\", "\\\\") + "');", true);
                    }

                    if (!cs.IsClientScriptBlockRegistered(_seq + "PrintWord"))
                    {
                        cs.RegisterClientScriptBlock(typeof(Page), _seq + "PrintWord", "PrintWord('" + _file.Replace("\\", "\\\\") + "');", true);
                    }
                }
                finally
                {
                    EndProcess();
                    if (!cs.IsClientScriptBlockRegistered(_seq + "DeleteFile"))
                    {
                        cs.RegisterClientScriptBlock(typeof(Page), _seq + "DeleteFile", "DeleteFile('" + _file.Replace("\\", "\\\\") + "');", true);
                    }
                }
                _seq++;
            }
        }
        catch (Exception ex)
        {
            errorDiv2.Visible = true;
            lbl_error1.Text   = "Some error occured while printing letters - " + ex.Message;
        }
        finally
        {
            grdvltrPending.DataBind();
            grdvLtrPendingreprint.DataBind();
        }
    }
コード例 #20
0
        private void CrearNuevoAsesor()
        {
            /* esta funcion inserta un registro en la tabla de contacto, si el contacto no existe previamente
             * y envia el codigo del nuevo contacto creado al programa padre para su posterior creacion de registro
             * en la tabla grupocontacto.
             */
            //SqlDataReader reader = null;

            string txtNombres            = tb_NombreAsesor.Text;
            string txtApellidos          = tb_ApellidoAsesor.Text;
            string txtEmail              = tb_Email.Text;
            string CodTipoIdentificacion = HttpContext.Current.Session["tb_TipodeIdentificacion"].ToString();
            string numIdentificacion     = HttpContext.Current.Session["tb_NumeroDocumento"].ToString();

            HttpContext.Current.Session["tb_Email"]                = txtEmail;
            HttpContext.Current.Session["tb_NombreAsesor"]         = txtNombres;
            HttpContext.Current.Session["tb_NumeroDocumento"]      = tb_NumeroDocumento.Text;
            HttpContext.Current.Session["tb_ApellidoAsesor"]       = txtApellidos;
            HttpContext.Current.Session["tb_NumeroIdentificacion"] = numIdentificacion;
            HttpContext.Current.Session["NombreTipoId"]            = ddl_tipoDocumento.SelectedItem;

            #region validarCampos
            if (String.IsNullOrEmpty(txtNombres) || String.IsNullOrEmpty(txtApellidos) || String.IsNullOrEmpty(txtEmail) || String.IsNullOrEmpty(numIdentificacion))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "alert('Todos los campos son requeridos')", true);
                return;
            }

            if (!IsValidEmail(txtEmail))
            {
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "alert('El correo no es valido')", true);
                    return;
                }
            }

            Int64 valida;

            if (!Int64.TryParse(numIdentificacion, out valida))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "alert('El campo numero de identificacion tiene que ser numero')", true);
                return;
            }
            #endregion


            string txtClave = GeneraClave();

            string txtSQL = "SELECT Email FROM Contacto WHERE Email like'%" + txtEmail + "%'";


            var resul = consultas.ObtenerDataTable(txtSQL, "text");

            if (resul.Rows.Count != 0)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "alert('El usuario con el correo electrónico ingresado ya existe en el sistema.')", true);
                return;
            }
            else
            {
                #region crearAsesor
                txtSQL = "INSERT INTO Contacto (Nombres, Apellidos, CodTipoIdentificacion, Identificacion,Email,Clave) VALUES('" + txtNombres + "','" + txtApellidos + "'," + CodTipoIdentificacion + "," + numIdentificacion + ",'" + txtEmail + "','" + txtClave + "')";
                ejecutaReader(txtSQL, 2);

                txtSQL = "SELECT Id_Contacto FROM Contacto WHERE CodTipoIdentificacion = " + CodTipoIdentificacion + " AND Identificacion = " + numIdentificacion;
                //reader = ejecutaReader(txtSQL, 1);
                var dt = consultas.ObtenerDataTable(txtSQL, "text");

                int    CodContacto = 0;
                string txtNomTipoDoc;

                if (dt.Rows.Count > 0)
                {
                    CodContacto = int.Parse(dt.Rows[0].ItemArray[0].ToString());
                }
                //if (reader != null)
                //    if (reader.Read())
                //        CodContacto = Convert.ToInt32(reader[0].ToString());
                HttpContext.Current.Session["CodContacto"] = CodContacto;//no se usa.


                txtSQL = "SELECT NomTipoIdentificacion FROM TipoIdentificacion WHERE Id_TipoIdentificacion = " + CodTipoIdentificacion;
                //reader = ejecutaReader(txtSQL, 1);
                var dt2 = consultas.ObtenerDataTable(txtSQL, "text");

                if (dt2.Rows.Count > 0)
                {
                    txtNomTipoDoc = dt2.Rows[0].ItemArray[0].ToString();
                }
                //if (reader != null)
                //    if (reader.Read())
                //        txtNomTipoDoc = reader[0].ToString();
                #endregion

                CodContacto_ = CodContacto;//si se usa.

                //ejecuta javascript en el programa padre.

                ClientScriptManager cm = this.ClientScript;
                cm.RegisterClientScriptBlock(this.GetType(), "",
                                             "<script type='text/javascript'>window.opener.enviaCodigoAsesor('" + CodContacto_.ToString() + "');window.close();</script>");
            }
        }
コード例 #21
0
    protected void lnkGen1_Click(object sender, EventArgs e)
    {
        string _ltrType = ddlLetterType.SelectedItem.Text;
        string _ltrCode = ddlLetterType.SelectedItem.Value;
        string _empnums = txtEmpNum.Text.Trim();

        clearMessages();
        List <string> _elList0       = new List <string>();
        List <string> _elList1       = new List <string>();
        string        _exceptionEmpl = "";

        LetterGen gObj   = new LetterGen("EBAnamespace");
        Type      cstype = this.GetType();

        try
        {
            if (rdbFilter.SelectedValue.Equals("0"))
            {
                int                 _version = LettersGenDAL.getTemplateVersion(_ltrCode);
                string[]            _Letter  = gObj.generateLetter(_ltrCode, _version, false);
                ClientScriptManager cs       = Page.ClientScript;

                string _filepath = "C:\\EBATemp\\";
                string _file     = _filepath + "Print.xml";

                int _seq = 0;

                foreach (string _lt in _Letter)
                {
                    try
                    {
                        if (!cs.IsClientScriptBlockRegistered(_seq + "SaveExcel"))
                        {
                            cs.RegisterClientScriptBlock(typeof(Page), _seq + "SaveExcel", "SaveTextFile('" + _lt.Replace(Environment.NewLine, "") + "', '" + _file.Replace("\\", "\\\\") + "');", true);
                        }

                        if (!cs.IsClientScriptBlockRegistered(_seq + "PrintWord"))
                        {
                            cs.RegisterClientScriptBlock(typeof(Page), _seq + "PrintWord", "PrintWord('" + _file.Replace("\\", "\\\\") + "');", true);
                        }
                    }
                    finally
                    {
                        EndProcess();
                        if (!cs.IsClientScriptBlockRegistered(_seq + "DeleteFile"))
                        {
                            cs.RegisterClientScriptBlock(typeof(Page), _seq + "DeleteFile", "DeleteFile('" + _file.Replace("\\", "\\\\") + "');", true);
                        }
                    }
                    _seq++;
                }
            }
            else if (rdbFilter.SelectedValue.Equals("1"))
            {
                if (!_empnums.Equals(""))
                {
                    _elList0 = gObj.createEmpList(_empnums);
                    foreach (string _empl in _elList0)
                    {
                        PilotData pData  = new PilotData();
                        int       _order = pData.getBeneficiaryOrders(Convert.ToInt32(_empl));
                        if (_order == 0)
                        {
                            //The following logic was replaced due to an exception ..3/9/2009 R.A - as per Andrea D
                            // The Ben Designation letter should print even when there are no dependants for a Pilot
                            //_exceptionEmpl += " " + _empl + ",";
                            //Added this line..where Pilots with no deps are added to the _elist to print the letter
                            _elList1.Add(_empl);
                        }
                        else
                        {
                            _elList1.Add(_empl);
                        }
                        pData = null;
                    }
                    if (!_exceptionEmpl.Equals(""))
                    {
                        infoDiv1.Visible = true;
                        _exceptionEmpl   = _exceptionEmpl.Remove(_exceptionEmpl.Length - 1);
                        lblInfo.Text     = "Employee number(s) <br/>" + _exceptionEmpl + "<br/> don't have any Beneficiary Listed. <br/> No Letters were generated for above Employee Numbers";
                    }
                }

                string _empListFinal = gObj.createEmplCSV(_elList1);

                int                 _version = LettersGenDAL.getTemplateVersion(_ltrCode);
                string[]            _Letter  = gObj.generateLetter(_empListFinal, _ltrCode, _version);
                ClientScriptManager cs       = Page.ClientScript;

                string _filepath = "C:\\EBATemp\\";
                string _file     = _filepath + "Print.xml";


                int _seq = 0;

                foreach (string _lt in _Letter)
                {
                    try
                    {
                        if (!cs.IsClientScriptBlockRegistered(_seq + "SaveExcel"))
                        {
                            cs.RegisterClientScriptBlock(typeof(Page), _seq + "SaveExcel", "SaveTextFile('" + _lt.Replace(Environment.NewLine, "") + "', '" + _file.Replace("\\", "\\\\") + "');", true);
                        }

                        if (!cs.IsClientScriptBlockRegistered(_seq + "PrintWord"))
                        {
                            cs.RegisterClientScriptBlock(typeof(Page), _seq + "PrintWord", "PrintWord('" + _file.Replace("\\", "\\\\") + "');", true);
                        }
                    }
                    finally
                    {
                        EndProcess();
                        if (!cs.IsClientScriptBlockRegistered(_seq + "DeleteFile"))
                        {
                            cs.RegisterClientScriptBlock(typeof(Page), _seq + "DeleteFile", "DeleteFile('" + _file.Replace("\\", "\\\\") + "');", true);
                        }
                    }
                    _seq++;
                }
            }
        }
        catch (Exception ex)
        {
            clearMessages();
            errorDiv1.Visible = true;
            lbl_error.Text    = "Some error occured while printing letters - " + ex.Message;
        }
        finally
        {
            Alert.Show("The Summary Plan Description (SPD) Addendum can be printed by clicking on the Generate SPD Letter");
        }
    }
コード例 #22
0
    protected void AddLiab(object sender, EventArgs e)
    {
        if (dp_datedue.SelectedDate != null && tb_value.Text.Trim() != "" && tb_name.Text.Trim() != "")
        {
            tb_value.Text   = tb_value.Text.Trim();
            tb_name.Text    = tb_name.Text.Trim();
            tb_notes.Text   = tb_notes.Text.Trim();
            tb_invoice.Text = tb_invoice.Text.Trim();
            tb_cheque.Text  = tb_cheque.Text.Trim();

            String cheque        = "0";
            String cheque_number = null;
            if (cb_cheque.Checked)
            {
                cheque        = "1";
                cheque_number = tb_cheque.Text;
            }

            String directd = "0";
            if (cb_directd.Checked)
            {
                directd = "1";
            }

            String recur      = "0";
            String recur_type = null;
            if (cb_recur.Checked)
            {
                recur      = "1";
                recur_type = dd_recur_type.SelectedItem.Text;
            }

            bool     add      = true;
            String   date_due = null;
            DateTime d;
            if (dp_datedue.SelectedDate != null)
            {
                if (DateTime.TryParse(dp_datedue.SelectedDate.ToString(), out d))
                {
                    date_due = d.ToString("yyyy/MM/dd");
                }
                else
                {
                    Util.PageMessage(this, "A date error occured, please try again.");
                    add = false;
                }
            }
            if (hf_office.Value.Trim() == String.Empty)
            {
                add = false;
            }

            String type = dd_type.SelectedItem.Text;

            String Invoice = tb_invoice.Text;
            if (String.IsNullOrEmpty(Invoice))
            {
                Invoice = null;
            }

            String Notes = tb_notes.Text;
            if (String.IsNullOrEmpty(Notes))
            {
                Notes = null;
            }

            // Add new liability.
            if (add)
            {
                try
                {
                    String iqry = "INSERT INTO db_financeliabilities " +
                                  "(Office, Year, LiabilityName, LiabilityValue, LiabilityNotes, DateDue, Invoice, " +
                                  "Cheque, DirectDebit, IsRecurring, Type, RecurType, ChequeNumber) " +
                                  "VALUES(@office, @year, @liab_name, @liab_value, @liab_notes, @date_due, @invoice, " +
                                  "@cheque, @directd, @recurring, @type, @recur_type, @cheque_number)";
                    String[] pn = new String[] { "@office", "@year", "@liab_name", "@liab_value", "@liab_notes", "@date_due",
                                                 "@invoice", "@cheque", "@directd", "@recurring", "@type", "@recur_type", "@cheque_number" };
                    Object[] pv = new Object[] { hf_office.Value,
                                                 hf_year.Value,
                                                 tb_name.Text,
                                                 tb_value.Text,
                                                 Notes,
                                                 date_due,
                                                 Invoice,
                                                 cheque,
                                                 directd,
                                                 recur,
                                                 type,
                                                 recur_type,
                                                 cheque_number };
                    SQL.Insert(iqry, pn, pv);

                    ClientScriptManager script = Page.ClientScript;
                    if (!((LinkButton)sender).ID.Contains("next"))
                    {
                        Util.CloseRadWindow(this, tb_name.Text, false);

                        hf_office.Value = String.Empty;
                        hf_year.Value   = String.Empty;
                    }
                    else
                    {
                        Util.PageMessage(this, "Liability successfully added, click OK to add another.");
                        script.RegisterClientScriptBlock(this.GetType(), "", "<script type=text/javascript> " +
                                                         "GetRadWindow().BrowserWindow.AddToNewLiabList('" + Server.HtmlEncode(tb_name.Text.Replace("'", "\\'")) + "');" +
                                                         "</script>");
                        ClearAll();
                    }
                }
                catch (Exception r)
                {
                    if (Util.IsTruncateError(this, r))
                    {
                    }
                    else if (r.Message.Contains("Duplicate"))
                    {
                        Util.PageMessage(this, "A liability with this name already exists in " + hf_office.Value + " - " + hf_year.Value + ". Please enter a new name.");
                    }
                    else
                    {
                        Util.WriteLogWithDetails(r.Message + " " + r.StackTrace, "finance_log");
                        Util.PageMessage(this, "An error occured, please try again.");
                    }
                }
            }
        }
        else
        {
            Util.PageMessage(this, "You must specify at least a liability name, value and due date!");
        }
    }
コード例 #23
0
    protected void lnkPrint_onclick(Object sender, EventArgs e)
    {
        clearMessages();

        LinkButton  btn   = (LinkButton)sender;
        GridViewRow row   = (GridViewRow)btn.NamingContainer;
        int         _lgid = Convert.ToInt32(grdvltrPending.DataKeys[row.RowIndex].Value);

        string _empNum     = grdvltrPending.Rows[row.RowIndex].Cells[1].Text;
        string _dpndssn    = grdvltrPending.Rows[row.RowIndex].Cells[2].Text;
        string _dpndRel    = grdvltrPending.Rows[row.RowIndex].Cells[3].Text;
        string _letterType = "";

        switch (_dpndRel)
        {
        case "SP":
            _letterType = "HRB1";
            break;

        case "CH":
            _letterType = "HRB2";
            break;
        }

        LetterGen gObj   = new LetterGen("EBAnamespace");
        Type      cstype = this.GetType();

        try
        {
            int                 _version = LettersGenDAL.getTemplateVersion(_letterType);
            string[]            _Letter  = gObj.generateBenValidationLetter(Convert.ToInt32(_empNum), _dpndssn, _letterType, _version, _lgid);
            ClientScriptManager cs       = Page.ClientScript;

            string _filepath = "C:\\EBATemp\\";
            string _file     = _filepath + "Print.xml";


            int _seq = 0;

            foreach (string _lt in _Letter)
            {
                try
                {
                    if (!cs.IsClientScriptBlockRegistered(_seq + "SaveExcel"))
                    {
                        cs.RegisterClientScriptBlock(typeof(Page), _seq + "SaveExcel", "SaveTextFile('" + _lt.Replace(Environment.NewLine, "") + "', '" + _file.Replace("\\", "\\\\") + "');", true);
                    }

                    if (!cs.IsClientScriptBlockRegistered(_seq + "PrintWord"))
                    {
                        cs.RegisterClientScriptBlock(typeof(Page), _seq + "PrintWord", "PrintWord('" + _file.Replace("\\", "\\\\") + "');", true);
                    }
                }
                finally
                {
                    EndProcess();
                    if (!cs.IsClientScriptBlockRegistered(_seq + "DeleteFile"))
                    {
                        cs.RegisterClientScriptBlock(typeof(Page), _seq + "DeleteFile", "DeleteFile('" + _file.Replace("\\", "\\\\") + "');", true);
                    }
                }
                _seq++;
            }
        }
        catch (Exception ex)
        {
            errorDiv2.Visible = true;
            lbl_error1.Text   = "Some error occured while printing letters - " + ex.Message;
        }
        finally
        {
            grdvltrPending.DataBind();
            grdvLtrPendingreprint.DataBind();
        }
    }
コード例 #24
0
    protected void B_Guardar_Click(object sender, EventArgs e)
    {
        ClientScriptManager cm = this.ClientScript;

        string nombreArchivo = System.IO.Path.GetFileName(FU_ImagenPerfil.PostedFile.FileName);

        if (nombreArchivo.Equals(""))
        {
            Usuario usuario = new Usuario();
            usuario.Id_usuario = ((Usuario)Session["user"]).Id_usuario;
            usuario.Correo     = TB_Correo.Text;
            usuario.Nickname   = TB_Nickname.Text;
            usuario.Nombre     = TB_Nombre.Text;

            //usuario.Precio = Double.Parse(TB_Precio.Text);

            new DAOUsuario().updateUsuario(usuario);
        }
        else
        {
            string extension = System.IO.Path.GetExtension(FU_ImagenPerfil.PostedFile.FileName);

            string saveLocation = Server.MapPath("~\\Imagenes\\ImagenesPerfil") + "\\" + nombreArchivo;


            if (!(extension.Equals(".jpg") || extension.Equals(".gif") || extension.Equals(".jpeg") || extension.Equals(".png")))
            {
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Tipo de archivo no valido');</script>");
                return;
            }

            if (System.IO.File.Exists(saveLocation))
            {
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ya existe un archivo en el servidor con ese nombre');</script>");
                return;
            }

            try
            {
                FU_ImagenPerfil.PostedFile.SaveAs(saveLocation);
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('El archivo ha sido cargado');</script>");

                Usuario usuario = new Usuario();
                usuario.Id_usuario = ((Usuario)Session["user"]).Id_usuario;
                usuario.Imagen     = "~\\Imagenes\\ImagenesPerfil" + "\\" + nombreArchivo;
                usuario.Correo     = TB_Correo.Text;
                usuario.Nickname   = TB_Nickname.Text;
                usuario.Nombre     = TB_Nombre.Text;

                //usuario.Precio = Double.Parse(TB_Precio.Text);

                new DAOUsuario().updateUsuario(usuario);
                I_Perfil.ImageUrl = usuario.Imagen;
            }
            catch (Exception ex)
            {
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Error: ');</script>");
                return;
            }
        }
    }
コード例 #25
0
    protected void btnSave_Click(object sender, System.EventArgs e)
    {
        byte SysMessageTypeId = 0;
        int  SysMessageId     = 0;

        System.Int32 EditId;
        Supplier     m_Supplier = new Supplier();

        if (Request.QueryString["id"] == null)
        {
            EditId = 0;
        }
        else
        {
            EditId = System.Int32.Parse(Request.QueryString["id"].ToString());
            m_Supplier.SupplierId = EditId;
            m_Supplier            = m_Supplier.Get();
        }
        try
        {
            if (txSupplierName.Text == "")
            {
                JSAlertHelpers.Alert("Mời bạn nhập các thông tin bắt buộc!", this);
                return;
            }
            if (txReviewStatusId.Text == "")
            {
                JSAlertHelpers.Alert("Mời bạn nhập các thông tin bắt buộc!", this);
                return;
            }


            m_Supplier.CrUserId = ActUserId;

            if (txSupplierName.Text != "")
            {
                m_Supplier.SupplierName = txSupplierName.Text;
            }

            if (txSupplierDesc.Text != "")
            {
                m_Supplier.SupplierDesc = txSupplierDesc.Text;
            }

            if (txAddress.Text != "")
            {
                m_Supplier.Address = txAddress.Text;
            }

            if (txImagePath.Text != "")
            {
                m_Supplier.ImagePath = txImagePath.Text;
            }

            if (txMobile.Text != "")
            {
                m_Supplier.Mobile = txMobile.Text;
            }

            if (txTelephone.Text != "")
            {
                m_Supplier.Telephone = txTelephone.Text;
            }

            if (txComments.Text != "")
            {
                m_Supplier.Comments = txComments.Text;
            }

            m_Supplier.DisplayOrder = int.Parse(txDisplayOrder.Text);

            m_Supplier.ReviewStatusId = byte.Parse(txReviewStatusId.Text);

            m_Supplier.SupplierId = EditId;
            SysMessageTypeId      = m_Supplier.InsertOrUpdate(ConstantHelpers.Replicated, ActUserId, ref SysMessageId);

            StringBuilder       csText = new StringBuilder();
            Type                cstype = this.GetType();
            ClientScriptManager cs     = Page.ClientScript;
            csText.Clear();
            csText.Append("<script type=\"text/javascript\">");
            csText.Append("window.parent.jQuery('#divEdit').dialog('close');");
            csText.Append("</script>");
            cs = Page.ClientScript;
            cs.RegisterClientScriptBlock(this.GetType(), "system_message", csText.ToString());
        }
        catch (Exception ex)
        {
            sms.utils.LogFiles.LogError(((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name + "\t" + ex.ToString());
            JSAlertHelpers.Alert(ex.Message, this);
        }
    }
コード例 #26
0
    protected void B_Agregar_Click(object sender, EventArgs e)
    {
        ClientScriptManager cm = this.ClientScript;
        string nombreArchivo   = System.IO.Path.GetFileName(FU_Imagen.PostedFile.FileName);
        string extension       = System.IO.Path.GetExtension(FU_Imagen.PostedFile.FileName);

        string saveLocation = Server.MapPath("~\\Imagenes\\ImagenesJuegos") + "\\" + nombreArchivo;

        if (!(extension.Equals(".jpg") || extension.Equals(".gif") || extension.Equals(".jpeg") || extension.Equals(".png")))
        {
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Tipo de archivo no valido');</script>");
            return;
        }

        if (System.IO.File.Exists(saveLocation))
        {
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ya existe un archivo en el servidor con ese nombre');</script>");
            return;
        }
        try
        {
            FU_Imagen.PostedFile.SaveAs(saveLocation);
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('El archivo ha sido cargado');</script>");

            /*if (TB_Nombre.Text.Equals("") || TB_descripcion.Text.Equals("") || TB_Cantidad)
             * {
             *
             * }*/
            Videojuego videojuego = new Videojuego();
            videojuego.Id_categoría  = int.Parse(DDL_Categorias.SelectedValue);
            videojuego.Id_plataforma = int.Parse(DDL_Plataformas.SelectedValue);
            videojuego.Imagen        = "~\\Imagenes\\ImagenesJuegos" + "\\" + nombreArchivo;
            videojuego.Nom_juego     = TB_Nombre.Text;
            videojuego.Descripcion   = TB_descripcion.Text;

            /*if (videojuego.Nom_juego.Equals("") || videojuego.Descripcion.Equals("") || )
             * {
             *
             * }*/

            videojuego.Cantidad = int.Parse(TB_Cantidad.Text);
            if (videojuego.Cantidad == 0)
            {
                videojuego.Id_estadoV = 2;
            }
            else
            {
                videojuego.Id_estadoV = 1;
            }
            videojuego.Precio = int.Parse(TB_Precio.Text);
            //usuario.Precio = Double.Parse(TB_Precio.Text);
            Videojuego validacion = new DAOVideojuego().ValidacionVideojuego(videojuego);

            if (validacion == null)
            {
                new DAOVideojuego().insertJuego(videojuego);
            }
            else
            {
                if (validacion.Nom_juego == videojuego.Nom_juego)
                {
                    L_Mensaje.Text = "Nombre ya registrado";
                    TB_Nombre.Text = string.Empty;
                }
                if (validacion.Descripcion == videojuego.Descripcion)
                {
                    L_Mensaje.Text      = "Descripción ya ingresada";
                    TB_descripcion.Text = string.Empty;
                }
            }
        }
        catch (Exception)
        {
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Error: ');</script>");
            return;
        }
    }
コード例 #27
0
ファイル: account.aspx.cs プロジェクト: lulzzz/BrandStore
        public void RefreshPage()
        {
            Address BillingAddress  = new Address();
            Address ShippingAddress = new Address();

            BillingAddress.LoadByCustomer(ThisCustomer.CustomerID, ThisCustomer.PrimaryBillingAddressID, AddressTypes.Billing);
            ShippingAddress.LoadByCustomer(ThisCustomer.CustomerID, ThisCustomer.PrimaryShippingAddressID, AddressTypes.Shipping);

            if (Checkout)
            {
                if (ThisCustomer.PrimaryBillingAddressID == 0 || ThisCustomer.PrimaryShippingAddressID == 0 ||
                    !ThisCustomer.HasAtLeastOneAddress() || (AppLogic.AppConfigBool("DisallowShippingToPOBoxes") && (!(new POBoxAddressValidator()).IsValid(ShippingAddress))))
                {
                    lblErrorMessage.Text = AppLogic.GetString("account.aspx.73", ThisCustomer.SkinID, ThisCustomer.LocaleSetting);
                    pnlErrorMsg.Visible  = true;
                }
            }

            ErrorMessage e = new ErrorMessage(CommonLogic.QueryStringNativeInt("errormsg"));

            lblErrorMessage.Text     += Server.HtmlEncode(e.Message);
            pnlAccountUpdated.Visible = AccountUpdated;
            if (AccountUpdated)
            {
                if (!NewEmailAddressAllowed)
                {
                    lblAcctUpdateMsg.Text += CommonLogic.IIF(lblAcctUpdateMsg.Text.Trim() == "", "", "") + AppLogic.GetString("account.aspx.3", SkinID, ThisCustomer.LocaleSetting);
                    ctrlAccount.Email      = ThisCustomer.EMail;
                }
                else
                {
                    lblAcctUpdateMsg.Text = CommonLogic.IIF(lblAcctUpdateMsg.Text.Trim() == "", "", "") + AppLogic.GetString("account.aspx.2", SkinID, ThisCustomer.LocaleSetting);
                }

                //In case email address confirmation is on.
                TextBox txtReEnterEmail = (TextBox)ctrlAccount.FindControl("txtReEnterEmail");
                if (txtReEnterEmail != null)
                {
                    txtReEnterEmail.Text = String.Empty;
                }
            }

            pnlNotCheckOutButtons.Visible      = !Checkout;
            pnlShowWishButton.Visible          = AppLogic.AppConfigBool("ShowWishButtons");
            pnlShowGiftRegistryButtons.Visible = AppLogic.AppConfigBool("ShowGiftRegistryButtons");
            pnlSubscriptionExpiresOn.Visible   = (ThisCustomer.SubscriptionExpiresOn > System.DateTime.Now);
            lblSubscriptionExpiresOn.Text      = String.Format(AppLogic.GetString("account.aspx.5", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), Localization.ToThreadCultureShortDateString(ThisCustomer.SubscriptionExpiresOn));
            OriginalEMail.Text = ThisCustomer.EMail;
            //lblCustomerLevel.Visible = pnlCustomerLevel.Visible = (ThisCustomer.CustomerLevelID != 0);
            lblCustomerLevel.Visible      = pnlCustomerLevel.Visible = false;
            lblCustomerLevel.Text         = String.Format(AppLogic.GetString("account.aspx.9", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), ThisCustomer.CustomerLevelName);
            lblMicroPayEnabled.Visible    = pnlMicroPayEnabled.Visible = (AppLogic.MicropayIsEnabled() && ThisCustomer.IsRegistered && AppLogic.GetMicroPayProductID() != 0);
            lblMicroPayEnabled.Text       = String.Format(AppLogic.GetString("account.aspx.10", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), AppLogic.GetString("account.aspx.11", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), ThisCustomer.CurrencyString(ThisCustomer.MicroPayBalance));
            btnContinueToCheckOut.Visible = Checkout;

            GatewayCheckoutByAmazon.CheckoutByAmazon checkoutByAmazon = new GatewayCheckoutByAmazon.CheckoutByAmazon();

            if (ThisCustomer.PrimaryBillingAddressID == 0 || checkoutByAmazon.IsAmazonAddress(ThisCustomer.PrimaryBillingAddress))
            {
                //  pnlBilling.Visible = false;
            }
            if (ThisCustomer.PrimaryShippingAddressID == 0 || checkoutByAmazon.IsAmazonAddress(ThisCustomer.PrimaryShippingAddress))
            {
                //pnlShipping.Visible = false;
            }
            lnkChangeBilling.NavigateUrl  = "javascript:self.location='JWMyAddresses.aspx?Checkout=" + Checkout.ToString() + "&AddressType=1&returnURL=" + Server.UrlEncode("account.aspx?checkout=" + Checkout.ToString()) + "'";
            lnkChangeShipping.NavigateUrl = "javascript:self.location='JWMyAddresses.aspx?Checkout=" + Checkout.ToString() + "&AddressType=2&returnURL=" + Server.UrlEncode("account.aspx?checkout=" + Checkout.ToString()) + "'";

            //lnkAddBillingAddress.NavigateUrl = "JWMyAddresses.aspx?add=true&addressType=1&Checkout=" + Checkout.ToString() + "&returnURL=" + Server.UrlEncode("account.aspx?checkout=" + Checkout.ToString());
            //lnkAddBillingAddress.Text = "<div>" + AppLogic.GetString("account.aspx.63", SkinID, ThisCustomer.LocaleSetting) + "</div>";
            //lnkAddShippingAddress.NavigateUrl = "JWMyAddresses.aspx?add=true&addressType=2&Checkout=" + Checkout.ToString() + "&returnURL=" + Server.UrlEncode("account.aspx?checkout=" + Checkout.ToString());
            //lnkAddShippingAddress.Text = "<div>" + AppLogic.GetString("account.aspx.62", SkinID, ThisCustomer.LocaleSetting) + "</div>";

            if (BillingAddress.AddressID != 0)
            {
                litBillingAddress.Text = BillingAddress.DisplayHTML(true);
            }
            if (BillingAddress.PaymentMethodLastUsed.Length != 0)
            {
                //need for future use
                //litBillingAddress.Text += "<div>" + AppLogic.GetString("account.aspx.31", SkinID, ThisCustomer.LocaleSetting);
                //  litBillingAddress.Text += "<div>" + BillingAddress.DisplayPaymentMethodInfo(ThisCustomer, BillingAddress.PaymentMethodLastUsed) + "</div>";
            }

            if (!(new POBoxAddressValidator()).IsValid(ShippingAddress))
            {
                litShippingAddress.Text = "<div class='error-wrap'>" + "createaccount_process.aspx.3".StringResource() + "</div>"; //PO box not allowed
            }
            else
            {
                if (ShippingAddress.AddressID != 0)
                {
                    litShippingAddress.Text = "Cannot ship to P.O boxes" + ShippingAddress.DisplayHTML(true);
                }
            }


            pnlOrderHistory.Visible = !Checkout;

            GiftCards gc = new GiftCards(ThisCustomer.CustomerID, GiftCardCollectionFilterType.UsingCustomerID);

            if (gc.Count > 0)
            {
                rptrGiftCards.DataSource = gc;
                rptrGiftCards.DataBind();
                pnlGiftCards.Visible = true;
            }

            if (ShoppingCart.NumItems(ThisCustomer.CustomerID, CartTypeEnum.RecurringCart) != 0)
            {
                ltRecurringOrders.Text = "<div class=\"group-header account-header recurring-header\">" + AppLogic.GetString("account.aspx.35", SkinID, ThisCustomer.LocaleSetting) + "</div>";

                // build JS code to show/hide address update block:
                StringBuilder tmpS = new StringBuilder(4096);
                tmpS.Append("<script type=\"text/javascript\">\n");
                tmpS.Append("function toggleLayer(DivID)\n");
                tmpS.Append("{\n");
                tmpS.Append("	var elem;\n");
                tmpS.Append("	var vis;\n");
                tmpS.Append("	if(document.getElementById)\n");
                tmpS.Append("	{\n");
                tmpS.Append("		// standards\n");
                tmpS.Append("		elem = document.getElementById(DivID);\n");
                tmpS.Append("	}\n");
                tmpS.Append("	else if(document.all)\n");
                tmpS.Append("	{\n");
                tmpS.Append("		// old msie versions\n");
                tmpS.Append("		elem = document.all[DivID];\n");
                tmpS.Append("	}\n");
                tmpS.Append("	else if(document.layers)\n");
                tmpS.Append("	{\n");
                tmpS.Append("		// nn4\n");
                tmpS.Append("		elem = document.layers[DivID];\n");
                tmpS.Append("	}\n");
                tmpS.Append("	vis = elem.style;\n");
                tmpS.Append("	if(vis.display == '' && elem.offsetWidth != undefined && elem.offsetHeight != undefined)\n");
                tmpS.Append("	{\n");
                tmpS.Append("		vis.display = (elem.offsetWidth != 0 && elem.offsetHeight != 0) ? 'block' : 'none';\n");
                tmpS.Append("	}\n");
                tmpS.Append("	vis.display = (vis.display == '' || vis.display == 'block') ? 'none' : 'block' ;\n");
                tmpS.Append("}\n");
                tmpS.Append("</script>\n");
                tmpS.Append("\n");
                tmpS.Append("<style type=\"text/css\">\n");
                tmpS.Append("	.addressBlockDiv { margin: 0px 20px 0px 20px;  display: none;}\n");
                tmpS.Append("</style>\n");
                ltRecurringOrders.Text += tmpS.ToString();

                using (SqlConnection con = new SqlConnection(DB.GetDBConn()))
                {
                    con.Open();
                    using (IDataReader rsr = DB.GetRS("Select distinct OriginalRecurringOrderNumber from ShoppingCart   with (NOLOCK)  where CartType=" + ((int)CartTypeEnum.RecurringCart).ToString() + " and CustomerID=" + ThisCustomer.CustomerID.ToString() + " order by OriginalRecurringOrderNumber desc", con))
                    {
                        while (rsr.Read())
                        {
                            ltRecurringOrders.Text += AppLogic.GetRecurringCart(base.EntityHelpers, base.GetParser, ThisCustomer, DB.RSFieldInt(rsr, "OriginalRecurringOrderNumber"), SkinID, false);
                        }
                    }
                }
            }

            string[] TrxStates = { DB.SQuote(AppLogic.ro_TXStateAuthorized), DB.SQuote(AppLogic.ro_TXStateCaptured), DB.SQuote(AppLogic.ro_TXStatePending) };

            using (SqlConnection con = new SqlConnection(DB.GetDBConn()))
            {
                con.Open();
                using (IDataReader rs = DB.GetRS(string.Format("Select OrderNumber, OrderDate, RecurringSubscriptionID, PaymentMethod, CardNumber, TransactionState, QuoteCheckout, ShippedOn, ShippedVIA, ShippingTrackingNumber, DownloadEMailSentOn, QuoteCheckout, PaymentMethod, " +
                                                               "OrderTotal, CouponType, isnull(CouponDiscountAmount, 0) CouponDiscountAmount, CustomerServiceNotes  from dbo.orders   with (NOLOCK)  where TransactionState in ({0}) and CustomerID={1} and ({2} = 0 or StoreID = {3}) order by OrderDate desc", String.Join(",", TrxStates),
                                                               ThisCustomer.CustomerID, CommonLogic.IIF(AppLogic.GlobalConfigBool("AllowCustomerFiltering") == true, 1, 0), AppLogic.StoreID()), con))
                {
                    orderhistorylist.DataSource = rs;
                    orderhistorylist.DataBind();
                }
            }

            accountaspx55.Visible = (orderhistorylist.Items.Count == 0);

            ClientScriptManager cs = Page.ClientScript;

            cs.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString(), "function ReOrder(OrderNumber) {if(confirm('" + AppLogic.GetString("account.aspx.64", SkinID, ThisCustomer.LocaleSetting) + "')) {top.location.href='reorder.aspx?ordernumber='+OrderNumber;} }", true);

            ctrlAccount.Password        = String.Empty;
            ctrlAccount.PasswordConfirm = String.Empty;
        }
コード例 #28
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        EUsuario            user = new EUsuario();
        ClientScriptManager cm   = this.ClientScript;

        if (Tipo.SelectedValue == "1")
        {
            if (int.Parse(eps.SelectedItem.Value.ToString()) == 0)
            {
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Seleccione una EPS')</script>;");
            }
            else
            {
                if (TB_pasword.Text == TB_password2.Text)
                {
                    user.Apellido        = TB_lastName.Text.ToString();
                    user.Correo          = TB_email.Text.ToString();
                    user.Identificacion  = TB_id.Text.ToString();
                    user.Nombre          = TB_name.Text.ToString();
                    user.Password        = TB_pasword.Text.ToString();
                    user.Tipo_afiliacion = int.Parse(Tipo.SelectedValue);
                    user.Tipo_id         = int.Parse(DropDownList1.SelectedValue);
                    user.Fecha           = TB_date.Text.ToString();
                    user.IdEps           = int.Parse(eps.SelectedItem.Value.ToString());
                    DBUsuario bd = new DBUsuario();
                    DataTable error;
                    error = bd.CrearUsuario(user);
                    if (error.Rows.Count == 0)
                    {
                        cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Se Ha Creado Usuario Exitosamente');</script>");
                        Response.Redirect("PaginaPrincipal.aspx");
                    }
                    else if (error.Rows[0]["error"].ToString() == "error")
                    {
                        //fallo
                        cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('El correo ingresado ya existe');</script>");
                    }
                    else
                    {
                        cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Se Ha Creado Usuario Exitosamente');</script>");
                        Response.Redirect("PaginaPrincipal.aspx");
                    }
                }
                else
                {
                    //ESTA MAL LA CLAVE
                    cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Las Contraseñas Dadas No Coinciden');</script>");
                }
            }
        }
        else if (TB_pasword.Text == TB_password2.Text)
        {
            user.Apellido        = TB_lastName.Text.ToString();
            user.Correo          = TB_email.Text.ToString();
            user.Identificacion  = TB_id.Text.ToString();
            user.Nombre          = TB_name.Text.ToString();
            user.Password        = TB_pasword.Text.ToString();
            user.Tipo_afiliacion = int.Parse(Tipo.SelectedValue);
            user.Tipo_id         = int.Parse(DropDownList1.SelectedValue);
            user.Fecha           = TB_date.Text.ToString();
            user.IdEps           = int.Parse(eps.SelectedItem.Value.ToString());
            DBUsuario bd = new DBUsuario();
            DataTable error;
            error = bd.CrearUsuario(user);
            if (error.Rows.Count == 0)
            {
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Se Ha Creado Usuario Exitosamente');</script>");
                Response.Redirect("PaginaPrincipal.aspx");
            }
            else if (error.Rows[0]["error"].ToString() == "error")
            {
                //fallo
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('El correo ingresado ya existe');</script>");
            }
            else
            {
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Se Ha Creado Usuario Exitosamente');</script>");
                Response.Redirect("PaginaPrincipal.aspx");
            }
        }
        else
        {
            //ESTA MAL LA CLAVE
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Las Contraseñas Dadas No Coinciden');</script>");
        }
    }
コード例 #29
0
    protected void btnSave_Click(object sender, System.EventArgs e)
    {
        byte SysMessageTypeId = 0;
        int  SysMessageId     = 0;

        System.Int32     EditId;
        PriceListDetails m_PriceListDetails = new PriceListDetails();

        if (Request.QueryString["id"] == null)
        {
            EditId = 0;
        }
        else
        {
            EditId = System.Int32.Parse(Request.QueryString["id"].ToString());
            m_PriceListDetails.PriceListDetailId = EditId;
            m_PriceListDetails = m_PriceListDetails.Get();
        }
        try
        {
            if (txPriceListId.Text == "")
            {
                JSAlertHelpers.Alert("Mời bạn nhập các thông tin bắt buộc!", this);
                return;
            }
            if (txProductId.Text == "")
            {
                JSAlertHelpers.Alert("Mời bạn nhập các thông tin bắt buộc!", this);
                return;
            }


            m_PriceListDetails.CrUserId = ActUserId;

            m_PriceListDetails.PriceListId = int.Parse(txPriceListId.Text);

            m_PriceListDetails.ProductId = int.Parse(txProductId.Text);

            m_PriceListDetails.UnitId = short.Parse(txUnitId.Text);

            if (txPrice.Text != "")
            {
                m_PriceListDetails.Price = txPrice.Text;
            }

            m_PriceListDetails.PriceListDetailId = EditId;
            SysMessageTypeId = m_PriceListDetails.InsertOrUpdate(ConstantHelpers.Replicated, ActUserId, ref SysMessageId);

            StringBuilder       csText = new StringBuilder();
            Type                cstype = this.GetType();
            ClientScriptManager cs     = Page.ClientScript;
            csText.Clear();
            csText.Append("<script type=\"text/javascript\">");
            csText.Append("window.parent.jQuery('#divEdit').dialog('close');");
            csText.Append("</script>");
            cs = Page.ClientScript;
            cs.RegisterClientScriptBlock(this.GetType(), "system_message", csText.ToString());
        }
        catch (Exception ex)
        {
            sms.utils.LogFiles.LogError(((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name + "\t" + ex.ToString());
            JSAlertHelpers.Alert(ex.Message, this);
        }
    }
コード例 #30
0
        protected void B_ActualizarIndicador_Click(object sender, EventArgs e)
        {
            selectIndex = DD_TiempoProyeccion.SelectedValue;
            llenarEvaluacionIndicadorFinancieroProyecto();

            for (int i = 0; i < EvaluacionIndicadorFinancieroProyecto.Rows.Count; i++)
            {
                for (int k = 1; k <= Int32.Parse(selectIndex) + 1; k++)
                {
                    String objetoTextBox;
                    objetoTextBox = "TB_EvaluacionIndicadorFinancieroProyecto" + EvaluacionIndicadorFinancieroProyecto.Rows[i]["Id_EvaluacionIndicadorFinancieroProyecto"].ToString() + k;

                    TextBox controlSupuesto = (TextBox)this.FindControl(objetoTextBox);

                    try
                    {
                        decimal numero = decimal.Parse(controlSupuesto.Text);
                    }
                    catch (Exception ex)
                    {
                        if (ex is FormatException)
                        {
                            ClientScriptManager cm = this.ClientScript;
                            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Formato numérico no válido ( " + controlSupuesto.Text + ")');</script>");
                            return;
                        }
                        else
                        {
                            ClientScriptManager cm = this.ClientScript;
                            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Error desconocido.');</script>");
                            return;
                        }
                    }

                    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString());
                    SqlCommand    cmd;

                    int preiodoValor;
                    if (k == (Int32.Parse(selectIndex) + 1))
                    {
                        cmd          = new SqlCommand("SELECT [Valor] FROM [EvaluacionIndicadorFinancieroValor]  WHERE [CodEvaluacionIndicadorFinancieroProyecto] = " + EvaluacionIndicadorFinancieroProyecto.Rows[i]["Id_EvaluacionIndicadorFinancieroProyecto"].ToString() + " AND Periodo = 0", conn);
                        preiodoValor = 0;
                    }
                    else
                    {
                        cmd          = new SqlCommand("SELECT [Valor] FROM [EvaluacionIndicadorFinancieroValor]  WHERE [CodEvaluacionIndicadorFinancieroProyecto] = " + EvaluacionIndicadorFinancieroProyecto.Rows[i]["Id_EvaluacionIndicadorFinancieroProyecto"].ToString() + " AND Periodo = " + k, conn);
                        preiodoValor = k;
                    }

                    try
                    {
                        String sql;
                        conn.Open();
                        SqlDataReader reader = cmd.ExecuteReader();

                        if (reader.Read())
                        {
                            sql = "UPDATE [EvaluacionIndicadorFinancieroValor] SET [Valor] = " + controlSupuesto.Text + " WHERE [CodEvaluacionIndicadorFinancieroProyecto] = " + EvaluacionIndicadorFinancieroProyecto.Rows[i]["Id_EvaluacionIndicadorFinancieroProyecto"].ToString() + " AND [Periodo] = " + preiodoValor;
                        }
                        else
                        {
                            sql = "INSERT INTO [EvaluacionIndicadorFinancieroValor] ([CodEvaluacionIndicadorFinancieroProyecto], [Periodo], [Valor]) VALUES (" + EvaluacionIndicadorFinancieroProyecto.Rows[i]["Id_EvaluacionIndicadorFinancieroProyecto"].ToString() + ", " + preiodoValor + ", " + controlSupuesto.Text + ")";
                        }

                        reader.Close();
                        //conn.Close();


                        ejecutaReader(sql, 2);
                    }
                    catch (SqlException) { }
                    finally
                    {
                        conn.Close();
                        conn.Dispose();
                    }
                }
            }

            prActualizarTabEval(CodigoTab.ToString(), CodigoProyecto.ToString(), CodigoConvocatoria.ToString());
            ObtenerDatosUltimaActualizacion();
        }