protected void Page_Load(object Sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["ce"] != null) { Utils.MostrarAlerta(Response, "La solicitud No. " + Request.QueryString["ce"] + " ha sido cerrdada correctamente."); } Session.Clear(); Cargar_dtSols(); string nitUser = DBFunctions.SingleData("SELECT ttipe_codigo FROM dbxschema.susuario WHERE susu_login='******';"); DataSet nitEmpresa = new DataSet(); string consultaDDL = ""; DBFunctions.Request(nitEmpresa, IncludeSchema.NO, "select mnit_nitcli from mcontacto where mnit_nitcon= (SELECT MNIT_NIT FROM dbxschema.susuario WHERE susu_login='******' fetch first row only)"); if (nitEmpresa.Tables[0].Rows.Count > 0) { consultaDDL += " AND ("; for (int g = 0; g < nitEmpresa.Tables[0].Rows.Count; g++) { consultaDDL += " MCLI.mnit_nit =" + nitEmpresa.Tables[0].Rows[g][0].ToString() + " OR"; } consultaDDL += "@"; consultaDDL = consultaDDL.Replace("OR@", ""); consultaDDL += ") "; } filtroEmpresa.Visible = true; DatasToControls bind = new DatasToControls(); ViewState["roluser"] = nitUser; if (nitUser == "AS") { bind.PutDatasIntoDropDownList(ddlEmpresa, @"select MNIT.mnit_nit, MCLI.mcli_marcas FROM dbxschema.mnit MNIT, dbxschema.MCLIENTESAC MCLI WHERE MNIT.mnit_nit=MCLI.mnit_nit AND MCLI.TVIG_CODIGO='V' ORder by 2;"); } else { bind.PutDatasIntoDropDownList(ddlEmpresa, @"select MNIT.mnit_nit, MCLI.mcli_marcas FROM dbxschema.mnit MNIT, dbxschema.MCLIENTESAC MCLI WHERE MNIT.mnit_nit=MCLI.mnit_nit AND MCLI.TVIG_CODIGO='V' " + consultaDDL + " Order by 2"); } ddlEmpresa.Items.Insert(0, "Ver Todas..."); if (ViewState["solicitudes"] == null) { Llenar_dtSols(0); dgSols_DataBind(); } else { ViewState.Remove("solicitudes"); } } else { if (Session["dtSols"] != null) { dtSols = (DataTable)Session["dtSols"]; } } }
protected void btnNext_Click(object sender, EventArgs e) { Dal.Models.UserInfo user = (Dal.Models.UserInfo)Session["UserInfo"]; // 创建申报项目 Dal.Models.Declaration decl = null; bool bChanged = false; string strTemplateCode = ""; DateTime dtm; if (!DateTime.TryParse(txtDeclarateDate.Text, out dtm)) { hdMsg.Value = "项目申报时间格式错误!"; return; } int iPrizeID = Convert.ToInt32(Request["rdlPrize"]); if (iPrizeID == 0 && rdlPrize.SelectedValue != "") { iPrizeID = Convert.ToInt32(rdlPrize.SelectedValue); } if (iPrizeID == 0) { hdMsg.Value = "请选择奖项!"; return; } OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); string strActivityType = Request.Cookies["ActivityType"].Value; Dal.Models.Activity actActivated = BLL.Activity.GetActivity(strActivityType, conn); string strDeclarationCode = ""; if (ViewState["DeclarationID"] != null) { decl = BLL.Declaration.GetDeclaration(Convert.ToInt32(ViewState["DeclarationID"]), conn); strDeclarationCode = decl.DeclarationCode; } else { decl = new Dal.Models.Declaration(); decl.UserID = user.UserID; decl.ActivityID = actActivated.ActivityID; } if (decl.DeclareDate == null || decl.DeclareDate.Value != dtm) { bChanged = true; decl.DeclareDate = dtm; } if (string.IsNullOrEmpty(decl.RecommendFrom) || decl.RecommendFrom != ChooseAssociation.SelectedValue) { bChanged = true; decl.RecommendFrom = ChooseAssociation.SelectedValue; } if (decl.PrizeID == null || decl.PrizeID != iPrizeID) { bChanged = true; decl.PrizeID = iPrizeID; } if (string.IsNullOrEmpty(decl.DeclarationName) || decl.DeclarationName != txtProjectName.Text.Trim()) { bChanged = true; decl.DeclarationName = txtProjectName.Text.Trim(); } Dal.Models.Prize prize = BLL.Prize.GetPrize(decl.PrizeID.Value, conn); strTemplateCode = prize.TemplateCode; int iSpecilID = prize.SpecialtyID.Value; int actID = prize.ActivityID.Value; Dal.Models.Schedule dSchedule = BLL.Schedule.GetSpecialtySchedule(iSpecilID, conn); if (dSchedule == null || !dSchedule.IsDeclarationStart.Value) { hdMsg.Value = "未在专业申报时间内,不能创建!"; conn.Close(); return; } string strSituation = ""; if (!string.IsNullOrEmpty(Request["Situation"])) { strSituation = Request["Situation"].Replace("'", "").Replace("\"", ""); } if (bChanged == true && (strSituation == Dal.Models.EnumSituation.Declaration.ToString() || strSituation == "")) { OleDbTransaction trans = conn.BeginTransaction(); try { BLL.Declaration.Declarate(ref decl, conn, trans); string strImportDeclarationID = ImportDeclarationData.SelectedValue; if (strImportDeclarationID != "0" && strImportDeclarationID != "") { string strDeclarationCode2 = BLL.Declaration.GetDeclaration(Convert.ToInt32(strImportDeclarationID), conn, trans).DeclarationCode; BLL.Declaration.ImportDeclarate(decl.DeclarationID.Value, Convert.ToInt32(strImportDeclarationID), conn, trans); BLL.Declaration.ImportUploadFile(decl.DeclarationID.Value, Convert.ToInt32(strImportDeclarationID), decl.DeclarationCode, strDeclarationCode2, conn, trans); } trans.Commit(); ViewState["DeclarationID"] = decl.DeclarationID.Value; } catch (Exception ex) { ViewState.Remove("DeclarationID"); trans.Rollback(); hdMsg.Value = ex.Message; return; } } // 获取申报项目的模板首页 string strPartCode = strTemplateCode.Substring(2, 2) + "01"; // 根据首页获取模板 TempInfo = BLL.Declaration.GetTemplateInfo(strPartCode, conn); TempInfo.DeclarationID = (int)ViewState["DeclarationID"]; TempInfo.DeclarationCode = strDeclarationCode; if (!string.IsNullOrEmpty(strSituation)) { TempInfo.Situation = (Dal.Models.EnumSituation)Enum.Parse(typeof(Dal.Models.EnumSituation), strSituation, true); } else { TempInfo.Situation = (Dal.Models.EnumSituation)Enum.Parse(typeof(Dal.Models.EnumSituation), "Declara", true); } conn.Close(); if (TempInfo != null) { Session.Add("TemplateInfo", TempInfo); // 跳转到模板页 if (strSituation == "ExpertReview" || strSituation == "Delete" || strSituation == "Auditing") { Server.Transfer(TempInfo.NewTemplateUrl); } else { Server.Transfer(TempInfo.TemplateUrl); } } }
protected void btnSave_Click(object sender, EventArgs e) { try { if (btnDelete.Enabled == false) { List <Factory> listFac = new List <Factory>(); listFac = Factory.GetAll().Where(l => l.Name.Trim().ToLower() == txtName.Text.Trim().ToLower()).ToList(); if (listFac.Count > 0) { RegisterStartupScript("alert(\"" + GetJSMessage(GetResource("Title_Error"), string.Format(GetResource("CheckName"), lblFactoryName.Text)) + "\");"); return; } Factory fac = new Factory(); fac.No = txtNo.Text; fac.CompanyId = int.Parse(GetCompany()); fac.Name = txtName.Text; fac.isDeleted = false; //fac.ImageFile = txtImgName.Text; fac.CreateAccount = fac.ModifiedAccount = this.User.Identity.Name; int id = Factory.InsertWithIndentity(fac); fac.ImageFile = id.ToString() + ".png"; fac.Update(); string pathNew = Constant.PORTAL + GetCompanyPath() + string.Format(Constant.PATH_FACTORY, id, txtName.Text); if (!Directory.Exists(Server.MapPath(pathNew))) //(!Directory.Exists(Server.MapPath("~/Portal\\Images\\Factory\\"))) { Directory.CreateDirectory(Server.MapPath(pathNew)); //("~/Portal\\Images\\Factory\\)")); } string path = Server.MapPath(pathNew); //"~/Portal\\Images\\Factory\\"); //string filename = imgFactory.ImageUrl; string base64 = (string)ViewState["img"]; byte[] b = Convert.FromBase64String(base64); System.IO.File.WriteAllBytes(path + "/" + id + ".png", b); } else { Factory fac = new Factory(); fac.FactoryId = int.Parse(hiddenFacID.Value); fac.CompanyId = int.Parse(GetCompany()); fac = fac.GetByPrimaryKey(); if (fac.Name.Trim() != txtName.Text.Trim()) { List <Factory> listFac = new List <Factory>(); listFac = Factory.GetAll().Where(l => l.Name.Trim().ToLower() == txtName.Text.Trim().ToLower()).ToList(); if (listFac.Count > 0) { RegisterStartupScript("alert(\"" + GetJSMessage(GetResource("Title_Error"), string.Format(GetResource("CheckName"), lblFactoryName.Text)) + "\");"); return; } } fac.ModifiedAccount = this.User.Identity.Name; fac.No = txtNo.Text; fac.Name = txtName.Text; fac.ImageFile = hiddenFacID.Value.ToString() + ".png"; fac.Update(); string pathNew = Constant.PORTAL + GetCompanyPath() + string.Format(Constant.PATH_FACTORY, hiddenFacID.Value, txtName.Text); if (!Directory.Exists(Server.MapPath(pathNew))) //("~/Portal\\Images\\Factory\\"))) { Directory.CreateDirectory(Server.MapPath(pathNew)); //("~/Portal\\Images\\Factory\\)")); } string path = Server.MapPath(pathNew); //("~/Portal\\Images\\Factory\\"); if (ViewState["img"] != null) { string base64 = (string)ViewState["img"]; byte[] b = Convert.FromBase64String(base64); System.IO.File.WriteAllBytes(path + "/" + int.Parse(hiddenFacID.Value) + ".png", b); } } ViewState.Remove("img"); panelEdit.Visible = false; panelMain.Visible = true; Search(); } catch (Exception ex) { RegisterStartupScript("alert(\"" + GetJSMessage(GetResource("Title_Error"), ex.Message) + "\");"); logger.Error("Erorr btnSave_click", ex); } }
/// <summary> /// Removes all import related info stored in the ViewState. /// </summary> private void ClearImportViewState() { ViewState.Remove("MediaFilePaths"); ViewState.Remove("MediaFilesNumber"); ViewState.Remove("MediaCurrFileIndex"); }
public override void Reset() { base.Reset(); if (CheckStyle(StyleKey.OuterBorderBackColor)) { ViewState.Remove("OuterBorderBackColor"); } if (CheckStyle(StyleKey.PaddingBottom)) { ViewState.Remove("PaddingBottom"); } if (CheckStyle(StyleKey.PaddingLeft)) { ViewState.Remove("PaddingLeft"); } if (CheckStyle(StyleKey.PaddingRight)) { ViewState.Remove("PaddingRight"); } if (CheckStyle(StyleKey.PaddingTop)) { ViewState.Remove("PaddingTop"); } if (CheckStyle(StyleKey.MarginBottom)) { ViewState.Remove("MarginBottom"); } if (CheckStyle(StyleKey.MarginLeft)) { ViewState.Remove("MarginLeft"); } if (CheckStyle(StyleKey.MarginRight)) { ViewState.Remove("MarginRight"); } if (CheckStyle(StyleKey.MarginTop)) { ViewState.Remove("MarginTop"); } if (CheckStyle(StyleKey.OuterBorderBottomImageUrl)) { ViewState.Remove("OuterBorderBottomImageUrl"); } if (CheckStyle(StyleKey.OuterBorderBottomWidth)) { ViewState.Remove("OuterBorderBackColor"); } if (CheckStyle(StyleKey.OuterBorderLeftBottomCornerImageUrl)) { ViewState.Remove("OuterBorderLeftBottomCornerImageUrl"); } if (CheckStyle(StyleKey.OuterBorderLeftImageUrl)) { ViewState.Remove("OuterBorderLeftImageUrl"); } if (CheckStyle(StyleKey.OuterBorderLeftTopCornerImageUrl)) { ViewState.Remove("OuterBorderLeftTopCornerImageUrl"); } if (CheckStyle(StyleKey.OuterBorderLeftWidth)) { ViewState.Remove("OuterBorderLeftWidth"); } if (CheckStyle(StyleKey.OuterBorderRightBottomCornerImageUrl)) { ViewState.Remove("OuterBorderRightBottomCornerImageUrl"); } if (CheckStyle(StyleKey.OuterBorderRightImageUrl)) { ViewState.Remove("OuterBorderRightImageUrl"); } if (CheckStyle(StyleKey.OuterBorderRightTopCornerImageUrl)) { ViewState.Remove("OuterBorderRightTopCornerImageUrl"); } if (CheckStyle(StyleKey.OuterBorderRightWidth)) { ViewState.Remove("OuterBorderRightWidth"); } if (CheckStyle(StyleKey.OuterBorderStyle)) { ViewState.Remove("OuterBorderStyle"); } if (CheckStyle(StyleKey.OuterBorderTopImageUrl)) { ViewState.Remove("OuterBorderTopImageUrl"); } if (CheckStyle(StyleKey.OuterBorderTopWidth)) { ViewState.Remove("OuterBorderTopWidth"); } styles = 0; }
protected void Page_PreRender(object sender, EventArgs e) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; Classes.cUser Demography = null; Classes.cPlayer PLDemography = null; Demography = new Classes.cUser(_UserName, "Password"); PLDemography = new Classes.cPlayer(_UserID, _UserName); if (!IsPostBack) { lblMessage.Text = string.Empty; Session["ActiveLeftNav"] = "Demographics"; string gen = PLDemography.GenderStandared.ToUpper(); string othergen = PLDemography.GenderOther; string pict = PLDemography.UserPhoto; if (PLDemography.HasPicture) { imgPlayerImage.ImageUrl = PLDemography.Picture.PictureURL; ViewState["UserIDPicture"] = PLDemography.Picture.PictureID; } else { if (PLDemography.UserPhoto.Length > 0) { imgPlayerImage.ImageUrl = PLDemography.UserPhoto; ViewState.Remove("UserIDPicture"); } else { imgPlayerImage.ImageUrl = "http://placehold.it/150x150"; ViewState.Remove("UserIDPicture"); } } string emergencyContactPhone = string.Empty; if (PLDemography.EmergencyContactPhone != null) { emergencyContactPhone = PLDemography.EmergencyContactPhone; Int32 iPhone; if (Int32.TryParse(emergencyContactPhone.Replace("(", "").Replace(")", "").Replace("-", ""), out iPhone)) { emergencyContactPhone = iPhone.ToString("(###)###-####"); } } tbFirstName.Text = Demography.FirstName; if (Demography.MiddleName.Length > 1) { tbMiddleInit.Text = Demography.MiddleName.Substring(0, 1); } else { tbMiddleInit.Text = ""; } tbLastName.Text = Demography.LastName; tbGenderOther.Style.Add("visibility", "hidden"); tbGenderOther.Text = othergen; if (gen.Length > 0) { if ("MFO".Contains(gen)) { ddlGender.SelectedValue = gen; } if (gen == "O") { tbGenderOther.Style.Add("visibility", "visible"); } } tbDOB.Text = PLDemography.DateOfBirth.ToString("MM/dd/yyyy"); tbEmergencyName.Text = PLDemography.EmergencyContactName; tbEmergencyPhone.Text = emergencyContactPhone; tbUserName.Text = _UserName; tbNickName.Text = Demography.NickName; tbPenName.Text = PLDemography.AuthorName; tbForumName.Text = Demography.ForumUserName; // Session["dem_Addresses"] = Demography.UserAddresses; // Session["dem_Phones"] = Demography.UserPhones; // Session["dem_Emails"] = Demography.UserEmails; // BindAddresses(); // BindPhoneNumbers(); // BindEmails(); ddlGender.Attributes.Add("onchange", "DisplaySexOther(this);"); } lblErrorMessage1.Text = ""; lblErrorMessage2.Text = ""; btnSave1.Enabled = true; btnSave2.Enabled = true; // Now we check to make sure that there is a least a single record and that it's valid. //List<cAddress> AllAddresses = Session["dem_Addresses"] as List<cAddress>; //int iBadAddresses = AllAddresses.Count(x => !x.IsValid()); //List<cEMail> AllEmail = Session["dem_Emails"] as List<cEMail>; //int iBadEmail = AllEmail.Count(x => !x.IsValid()); //List<cPhone> AllPhone = Session["dem_Phones"] as List<cPhone>; //int iBadPhone = AllPhone.Count(x => !x.IsValid()); hidNumOfPhones.Value = Demography.UserPhones.Count.ToString(); gvPhoneNumbers.DataSource = Demography.UserPhones; gvPhoneNumbers.DataBind(); hidNumOfEMails.Value = Demography.UserEmails.Count.ToString(); gvEmails.DataSource = Demography.UserEmails; gvEmails.DataBind(); hidNumOfAddresses.Value = Demography.UserAddresses.Count.ToString(); gvAddresses.DataSource = Demography.UserAddresses; gvAddresses.DataBind(); if ( //(iBadAddresses > 0) || //(iBadEmail > 0) || //(iBadPhone > 0) || (gvEmails.Rows.Count == 0)) { //if (iBadAddresses > 0) // lblErrorMessage1.Text = "* At least one of your addresses is not valid. "; if (gvEmails.Rows.Count == 0) { lblErrorMessage1.Text += "* You must have at least one valid email address. "; } //if (iBadEmail > 0) // lblErrorMessage1.Text += "* At least one of your email addresses is not valid. "; //if (iBadPhone > 0) // lblErrorMessage1.Text += "* At least one of your phone numbers is not valid. "; lblErrorMessage1.Text = lblErrorMessage1.Text.Trim(); btnSave1.Enabled = false; } lblErrorMessage2.Text = lblErrorMessage1.Text; btnSave2.Enabled = btnSave1.Enabled; }
protected void Page_Load(object sender, EventArgs e) { CheckWebAnalyticsUI("DataManagement"); // Master template title, image and context help CurrentMaster.Title.TitleText = GetString("analytics_codename.datamanagement"); CurrentMaster.Title.TitleImage = GetImageUrl("CMSModules/CMS_WebAnalytics/Details/datamanagement.png"); CurrentMaster.Title.HelpTopicName = "analytdatamanagement"; // Grouping text pnlRemoveData.GroupingText = GetString("analyt.settings.deletedata"); pnlGenerateData.GroupingText = GetString("analyt.settings.generate"); // Display disabled information if (!AnalyticsHelper.AnalyticsEnabled(CMSContext.CurrentSiteName)) { this.pnlDisabled.Visible = true; this.lblDisabled.Text = ResHelper.GetString("WebAnalytics.Disabled"); EnableControls(false); return; } // Initialize controls Initialize(); // Check whether generator is running and if so than disable controls and display appropriate message if (StatisticsInfoProvider.DataGeneratorIsRunning) { timeRefresh.Enabled = true; ViewState["GeneratorStarted"] = true; EnableControls(false); ReloadInfoPanel(); } else if (StatisticsInfoProvider.DataDeleterIsRunning) { timeRefresh.Enabled = true; ViewState["DeleterStarted"] = true; EnableControls(false); ReloadInfoPanel(); } else { // If generator has just end, display OK message and disable timer if (ValidationHelper.GetBoolean(ViewState["GeneratorStarted"], false)) { ViewState.Remove("GeneratorStarted"); // Fill objects to delete FillObjectsToDelete(); // Display info message lblInfo.Visible = true; lblInfo.Text = GetString("anal.settings.datagenerated"); // Disable timer timeRefresh.Enabled = false; } // If data deleter has just end if (ValidationHelper.GetBoolean(ViewState["DeleterStarted"], false)) { ViewState.Remove("DeleterStarted"); FillObjectsToDelete(); FillStatisticsBoundaries(); lblInfo.Visible = true; lblInfo.Text = GetString("analyt.settings.datadeleted"); // Disable timer timeRefresh.Enabled = false; } EnableControls(true); } FillStatisticsBoundaries(); }
//protected void gvPELList_RowCommand(object sender, GridViewCommandEventArgs e) //{ // string sRegistrationID = e.CommandArgument.ToString(); // if (e.CommandName.ToUpper() == "ADDENDUM") // Response.Redirect("PELAddAddendum.aspx?RegistrationID=" + sRegistrationID, true); // else // Response.Redirect("PELEdit.aspx?RegistrationID=" + sRegistrationID, true); //} protected void ddlMissedEvents_SelectedIndexChanged(object sender, EventArgs e) { SortedList sParams = new SortedList(); sParams.Add("@EventID", ddlMissedEvents.SelectedValue); sParams.Add("@UserID", Master.UserID); DataSet dsEventInfo = Classes.cUtilities.LoadDataSet("uspGetEventInfo", sParams, "LARPortal", Master.UserName, "EventRegistration.gvEvents_RowCommand"); dsEventInfo.Tables[0].TableName = "EventInfo"; dsEventInfo.Tables[1].TableName = "Housing"; dsEventInfo.Tables[2].TableName = "PaymentType"; if (dsEventInfo.Tables.Count >= 5) { dsEventInfo.Tables[3].TableName = "Character"; dsEventInfo.Tables[4].TableName = "Teams"; dsEventInfo.Tables[5].TableName = "Registration"; dsEventInfo.Tables[6].TableName = "RolesForEvent"; dsEventInfo.Tables[7].TableName = "RegistrationStatuses"; dsEventInfo.Tables[8].TableName = "Meals"; dsEventInfo.Tables[9].TableName = "PlayerInfo"; dsEventInfo.Tables[10].TableName = "CampaignPELs"; dsEventInfo.Tables[11].TableName = "EventPELs"; dsEventInfo.Tables[12].TableName = "AllCharactersForUser"; } foreach (DataRow dRow in dsEventInfo.Tables["EventInfo"].Rows) { DateTime dtStartDate; DateTime dtEndDate; if ((DateTime.TryParse(dRow["StartDate"].ToString(), out dtStartDate)) && (DateTime.TryParse(dRow["EndDate"].ToString(), out dtEndDate))) { ViewState["EventStartDate"] = dtStartDate.ToShortDateString(); ViewState["EventEndDate"] = dtEndDate.ToShortDateString(); ViewState["EventStartTime"] = dRow["StartTime"].ToString(); ViewState["EventEndTime"] = dRow["EndTime"].ToString(); } else { ViewState.Remove("EventStartDate"); ViewState.Remove("EventEndDate"); ViewState.Remove("EventStartTime"); ViewState.Remove("EventEndTime"); } } if (dsEventInfo.Tables["AllCharactersForUser"].Rows.Count > 0) // if (dsEventInfo.Tables["Character"].Rows.Count > 0) { ddlCharacterList.DataSource = dsEventInfo.Tables["AllCharactersForUser"]; //["Character"]; ddlCharacterList.DataTextField = "CharacterAKA"; ddlCharacterList.DataValueField = "CharacterID"; ddlCharacterList.DataBind(); ddlCharacterList.SelectedIndex = 0; ddlCharacterList.Visible = true; lblCharacter.Visible = false; hidSkillSetID.Value = ""; } if (dsEventInfo.Tables["AllCharactersForUser"].Rows.Count == 1) // if (dsEventInfo.Tables["Character"].Rows.Count == 1) { ddlCharacterList.Visible = false; lblCharacter.Visible = true; lblCharacter.Text = ddlCharacterList.Items[0].Text; hidSkillSetID.Value = dsEventInfo.Tables["AllCharactersForUser"].Rows[0]["CharacterSkillSetID"].ToString(); } DataView dvJustRoleNames = new DataView(dsEventInfo.Tables["RolesForEvent"], "", "", DataViewRowState.CurrentRows); DataTable dtJustRoleNames = dvJustRoleNames.ToTable(true, "RoleAlignmentID", "Description"); ddlRoles.DataSource = dtJustRoleNames; ddlRoles.DataTextField = "Description"; ddlRoles.DataValueField = "RoleAlignmentID"; ddlRoles.DataBind(); if (dtJustRoleNames.Rows.Count == 1) { ddlRoles.Visible = false; lblRole.Text = ddlRoles.Items[0].Text; lblRole.Visible = true; } else { if (dtJustRoleNames.Rows.Count > 1) { lblRole.Visible = false; ddlRoles.Visible = true; ddlRoles.Items[0].Selected = true; } } ddlSendToCampaign.ClearSelection(); foreach (DataRow dCharInfo in dsEventInfo.Tables["AllCharactersForUser"].Rows) { lblCharacter.Text = dCharInfo["CharacterAKA"].ToString().Trim(); } if (IsPostBack) { ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openRegistration();", true); } }
protected void Clear_Click(object sender, EventArgs e) { this.Display.Text = ""; ViewState.Remove("currentNumber"); ViewState.Remove("currentOperator"); }
private void exitByError(string strError) { ViewState.Remove("bomDetailKey"); Navigator.goToPage("~/Error.aspx", "ERROR:" + strError); }
//Traer Vehiculos disponibles para los pedidos protected bool CargarVehiculos() { //Tabla de detalles de pedido DataTable dtPedidosD = Preparar_Tabla_Pedido(); //Tabla de pedidos activos del cliente DataTable dtPedidosM = (DataTable)Session["TABLA_MPEDIDOS"]; //Tabla de vehiculos disponbles DataTable dtVehiculos; DataSet dsPedidosD, dsVehiculos = new DataSet(); bool encontrado = false; int nPed = 0; string sqlP, filtroCatalogos = ""; string noPed1 = "", prfPed1 = ""; //Pedidos seleccionados ArrayList arlPedidos = new ArrayList(); //Consultar detalles de los pedidos seleccionados foreach (DataGridItem dgiPed in dgPedidos.Items) { if (dgiPed.ItemType == ListItemType.Item || dgiPed.ItemType == ListItemType.AlternatingItem) { if (((CheckBox)dgiPed.FindControl("chkFactPed")).Checked) { //Verificar autorizacion if (!DBFunctions.SingleData( "SELECT MPED_AUTORIZA FROM MPEDIDOCLIENTEAUTORIZACION " + "WHERE PDOC_CODIGO='" + dtPedidosM.Rows[nPed]["PDOC_CODIGO"].ToString() + "' AND " + "MPED_NUMEPEDI=" + dtPedidosM.Rows[nPed]["MPED_NUMEPEDI"].ToString() + ";" ).Equals("S")) { return(false); } dtPedidosM.Rows[nPed]["USADO"] = 1; //Traer Detalles Pedidos seleccionados sqlP = "SELECT PDOC_CODIGO,MPED_NUMEPEDI,PCAT_CODIGO," + "PCP.PCOL_DESCRIPCION AS PCOL_NOMBRE,PCA.PCOL_DESCRIPCION AS PCOL_NOMBREALTE," + "PCP.PCOL_CODRGB AS PCOL_CODRGB,PCA.PCOL_CODRGB AS PCOL_CODRGBALTE," + "PCP.PCOL_CODIGO AS PCOL_CODIGO, PCA.PCOL_CODIGO AS PCOL_CODIGOALTE," + "DPED_CANTPEDI, DPED_CANTINGR, DPED_VALOUNIT, DPED_FECHALLEGADA, DPED_CANTFACT, " + "DPED_VALOFACT, DPED_CANTPEDI-DPED_CANTFACT AS DPED_CANTFALTA " + "FROM DPEDIDOVEHICULOCLIENTEMAYOR DP, PCOLOR PCP, PCOLOR PCA " + "WHERE PCP.PCOL_CODIGO=DP.PCOL_CODIGO AND PCA.PCOL_CODIGO=DP.PCOL_CODIGOALTE AND " + "PDOC_CODIGO='" + dtPedidosM.Rows[nPed]["PDOC_CODIGO"].ToString() + "' AND " + "MPED_NUMEPEDI=" + dtPedidosM.Rows[nPed]["MPED_NUMEPEDI"].ToString(); dsPedidosD = new DataSet(); DBFunctions.Request(dsPedidosD, IncludeSchema.NO, sqlP); for (int nPedD = 0; nPedD < dsPedidosD.Tables[0].Rows.Count; nPedD++) { DataRow drPed = dtPedidosD.NewRow(); filtroCatalogos += " MC.PCAT_CODIGO='" + dsPedidosD.Tables[0].Rows[nPedD]["PCAT_CODIGO"] + "' OR"; drPed["PDOC_CODIGO"] = dsPedidosD.Tables[0].Rows[nPedD]["PDOC_CODIGO"]; drPed["MPED_NUMEPEDI"] = dsPedidosD.Tables[0].Rows[nPedD]["MPED_NUMEPEDI"]; drPed["PCAT_CODIGO"] = dsPedidosD.Tables[0].Rows[nPedD]["PCAT_CODIGO"]; drPed["PCOL_CODIGO"] = dsPedidosD.Tables[0].Rows[nPedD]["PCOL_CODIGO"]; drPed["PCOL_NOMBRE"] = dsPedidosD.Tables[0].Rows[nPedD]["PCOL_NOMBRE"]; drPed["PCOL_CODIGOALTE"] = dsPedidosD.Tables[0].Rows[nPedD]["PCOL_CODIGOALTE"]; drPed["PCOL_NOMBREALTE"] = dsPedidosD.Tables[0].Rows[nPedD]["PCOL_NOMBREALTE"]; drPed["PCOL_CODRGB"] = dsPedidosD.Tables[0].Rows[nPedD]["PCOL_CODRGB"]; drPed["PCOL_CODRGBALTE"] = dsPedidosD.Tables[0].Rows[nPedD]["PCOL_CODRGBALTE"]; drPed["DPED_CANTPEDI"] = dsPedidosD.Tables[0].Rows[nPedD]["DPED_CANTPEDI"]; drPed["DPED_VALOUNIT"] = dsPedidosD.Tables[0].Rows[nPedD]["DPED_VALOUNIT"]; drPed["DPED_FECHALLEGADA"] = dsPedidosD.Tables[0].Rows[nPedD]["DPED_FECHALLEGADA"]; drPed["DPED_CANTFACT"] = dsPedidosD.Tables[0].Rows[nPedD]["DPED_CANTFACT"]; drPed["DPED_VALOFACT"] = dsPedidosD.Tables[0].Rows[nPedD]["DPED_VALOFACT"]; drPed["DPED_CANTFALTA"] = dsPedidosD.Tables[0].Rows[nPedD]["DPED_CANTFALTA"]; dtPedidosD.Rows.Add(drPed); encontrado = true; } if (!arlPedidos.Contains(dtPedidosM.Rows[nPed]["PEDIDO"].ToString())) { if (arlPedidos.Count == 0) { prfPed1 = dtPedidosM.Rows[nPed]["PDOC_CODIGO"].ToString(); noPed1 = dtPedidosM.Rows[nPed]["MPED_NUMEPEDI"].ToString(); } arlPedidos.Add(dtPedidosM.Rows[nPed]["PEDIDO"].ToString()); } } else { dtPedidosM.Rows[nPed]["USADO"] = 0; } nPed++; } } if (encontrado) { if (filtroCatalogos.EndsWith("OR")) { filtroCatalogos = filtroCatalogos.Substring(0, filtroCatalogos.Length - 3); } //TREAR VEHICULOS DISPONIBLES //datos pedido(0,1,2,3),datos vehiculo(...) string piva = (ViewState["NAC_CLIENTE"].ToString() == "E"?"0":"PV.PIVA_PORCIVA"); double desc = Convert.ToDouble(DBFunctions.SingleData("SELECT mcli_porcdesc FROM mcliente WHERE mnit_nit='" + nitCliente.Text + "';")); sqlP = "SELECT '" + prfPed1 + "' AS PDOC_CODIGO, " + noPed1 + " AS MPED_NUMEPEDI, '" + prfPed1 + "|" + noPed1 + "' AS MVEH_PEDIDO, " + "'' AS PCOL_CODRGBPEDI, '' AS PCOL_CODRGBPEDIALT, " + "MC.PCAT_CODIGO AS PCAT_CODIGO, MV.MCAT_VIN AS MCAT_VIN, MC.MCAT_MOTOR AS MCAT_MOTOR, PC.PCOL_DESCRIPCION PCOL_NOMBRE," + "PC.PCOL_CODIGO AS PCOL_CODIGO, PC.PCOL_CODRGB AS PCOL_CODRGBVEH, MC.MCAT_ANOMODE AS MCAT_ANOMODE, " + "days(CURRENT DATE)-days(MVEH_FECHRECE) AS MVEHI_DIAS, " + "0 AS USADO, PP.PPRE_PRECIO AS PRECIO, " + piva + " AS IVA, " + "ROUND((PP.PPRE_PRECIO-ROUND(PP.PPRE_PRECIO*mcli_porcdesc/100,0))*" + piva + "/100,0) AS PRECIO_IVA, " + "ROUND(PP.PPRE_PRECIO*mcli_porcdesc/100,0) AS DESCUENTO, " + "ROUND((PP.PPRE_PRECIO-ROUND(PP.PPRE_PRECIO*mcli_porcdesc/100,0))+((PP.PPRE_PRECIO-ROUND(PP.PPRE_PRECIO*mcli_porcdesc/100,0))*" + piva + "/100),0) AS TOTAL " + "FROM MCATALOGOVEHICULO MC, MVEHICULO MV, PCOLOR PC, PPRECIOVEHICULO PP, PCATALOGOVEHICULO PV, MCLIENTE ML " + "WHERE MC.MCAT_VIN=MV.MCAT_VIN AND PV.PCAT_CODIGO=MC.PCAT_CODIGO AND " + "(MV.TEST_TIPOESTA=20 OR MV.TEST_TIPOESTA=10) AND ML.MNIT_NIT='" + nitCliente.Text + "' AND " + "PP.PCAT_CODIGO=MC.PCAT_CODIGO AND " + "(" + filtroCatalogos + ") AND PC.PCOL_CODIGO=MC.PCOL_CODIGO ORDER BY MC.PCAT_CODIGO, MC.MCAT_MOTOR, MVEHI_DIAS DESC;"; DBFunctions.Request(dsVehiculos, IncludeSchema.NO, sqlP); //Seleccionar los de los pedidos y establecer info de los pedidos a los que corresponden //COLORES PRINCAIPAL; ALTERNATIVO string[] coloresT = { "PCOL_CODIGO", "PCOL_CODIGOALTE" }; DataRow[] drVehPed; int cP; for (int cCol = 0; cCol < 2; cCol++) { cP = 0; for (int nP = 0; nP < dtPedidosD.Rows.Count; nP++) { //No. vehiculos necesitados cP = Convert.ToInt16(dtPedidosD.Rows[nP]["DPED_CANTFALTA"]); if (cP > 0) { //Buscar vehiculos para el pedido drVehPed = dsVehiculos.Tables[0].Select( "PCAT_CODIGO='" + dtPedidosD.Rows[nP]["PCAT_CODIGO"] + "' AND " + "PCOL_CODIGO='" + dtPedidosD.Rows[nP][coloresT[cCol]] + "' AND " + "USADO=0"); if (drVehPed.Length > 0) { //No. Vehiculos disponibles int cV = drVehPed.Length; for (int nPV = 0; nPV < cP && nPV < cV; nPV++) { //usar vehiculo drVehPed[nPV]["USADO"] = 1; drVehPed[nPV]["PDOC_CODIGO"] = dtPedidosD.Rows[nP]["PDOC_CODIGO"]; drVehPed[nPV]["MPED_NUMEPEDI"] = dtPedidosD.Rows[nP]["MPED_NUMEPEDI"]; drVehPed[nPV]["MVEH_PEDIDO"] = dtPedidosD.Rows[nP]["PDOC_CODIGO"].ToString() + "|" + dtPedidosD.Rows[nP]["MPED_NUMEPEDI"].ToString(); drVehPed[nPV]["PCOL_CODRGBPEDI"] = "<td width='50%' bgcolor='" + dtPedidosD.Rows[nP]["PCOL_CODRGB"].ToString() + "' onclick=\"alert('" + dtPedidosD.Rows[nP]["PCOL_NOMBRE"].ToString() + " (" + dtPedidosD.Rows[nP]["PCOL_CODIGO"].ToString() + ")');\"> </td>"; drVehPed[nPV]["PCOL_CODRGBPEDIALT"] = "<td width='50%' bgcolor='" + dtPedidosD.Rows[nP]["PCOL_CODRGBALTE"].ToString() + "' onclick=\"alert('" + dtPedidosD.Rows[nP]["PCOL_NOMBREALTE"].ToString() + " (" + dtPedidosD.Rows[nP]["PCOL_CODIGOALTE"].ToString() + ")');\"> </td>"; dtPedidosD.Rows[nP]["DPED_CANTFALTA"] = Convert.ToInt16(dtPedidosD.Rows[nP]["DPED_CANTFALTA"]) - 1; } } } } } //Asignar pedidos similares(contienen catalogo) a los vehiculos no usados aún for (int nP = 0; nP < dsVehiculos.Tables[0].Rows.Count; nP++) { DataRow[] drsPedidos; if (Convert.ToInt16(dsVehiculos.Tables[0].Rows[nP]["USADO"]) == 0) { drsPedidos = dtPedidosD.Select("PCAT_CODIGO='" + dsVehiculos.Tables[0].Rows[nP]["PCAT_CODIGO"] + "'"); if (drsPedidos.Length > 0) { dsVehiculos.Tables[0].Rows[nP]["PDOC_CODIGO"] = drsPedidos[0]["PDOC_CODIGO"].ToString(); dsVehiculos.Tables[0].Rows[nP]["MPED_NUMEPEDI"] = Convert.ToInt32(drsPedidos[0]["MPED_NUMEPEDI"]); dsVehiculos.Tables[0].Rows[nP]["MVEH_PEDIDO"] = drsPedidos[0]["PDOC_CODIGO"].ToString() + "|" + Convert.ToInt32(drsPedidos[0]["MPED_NUMEPEDI"]); } } } //Asignar precio a los vehiculos segun su pedido asociado /*DataRow[] drsValor; * DataRow drVehiculoA; * double precioA,ivaA; * for(int nV=0;nV<dsVehiculos.Tables[0].Rows.Count;nV++){ * //Consultar primer precio del catalogo encontrado en los detalles del pedido correspondiente * drVehiculoA=dsVehiculos.Tables[0].Rows[nV]; * drsValor=dtPedidosD.Select( * "PDOC_CODIGO='"+drVehiculoA["PDOC_CODIGO"].ToString()+"' AND "+ * "MPED_NUMEPEDI="+drVehiculoA["MPED_NUMEPEDI"].ToString()+" AND "+ * "PCAT_CODIGO='"+drVehiculoA["PCAT_CODIGO"].ToString()+"'"); * if(drsValor.Length>0){ * ivaA=Convert.ToDouble(drVehiculoA["IVA"]); * precioA=Convert.ToDouble(drsValor[0]["DPED_VALOUNIT"]); * drVehiculoA["PRECIO"]=precioA; * drVehiculoA["DESCUENTO"]=Math.Round(precioA*desc/100,0); * drVehiculoA["PRECIO_IVA"]=Math.Round((precioA-Convert.ToDouble(drVehiculoA["DESCUENTO"]))*ivaA/100,0); * drVehiculoA["TOTAL"]=Math.Round(precioA-Convert.ToDouble(drVehiculoA["DESCUENTO"])+Convert.ToDouble(drVehiculoA["PRECIO_IVA"]),0); * } * }*/ dsVehiculos.Tables[0].DefaultView.Sort = "MVEH_PEDIDO,PCAT_CODIGO, MVEHI_DIAS DESC, MCAT_VIN"; dtVehiculos = CreateTable(dsVehiculos.Tables[0].DefaultView); Session["TABLA_MVEHICULOS"] = dtVehiculos; Session["TABLA_MPEDIDOS"] = dtPedidosM; Session["PEDIDOS"] = arlPedidos; ViewState.Remove("OTROS_CATALOGOS"); dgrVehiculos.EditItemIndex = -1; Bind_dgInserts(); } return(encontrado); }
protected void Page_Load(object sender, EventArgs e) { id = Request.QueryString["id"]; if (id == null) { Response.Redirect("~/UserViewJobPostings.aspx"); Response.End(); } connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DatabaseConnectionString"].ConnectionString); connection.Open(); SqlCommand getStatusOfUser = new SqlCommand("Select isEmployed, resume from [SimpleUser] where email=@email", connection); getStatusOfUser.Parameters.AddWithValue("email", Util.GetEmail(Request)); DataTable userTable = new DataTable(); SqlDataAdapter adapter = new SqlDataAdapter(getStatusOfUser); adapter.Fill(userTable); if (userTable.Rows[0]["isEmployed"].ToString() == true.ToString()) { DisableApplyNowButton("employed"); } else { SqlCommand getAppliedStatus = new SqlCommand("Select jID from [JobApply] Where jID=@id and email=@email", connection); getAppliedStatus.Parameters.AddWithValue("email", Util.GetEmail(Request)); getAppliedStatus.Parameters.AddWithValue("id", id); DataTable appliedTable = new DataTable(); adapter.SelectCommand = getAppliedStatus; adapter.Fill(appliedTable); if (appliedTable.Rows.Count > 0) { DisableApplyNowButton("applied"); } } SqlCommand getDetails = new SqlCommand("Select * from [Job] Where jID=@id and status='Open'", connection); getDetails.Parameters.AddWithValue("id", id); adapter.SelectCommand = getDetails; DataTable detailsTable = new DataTable(); adapter.Fill(detailsTable); SqlCommand getOrgDetails = new SqlCommand("Select firstName, lastName, organisationName, organisationAddress,organisationCity,organisationState from [HR],[User] where [User].email=[HR].email and [HR].email=@hremail", connection); if (detailsTable.Rows.Count > 0) { DataRow row = detailsTable.Rows[0]; getOrgDetails.Parameters.AddWithValue("hremail", row["employerHREmail"].ToString()); PositionLabel.Text = row["position"].ToString(); OpeningsLabel.Text = row["openings"].ToString(); HREmailLabel.Text = row["employerHREmail"].ToString(); CreatedOnLabel.Text = row["createdOn"].ToString().Substring(0, 10); DesctiptionLabel.InnerText = row["description"].ToString(); DataTable orgTable = new DataTable(); adapter.SelectCommand = getOrgDetails; adapter.Fill(orgTable); DataRow orgRow = orgTable.Rows[0]; OrganisationLabel.Text = orgRow["organisationName"].ToString(); OrganisationAddress.Text = orgRow["organisationAddress"].ToString() + "<br/>" + orgRow["organisationCity"].ToString() + ", " + orgRow["organisationState"].ToString(); HRNameLabel.Text = Util.CapFirstLetter(orgRow["firstName"].ToString()) + " " + Util.CapFirstLetter(orgRow["lastName"].ToString()); if (ViewState["showpopup"] != null) { ViewState.Remove("showpopup"); Util.CallJavascriptFunction(Page, "popout", new string[] { "Sucessfully Applied", "3" }); } } else { Response.Redirect("~/UserViewJobPostings.aspx"); } }
/// <summary> /// Clears the row ids and item indexes states /// </summary> public void ClearViewStateRowIdsandItemIndexes() { ViewState.Remove("RowIds"); ViewState.Remove("RowIdxs"); }
protected override void RenderAttributes(HtmlTextWriter writer) { ViewState.Remove("innerhtml"); base.RenderAttributes(writer); }
/// <devdoc> /// <para> /// Copies non-blank elements from the specified style, /// overwriting existing style elements if necessary. /// </para> /// </devdoc> public virtual void CopyFrom(Style s) { if (RegisteredCssClass.Length != 0) { throw new InvalidOperationException(SR.GetString(SR.Style_RegisteredStylesAreReadOnly)); } if (s != null && !s.IsEmpty) { this.Font.CopyFrom(s.Font); if (s.IsSet(PROP_CSSCLASS)) { this.CssClass = s.CssClass; } // if the source Style is registered and this one isn't, // reset all the styles set by the source Style so it's // css class can be used to set those values if (s.RegisteredCssClass.Length != 0) { if (IsSet(PROP_CSSCLASS)) { CssClass += " " + s.RegisteredCssClass; } else { CssClass = s.RegisteredCssClass; } if (s.IsSet(PROP_BACKCOLOR) && (s.BackColor != Color.Empty)) { ViewState.Remove("BackColor"); ClearBit(PROP_BACKCOLOR); } if (s.IsSet(PROP_FORECOLOR) && (s.ForeColor != Color.Empty)) { ViewState.Remove("ForeColor"); ClearBit(PROP_FORECOLOR); } if (s.IsSet(PROP_BORDERCOLOR) && (s.BorderColor != Color.Empty)) { ViewState.Remove("BorderColor"); ClearBit(PROP_BORDERCOLOR); } if (s.IsSet(PROP_BORDERWIDTH) && (s.BorderWidth != Unit.Empty)) { ViewState.Remove("BorderWidth"); ClearBit(PROP_BORDERWIDTH); } if (s.IsSet(PROP_BORDERSTYLE)) { ViewState.Remove("BorderStyle"); ClearBit(PROP_BORDERSTYLE); } if (s.IsSet(PROP_HEIGHT) && (s.Height != Unit.Empty)) { ViewState.Remove("Height"); ClearBit(PROP_HEIGHT); } if (s.IsSet(PROP_WIDTH) && (s.Width != Unit.Empty)) { ViewState.Remove("Width"); ClearBit(PROP_WIDTH); } } else { if (s.IsSet(PROP_BACKCOLOR) && (s.BackColor != Color.Empty)) { this.BackColor = s.BackColor; } if (s.IsSet(PROP_FORECOLOR) && (s.ForeColor != Color.Empty)) { this.ForeColor = s.ForeColor; } if (s.IsSet(PROP_BORDERCOLOR) && (s.BorderColor != Color.Empty)) { this.BorderColor = s.BorderColor; } if (s.IsSet(PROP_BORDERWIDTH) && (s.BorderWidth != Unit.Empty)) { this.BorderWidth = s.BorderWidth; } if (s.IsSet(PROP_BORDERSTYLE)) { this.BorderStyle = s.BorderStyle; } if (s.IsSet(PROP_HEIGHT) && (s.Height != Unit.Empty)) { this.Height = s.Height; } if (s.IsSet(PROP_WIDTH) && (s.Width != Unit.Empty)) { this.Width = s.Width; } } } }
protected void btnGen_Click(object sender, EventArgs e) { ViewState.Remove("SystematicType"); SetSystematicTransactions(); }
//保存 void btnSave_Click(object sender, EventArgs e) { if (txtAccountNew.ReadOnly == true) { UpdateSave(); return; } List <User> ds = DAL.User.GetUserByAccount(txtAccountNew.Text); if (ds.Count > 0) { ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "message", "alert('用户已存在');document.forms(0).txtAccountNew.select()", true); return; } ds = DAL.User.GetUserByIDCard(txtId.Text); if (ds.Count > 0) { ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "message", "alert('身份证号码已存在');document.forms(0).txtId.select()", true); return; } ContestDll.User dr = new ContestDll.User(); dr.Account = txtAccountNew.Text; dr.Name = txtNameNew.Text; dr.IDCard = txtId.Text; dr.Sex = rblSex.SelectedValue == "1"?true :false; dr.Telephone = txtTelephone.Text; dr.Email = txtEmail.Text; dr.Flag = 1; dr.SchoolID = int.Parse(ddlSchollNew.SelectedValue); UserRole drRole = new UserRole(); drRole.CreatedBy = DAL.Common.LoginID; drRole.Created = DateTime.Now; drRole.RoleID = int.Parse(rblRole.SelectedValue); drRole.StateID = 1; drRole.Flag = 1; drRole.ContestID = DAL.Common.GetContestID(Page); //这里加的专家和管理员无需审批 try { bool enableUser = true;// ViewState["ShowInfo"] != null; bool succeed = SaveAD(enableUser); if (succeed) { BLL.User.InsertUser(dr, drRole);; ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "message", "alert('保存成功');document.getElementById('divManageUser').style.display='none'", true); Clear(); ViewState.Remove("ShowInfo"); } else { DAL.Common.ShowMessage(Page, this.GetType(), "帐号已经存在!"); } } catch { DAL.Common.ShowMessage(Page, this.GetType(), "保存失败!"); } }