Ejemplo n.º 1
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            bool createAuditAccess = SessionManager.CheckUserPrivilege(SysPriv.originate, SysScope.audit);

            if (rbNew.Visible)
            {
                rbNew.Visible = createAuditAccess;
            }


            if (IsPostBack)
            {
                if (!uclAuditScheduleDetail.IsEditContext)
                {
                    RadPersistenceManager1.SaveState();
                }

                if (SessionManager.ReturnStatus == true)
                {
                    if (SessionManager.ReturnObject is string)
                    {
                        string type = SessionManager.ReturnObject as string;
                        switch (type)
                        {
                        case "DisplayAuditSchedules":
                            UpdateDisplayState(DisplayState.AuditScheduleList);
                            break;

                        case "Notification":
                            uclAuditScheduleDetail.EditAuditScheduleId = SessionManager.ReturnRecordID;
                            UpdateDisplayState(DisplayState.AuditScheduleEdit);
                            rbNew.Visible = false;
                            uclAuditScheduleDetail.EnableReturnButton(true);
                            break;

                        case "Closed":
                            uclAuditScheduleDetail.EditAuditScheduleId = SessionManager.ReturnRecordID;
                            UpdateDisplayState(DisplayState.AuditScheduleNew);
                            rbNew.Visible = false;
                            uclAuditScheduleDetail.EnableReturnButton(false);
                            break;
                        }
                    }
                    SessionManager.ClearReturns();
                }
            }
            else
            {
                if (SessionManager.ReturnStatus == true && SessionManager.ReturnObject is string)
                {
                    try
                    {
                        // from inbox
                        DisplayNonPostback();
                        SessionManager.ReturnRecordID = Convert.ToDecimal(SessionManager.ReturnObject.ToString());
                        SessionManager.ReturnObject   = "Notification";
                        SessionManager.ReturnStatus   = true;

                        StringBuilder       sbScript = new StringBuilder();
                        ClientScriptManager cs       = Page.ClientScript;

                        sbScript.Append("<script language='JavaScript' type='text/javascript'>\n");
                        sbScript.Append("<!--\n");
                        sbScript.Append(cs.GetPostBackEventReference(this, "PBArg") + ";\n");
                        sbScript.Append("// -->\n");
                        sbScript.Append("</script>\n");

                        cs.RegisterStartupScript(this.GetType(), "AutoPostBackScript", sbScript.ToString());
                    }
                    catch
                    {
                        // not a number, parse as type
                        DisplayNonPostback();
                    }
                }
                else
                {
                    DisplayNonPostback();
                }
            }
        }
    //protected SqlDataAdapter CitiesAdapter;

    protected void Page_Load(object sender, System.EventArgs e)
    {
        SqlConnection con = CommonFunctions.GetConnection();

        CitiesAdapter = new SqlDataAdapter(STR_SELECTCitiesFROMCitiesWHERECitiesStateProvinceID, con);//CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTCitiesFROMCitiesWHERECitiesStateProvinceID), SqlDbType.Int);


        DataTable dt = new DataTable();

        CitiesAdapter.Fill(dt);
        List <Location> eList = new List <Location>();

        foreach (DataRow dr in dt.Rows)
        {
            try
            {
                Location e1 = new Location();
                e1.title       = dr["City"].ToString();
                e1.lat         = Convert.ToDouble(dr["Latitude"]);
                e1.lng         = Convert.ToDouble(dr["Longitude"]);;
                e1.description = dr["City"].ToString();
                string temps = CommonFunctions.GetSiteAddress() + "/" + dr["Country"].ToString().ToLower().Replace(" ", "_") +
                               "/" + dr["StateProvince"].ToString().ToLower().Replace(" ", "_") + "/" + dr["City"].ToString().ToLower().Replace(" ", "_") + "/default.aspx";
                e1.URL = temps;
                eList.Add(e1);
            }
            catch { }
        }
        // Response.Write(CitiesAdapter.SelectCommand.CommandText);
        string ans = JsonConvert.SerializeObject(eList, Formatting.Indented);



        ClientScriptManager cs = Page.ClientScript;

        cs.RegisterStartupScript(Page.GetType(), "JSON", "initialize(" + ans + ");", true);


        //footerPropDescContainer.Visible = false;

        //string connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;


        //CommonFunctions.Connection.ConnectionString = connectionstring;

        //if (CommonFunctions.Connection.State == System.Data.ConnectionState.Closed)
        //CommonFunctions.Connection.Open ();

        //lock (CommonFunctions.Connection)
        PropertiesAdapter.Fill(PropertiesFullSet);

        //lock (CommonFunctions.Connection)
        RegionsAdapter.Fill(RegionsSet);
        //lock (CommonFunctions.Connection)
        CountriesAdapter.Fill(CountriesSet);
        //lock (CommonFunctions.Connection)
        StateProvincesAdapter.Fill(StateProvincesSet);
        //lock (CommonFunctions.Connection)
        CitiesAdapter.Fill(CitiesSet);

        //lock (CommonFunctions.Connection)
        AmenitiesAdapter.Fill(AmenitiesSet);
        //lock (CommonFunctions.Connection)
        AttractionsAdapter.Fill(AttractionsSet);

        //if (Master.FindControl ("BodyTag") is HtmlGenericControl)
        //{
        //    HtmlGenericControl body = (HtmlGenericControl)Master.FindControl ("BodyTag");
        //    body.Attributes["onload"] = "InitializeDropdowns ();";
        //}

        string temp = "Vacation rentals at ";

        System.Web.UI.HtmlControls.HtmlGenericControl searchwithout = (System.Web.UI.HtmlControls.HtmlGenericControl)Master.FindControl("searchwithoutnavigation");
        System.Web.UI.HtmlControls.HtmlGenericControl searchwith    = (System.Web.UI.HtmlControls.HtmlGenericControl)Master.FindControl("searchwithnavigation");
        searchwith.Style.Add("display", "none");
        searchwithout.Style.Add("display", "block");

        ((System.Web.UI.WebControls.Image)Master.FindControl("Logo")).AlternateText = temp + "Vacations-Abroad.com";
        //((System.Web.UI.WebControls.Image)Master.FindControl ("MainLogo")).AlternateText = temp + "@ Vacations-Abroad.com";

        foreach (DataRow datarow in RegionsSet.Tables["Regions"].Rows)
        {
            if (datarow["Region"] is string)
            {
                regions += " " + (string)datarow["Region"];
            }
        }

        HtmlHead head = Page.Header;
        //Page.ClientScript.RegisterClientScriptInclude("aKeyToIdentifyIt", "/scripts/countryStateCity.js");
        HtmlMeta keywords = new HtmlMeta();

        keywords.Name = "keywords";
        if (PropertiesFullSet.Tables["Properties"].Rows.Count < 1)
        {
            keywords.Content = "View property";
        }
        else
        {
            keywords.Content = Keywords.Text.Replace("%regions%", regions.Trim());
        }

        head.Controls.Add(keywords);
        HtmlMeta description = new HtmlMeta();

        description.Name = "description";
        if (PropertiesFullSet.Tables["Properties"].Rows.Count < 1)
        {
            description.Content = "View property";
        }
        else
        {
            description.Content = Description.Text.Replace("%regions%", regions.Trim());
        }

        head.Controls.Add(description);

        if (!IsPostBack)
        {
            DataBind();
            Page.Header.Controls.Add(new LiteralControl("<link href='http://vacations-abroad.com/css/StyleSheet.css' rel='stylesheet' type='text/css' />"));
        }
        DataSet ds = Utility.dsGrab("RegionTextList");

        //ltlAsia.Text = ds.Tables[0].Rows[1]["RegionTextValue"].ToString();
        //ltlEurope.Text = ds.Tables[0].Rows[2]["RegionTextValue"].ToString();
        //ltlNorthAmerica.Text = ds.Tables[0].Rows[3]["RegionTextValue"].ToString();
        //ltlSouthAmerica.Text = ds.Tables[0].Rows[4]["RegionTextValue"].ToString();
        //ltlOceania.Text = ds.Tables[0].Rows[5]["RegionTextValue"].ToString();
        //ltlAsiaList.Text = GenerateCountryLinks("2");
        //ltlOceaniaList.Text = GenerateCountryLinks("3");
        //ltlSouthAmericaList.Text = GenerateCountryLinks("9");
        //ltlEuropeList.Text = GenerateCountryLinks("6");
        //ltlNorthAmericaList.Text = GenerateCountryLinks("8");
    }
Ejemplo n.º 3
0
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder       sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;

            #region Tham số
            string _ID          = Request["ID"];
            string _CQ_ID       = Request["CQ_ID"];
            string _Username    = Request["Username"];
            string _Password    = Request["Password"];
            string _Pwd         = Request["Pwd"];
            string _Ten         = Request["Ten"];
            string _Khoa        = Request["Khoa"];
            string _Luong       = Request["Luong"];
            string _q           = Request["q"];
            string _Anh         = Request["Anh"];
            string _Loai        = Request["Loai"];
            string _ThuKy       = Request["ThuKy"];
            string _refUsername = Request["refUsername"];
            string _Email       = Request["Email"];
            string _Captcha     = Request["Captcha"];
            string _Mobile      = Request["Mobile"];
            string _DiaChi      = Request["DiaChi"];
            string _MoTa        = Request["MoTa"];
            string _Loai_Ten    = Request["Loai_Ten"];
            string _CQ_Ma       = Request["CQ_Ma"];
            string TVDV_ID      = Request["TVDV_ID"];
            string _Lang        = Request["Lang"];
            #endregion
            //if (!Security.IsAuthenticated())
            //{
            //    Response.End();
            //}
            switch (subAct)
            {
            case "get":
                #region lấy danh sách
                if (string.IsNullOrEmpty(jgrsidx))
                {
                    jgrsidx = "ID";
                }
                if (string.IsNullOrEmpty(jgrsord))
                {
                    jgrsord = "asc";
                }
                Pager <Member>  PagerGet = MemberDal.pagerAllChildByUsername("", false, "MEM_" + jgrsidx + " " + jgrsord, Security.Username, _CQ_ID, _q, Request["rows"]);
                List <jgridRow> ListRow  = new List <jgridRow>();
                foreach (Member item in PagerGet.List)
                {
                    ListRow.Add(new jgridRow(item.ID.ToString(), new string[] {
                        item.ID.ToString()
                        , item.Ten
                        , item._CoQuan.Ten
                        , item.Loai_Ten
                        , item.Email
                        , item.Mobile
                        , item.Username
                        , item.Password.Length > 2 ? item.Password.Substring(0, item.Password.Length - 2) : ""
                        , item.Active.ToString()
                        , item.NguoiTao
                    }));
                }
                jgrid grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PagerGet.TotalPages.ToString(), PagerGet.Total.ToString(), ListRow);
                sb.Append(JavaScriptConvert.SerializeObject(grid));
                break;

                #endregion
            case "getpid":
                #region lấy danh sách cho autocomplete
                Pager <Member> PagerGetPid = MemberDal.pagerAllChildByUsername("", true, null, string.IsNullOrEmpty(Security.Username) ? "sspa" : Security.Username, null, _q, "20");
                sb.Append(JavaScriptConvert.SerializeObject(PagerGetPid.List));
                break;

                #endregion
            case "GetLamDichVuList":
                #region lấy danh sách cho autocomplete
                var listLamDichVu = MemberDal.SelectLamDichVu(TVDV_ID, "sspa");
                sb.Append(JavaScriptConvert.SerializeObject(listLamDichVu));
                break;

                #endregion
            case "getpuse":
                #region lấy danh sách cho autocomplete
                Pager <Member> PagerGetPues = MemberDal.pagerAllByUsername("", true, null, Security.Username, null, _q, "20");
                sb.Append(JavaScriptConvert.SerializeObject(PagerGetPues.List));
                break;

                #endregion
            case "SelectByNodeAndWfId":
                #region lấy danh sách cho autocomplete
                string Username = Security.Username;
                //if (Request["WF_ID"] == "4" && string.IsNullOrEmpty(Request["NODE_ID"]))
                //{
                //    sb.Append(JavaScriptConvert.SerializeObject(MemberDal.SelectLanhDaoByCQMa("1")));
                //}
                //else
                //{
                //    if (!string.IsNullOrEmpty(_CQ_ID))
                //    {
                //        MemberCollection mem = MemberDal.SelectLanhDaoByCQMa(_CQ_ID);
                //        foreach (Member m in mem)
                //        {
                //            Username = m.Username;
                //            break;
                //        }
                //    }
                sb.Append(JavaScriptConvert.SerializeObject(MemberDal.SelectByNodeAndWfId(Request["NODE_ID"], Request["WF_ID"], _q, "20", Username)));
                //}
                break;

                #endregion
            case "del":
                #region xóa
                MemberDal.DeleteByIdList(Request["ID"]);
                break;

                #endregion
            case "edit":
                #region chỉnh sửa
                if (!string.IsNullOrEmpty(_ID))
                {
                    sb.Append("(" + JavaScriptConvert.SerializeObject(MemberDal.SelectById(Convert.ToInt32(_ID))) + ")");
                }
                break;

                #endregion
            case "editX":
                #region editX
                if (!string.IsNullOrEmpty(_ID))
                {
                    sb.Append(MemberDal.SelectById(Convert.ToInt32(_ID)).Loai.ToString());
                }
                break;

                #endregion
            case "save":
                #region lưu
                Member ItemSave = new Member();
                if (string.IsNullOrEmpty(_Username))
                {
                    sb.Append("0");
                    break;
                }
                if (!string.IsNullOrEmpty(_ID))
                {
                    ItemSave = MemberDal.SelectById(Convert.ToInt32(_ID));
                }
                else
                {
                    if (MemberDal.ValidEmailUsername(_Email, _Username) != "-1" ||
                        MemberDal.ValidEmailUsername(_Email, _Username) != (string.IsNullOrEmpty(_ID) ? "-1" : _ID))
                    {
                        sb.Append("0");
                        break;
                    }
                }
                ItemSave.Luong       = Convert.ToDouble(_Luong);
                ItemSave.Anh         = _Anh;
                ItemSave.CQ_ID       = Convert.ToInt32(_CQ_ID);
                ItemSave.DiaChi      = string.Empty;
                ItemSave.Email       = _Email;
                ItemSave.Ho          = string.Empty;
                ItemSave.Khoa        = Convert.ToBoolean(_Khoa);
                ItemSave.Loai        = Convert.ToInt32("0");
                ItemSave.Mobile      = _Mobile;
                ItemSave.Mota        = string.Empty;
                ItemSave.NgayCapNhat = DateTime.Now;
                ItemSave.NguoiTao    = Security.Username;
                ItemSave.RefUsername = _refUsername;
                ItemSave.Ten         = _Ten;
                ItemSave.Loai_Ten    = _Loai_Ten;
                ItemSave.ThuKy       = Convert.ToBoolean(_ThuKy);
                ItemSave.XacNhan     = false;
                if (!string.IsNullOrEmpty(_ID))
                {
                    if (!string.IsNullOrEmpty(_Password))
                    {
                        //ItemSave.Password = maHoa.EncryptString(_Password, _Username);
                        ItemSave.Password = maHoa.MD5Encrypt(_Password);
                    }
                    ItemSave = MemberDal.Update(ItemSave);
                }
                else
                {
                    ItemSave.NgayTao = DateTime.Now;
                    //ItemSave.Password = maHoa.EncryptString(_Password, _Username);
                    ItemSave.Password = maHoa.MD5Encrypt(_Password);
                    ItemSave.RowId    = Guid.NewGuid();
                    ItemSave.Username = _Username;
                    ItemSave          = MemberDal.Insert(ItemSave);
                }
                sb.Append("1");
                break;

                #endregion
            case "sendmail":
                #region gửi email
                if (!string.IsNullOrEmpty(_Email))
                {
                    string[]          _email = _Email.Split(new char[] { ',' });
                    sendEmailDelegate _send  = new sendEmailDelegate(sendMail);
                    //_send.BeginInvoke(_email, _Ten, _MoTa, null, null);
                    sb.Append("1");
                }
                else
                {
                    sb.Append("0");
                }
                break;

                #endregion
            case "getRoles":
                #region lấy quyền của thành viên
                if (!string.IsNullOrEmpty(_Username))
                {
                    sb.AppendFormat(getRoleByUsername(_Username));
                }
                break;

                #endregion
            case "saveRoles":
                #region lưu quyền
                if (!string.IsNullOrEmpty(_Username))
                {
                    string roleList = Request["roleList"];
                    if (!string.IsNullOrEmpty(roleList))
                    {
                        MemberRoleDal.UpdateRoleListUsername(roleList, _Username);
                    }
                }
                break;

                #endregion
            case "SelectLanhDaoByCQID":
                #region lấy lãnh đạo theo cơ quan
                if (!string.IsNullOrEmpty(_CQ_ID))
                {
                    MemberCollection PG = MemberDal.SelectLanhDaoByCQID(_CQ_ID);
                    sb.Append(JavaScriptConvert.SerializeObject(PG));
                }
                break;

                #endregion
            case "SelectLanhDaoVanBanDi":
                #region lấy lãnh đạo theo cơ quan
                MemberCollection _SelectLanhDaoVanBanDi = MemberDal.SelectLanhDaoVanBanDi();
                sb.Append(JavaScriptConvert.SerializeObject(_SelectLanhDaoVanBanDi));
                break;

                #endregion
            case "SelectLanhDaoByMaCQ":
                #region tim lanh dao theo ma co quan
                MemberCollection _SelectLanhDaoByMaCoQuan = MemberDal.SelectLanhDaoByCQMa(_CQ_Ma);
                sb.Append(JavaScriptConvert.SerializeObject(_SelectLanhDaoByMaCoQuan));
                break;

                #endregion
            case "ValidateEmail":
                #region tim lanh dao theo ma co quan
                if (!string.IsNullOrEmpty(_Email))
                {
                    if (MemberDal.ValidEmail(_Email))
                    {
                        sb.Append("1");
                    }
                    else
                    {
                        sb.Append("0");
                    }
                }
                break;

                #endregion
            case "ValidateCaptcha":
                #region tim lanh dao theo ma co quan
                if (!string.IsNullOrEmpty(_Captcha))
                {
                    if (Session["capcha"] != null)
                    {
                        if (Session["capcha"].ToString() == _Captcha)
                        {
                            sb.Append("1");
                        }
                        else
                        {
                            sb.Append("0");
                        }
                    }
                    else
                    {
                        sb.Append("0");
                    }
                }
                else
                {
                    sb.Append("0");
                }
                break;

                #endregion
            case "cungDonVi":
                #region cungDonVi : Lấy thành viên cùng đơn vị
                sb.Append(JavaScriptConvert.SerializeObject(MemberDal.SelectCungDonVi(Security.Username)));
                break;
                #endregion

            case "dangKyCaNhan":
                #region dangKyCaNhan
                using (SqlConnection con = DAL.con())
                {
                    con.Open();
                    SqlTransaction tran = con.BeginTransaction();
                    try
                    {
                        CoQuan ItemCq = CoQuanDal.SelectByMa(tran, "RAOVAT");
                        //Member ItemMe = MemberDal.Insert(tran, ItemCq.ID, _Ten, _Email, _Mobile, _DiaChi, maHoa.EncryptString(_Pwd, _Email));
                        Member     ItemMe = MemberDal.Insert(tran, ItemCq.ID, _Ten, _Email, _Mobile, _DiaChi, maHoa.MD5Encrypt(_Password));
                        MemberRole ItemMR = MemberRoleDal.InsertDangKyCaNhan(tran, ItemCq.ID, _Email);
                        Security.Login(_Email, "true");
                        sb.Append("1");
                        tran.Commit();
                    }
                    catch (Exception ex)
                    {
                        tran.Rollback();
                        Security.LogOut();
                        sb.Append(ex.ToString());
                    }
                    finally
                    {
                        con.Close();
                    }
                }

                break;

                #endregion
            case "dangKyGh":
                #region dangKyGh
                using (SqlConnection con = DAL.con())
                {
                    con.Open();
                    SqlTransaction tran = con.BeginTransaction();
                    try
                    {
                        CoQuan ItemCqP = CoQuanDal.SelectByMa(tran, "GIANHANG");
                        CoQuan ItemCq  = CoQuanDal.Insert(tran, ItemCqP.ID, _Ten, _Email);
                        //Member ItemMe = MemberDal.Insert(tran, ItemCq.ID, _Ten, _Email, _Mobile, _DiaChi, maHoa.EncryptString(_Pwd, _Email));
                        Member ItemMe = MemberDal.Insert(tran, ItemCq.ID, _Ten, _Email, _Mobile, _DiaChi, maHoa.MD5Encrypt(_Pwd));
                        MemberRoleDal.InsertDangKyGianHang(tran, ItemCq.ID, _Email, _Ten, _Lang);
                        //LienHe itemLH = LienHeDal.InsertLH(tran, ItemMe.RowId.ToString());
                        Security.Login(_Email, "true");
                        sb.Append("1");
                        tran.Commit();
                    }
                    catch (Exception ex)
                    {
                        tran.Rollback();
                        Security.LogOut();
                        sb.Append(ex.ToString());
                    }
                    finally
                    {
                        con.Close();
                    }
                }

                break;

                #endregion
            case "scpt":
                #region Nạp js
                sb.AppendFormat(@"{0}"
                                , cs.GetWebResourceUrl(typeof(Class1), "docsoft.plugin.hethong.thanhvien.JScript1.js"));
                break;

                #endregion
            default:    //Session["capcha"]
                #region nạp
                FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                sb.Append(@"<div class=""mdl-head"">
<span class=""mdl-head-searchPnl ui-state-default ui-corner-all"">
<a href=""javascript:;"" class=""mdl-head-clearSearch""></a>
<input type=""text"" class=""mdl-head-txt mdl-head-search mdl-head-search-thanhvien"" />
</span>
<a class=""mdl-head-btn mdl-head-add"" id=""thanhvienmdl-addBtn"" href=""javascript:thanhvien.add();"">Thêm</a>
<a class=""mdl-head-btn mdl-head-edit"" id=""thanhvienmdl-editBtn"" href=""javascript:thanhvien.edit();"">Sửa</a>
<a class=""mdl-head-btn mdl-head-del"" id=""thanhvienmdl-delBtn"" href=""javascript:thanhvien.del();"">Xóa</a>
<a class=""mdl-head-btn mdl-head-sendmail"" id=""thanhvienmdl-emailBtn"" href=""javascript:thanhvien.sendmail();"">Email</a>
<a class=""mdl-head-btn mdl-head-resetPwd"" id=""thanhvienmdl-reSendPwdBtn"" href=""javascript:thanhvien.resendPwd();"">Cấp mật khẩu</a>
<span class=""mdl-head-filterPnl ui-state-default ui-corner-all"">
<a href=""javascript:;"" class=""mdl-head-clearSearch""></a>
<input type=""text"" _value="""" class=""mdl-head-filter mdl-head-filterThanhVienByCQID""/>
</span>
</div>
<table id=""thanhvienmdl-List"" class=""mdl-list"">
</table>
<div id=""thanhvienmdl-Pager""></div><div class=""sub-mdl""><ul><li><a id=""thanhvienmdl-rolemdl-subMdlBtn"" href=""#mdl-1"">Quyền</a></li></ul><div id=""mdl-1"">
<div class=""sub-mdl-list"" id=""thanhvienmdl-rolemdl-mdl""></div>
</div></div>");
                sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                                , cs.GetWebResourceUrl(typeof(Class1), "docsoft.plugin.hethong.thanhvien.JScript1.js")
                                , "{thanhvien.loadgrid();}");
                sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                break;
                #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Ejemplo n.º 4
0
        public override void PreRender(Page page, HtmlHead head, ClientScriptManager csm, string cmenu, StringBuilder script)
        {
            Menu                    owner = Owner;
            MenuItemStyle           staticMenuItemStyle     = owner.StaticMenuItemStyleInternal;
            SubMenuStyle            staticMenuStyle         = owner.StaticMenuStyleInternal;
            MenuItemStyle           dynamicMenuItemStyle    = owner.DynamicMenuItemStyleInternal;
            SubMenuStyle            dynamicMenuStyle        = owner.DynamicMenuStyleInternal;
            MenuItemStyleCollection levelMenuItemStyles     = owner.LevelMenuItemStyles;
            List <Style>            levelMenuItemLinkStyles = owner.LevelMenuItemLinkStyles;
            SubMenuStyleCollection  levelSubMenuStyles      = owner.LevelSubMenuStylesInternal;
            MenuItemStyle           staticSelectedStyle     = owner.StaticSelectedStyleInternal;
            MenuItemStyle           dynamicSelectedStyle    = owner.DynamicSelectedStyleInternal;
            MenuItemStyleCollection levelSelectedStyles     = owner.LevelSelectedStylesInternal;
            List <Style>            levelSelectedLinkStyles = owner.LevelSelectedLinkStyles;
            Style                   staticHoverStyle        = owner.StaticHoverStyleInternal;
            Style                   dynamicHoverStyle       = owner.DynamicHoverStyleInternal;

            if (!csm.IsClientScriptIncludeRegistered(typeof(Menu), "Menu.js"))
            {
                string url = csm.GetWebResourceUrl(typeof(Menu), "Menu.js");
                csm.RegisterClientScriptInclude(typeof(Menu), "Menu.js", url);
            }

            script.AppendFormat(onPreRenderScript,
                                cmenu,
                                page.IsMultiForm ? page.theForm : "window",
                                ClientScriptManager.GetScriptLiteral(owner.DisappearAfter),
                                ClientScriptManager.GetScriptLiteral(owner.Orientation == Orientation.Vertical));

            if (owner.DynamicHorizontalOffset != 0)
            {
                script.Append(String.Concat(cmenu, ".dho = ", ClientScriptManager.GetScriptLiteral(owner.DynamicHorizontalOffset), ";\n"));
            }
            if (owner.DynamicVerticalOffset != 0)
            {
                script.Append(String.Concat(cmenu, ".dvo = ", ClientScriptManager.GetScriptLiteral(owner.DynamicVerticalOffset), ";\n"));
            }

            // The order in which styles are defined matters when more than one class
            // is assigned to an element
            RegisterStyle(owner.PopOutBoxStyle, head);
            RegisterStyle(owner.ControlStyle, owner.ControlLinkStyle, head);

            if (staticMenuItemStyle != null)
            {
                RegisterStyle(owner.StaticMenuItemStyle, owner.StaticMenuItemLinkStyle, head);
            }

            if (staticMenuStyle != null)
            {
                RegisterStyle(owner.StaticMenuStyle, head);
            }

            if (dynamicMenuItemStyle != null)
            {
                RegisterStyle(owner.DynamicMenuItemStyle, owner.DynamicMenuItemLinkStyle, head);
            }

            if (dynamicMenuStyle != null)
            {
                RegisterStyle(owner.DynamicMenuStyle, head);
            }

            if (levelMenuItemStyles != null && levelMenuItemStyles.Count > 0)
            {
                levelMenuItemLinkStyles = new List <Style> (levelMenuItemStyles.Count);
                foreach (Style style in levelMenuItemStyles)
                {
                    Style linkStyle = new Style();
                    levelMenuItemLinkStyles.Add(linkStyle);
                    RegisterStyle(style, linkStyle, head);
                }
            }

            if (levelSubMenuStyles != null)
            {
                foreach (Style style in levelSubMenuStyles)
                {
                    RegisterStyle(style, head);
                }
            }

            if (staticSelectedStyle != null)
            {
                RegisterStyle(staticSelectedStyle, owner.StaticSelectedLinkStyle, head);
            }

            if (dynamicSelectedStyle != null)
            {
                RegisterStyle(dynamicSelectedStyle, owner.DynamicSelectedLinkStyle, head);
            }

            if (levelSelectedStyles != null && levelSelectedStyles.Count > 0)
            {
                levelSelectedLinkStyles = new List <Style> (levelSelectedStyles.Count);
                foreach (Style style in levelSelectedStyles)
                {
                    Style linkStyle = new Style();
                    levelSelectedLinkStyles.Add(linkStyle);
                    RegisterStyle(style, linkStyle, head);
                }
            }

            if (staticHoverStyle != null)
            {
                if (head == null)
                {
                    throw new InvalidOperationException("Using Menu.StaticHoverStyle requires Page.Header to be non-null (e.g. <head runat=\"server\" />).");
                }
                RegisterStyle(staticHoverStyle, owner.StaticHoverLinkStyle, head);
                script.Append(String.Concat(cmenu, ".staticHover = ", ClientScriptManager.GetScriptLiteral(staticHoverStyle.RegisteredCssClass), ";\n"));
                script.Append(String.Concat(cmenu, ".staticLinkHover = ", ClientScriptManager.GetScriptLiteral(owner.StaticHoverLinkStyle.RegisteredCssClass), ";\n"));
            }

            if (dynamicHoverStyle != null)
            {
                if (head == null)
                {
                    throw new InvalidOperationException("Using Menu.DynamicHoverStyle requires Page.Header to be non-null (e.g. <head runat=\"server\" />).");
                }
                RegisterStyle(dynamicHoverStyle, owner.DynamicHoverLinkStyle, head);
                script.Append(String.Concat(cmenu, ".dynamicHover = ", ClientScriptManager.GetScriptLiteral(dynamicHoverStyle.RegisteredCssClass), ";\n"));
                script.Append(String.Concat(cmenu, ".dynamicLinkHover = ", ClientScriptManager.GetScriptLiteral(owner.DynamicHoverLinkStyle.RegisteredCssClass), ";\n"));
            }
        }
Ejemplo n.º 5
0
        public static ClientScriptManager GetScriptManager([NotNull] this Control thisValue)
        {
            ClientScriptManager csm = AsPage(thisValue)?.ClientScript;

            return(csm);
        }
Ejemplo n.º 6
0
    protected void BTN_Facturar_Click(object sender, ImageClickEventArgs e)
    {
        ClientScriptManager cm = this.ClientScript;

        if (TB_Iduser.Text == "")
        {
            //ScriptManager.RegisterStartupScript(this, this.GetType(), "myAlert", "alert('Debe ingresar el ID asociado al cliente');", true);

            MostrarMensaje1($"Debe ingresar el Identificador asociado al cliente");
            return;
        }
        else
        {
            //verifico si el usuario tiene productos en carrito antes de facturar
            List <UEncapCarrito> listCarritoV = new LEmpleado().ObtenerCarritoxUsuario(((UEncapUsuario)Session["Valido"]).User_id);
            if (listCarritoV.Count == 0)
            {
                //ScriptManager.RegisterStartupScript(this, this.GetType(), "myAlert", "alert('Debe ingresar productos antes de realizar una venta');", true);
                MostrarMensaje($"Debe ingresar productos antes de realizar una venta");
                return;
            }
            else
            {
                //creo objeto para cambiar el estado luego de facturar
                UEncapCarrito carrito = new UEncapCarrito();
                carrito.User_id   = ((UEncapUsuario)Session["Valido"]).User_id;
                carrito.Estadocar = 2;
                new LEmpleado().actualizarestadocarrito(carrito);

                //agrego a la tabla pedido
                UEncapPedido pedido = new UEncapPedido();
                pedido.Fecha_pedido  = DateTime.Now;
                pedido.User_id       = int.Parse(TB_Iduser.Text);
                pedido.Atendido_id   = ((UEncapUsuario)Session["Valido"]).User_id;
                pedido.Estado_pedido = 6;
                List <UEncapCarrito> listCarrito = new LEmpleado().ObtenerCarritoxUsuario(pedido.Atendido_id);
                pedido.Total = listCarrito.Sum(x => x.Precio * x.Cantidad).Value;
                int pedido_Id = new LEmpleado().insertarpedido(pedido);

                Session["pedido_Id"] = pedido_Id;

                //agrego a carrito el pedido
                UEncapCarrito id_pedido = new UEncapCarrito();
                id_pedido.User_id   = int.Parse(TB_Iduser.Text);
                id_pedido.Id_pedido = pedido_Id;
                new LEmpleado().ActualizarIdpedidoCarrito(id_pedido);


                //recorreo los producto que tiene el usuario en carrito
                foreach (var product in listCarrito)
                {
                    //inserto los productos en productos del pedido
                    UEncapProducto_pedido producto = new UEncapProducto_pedido();
                    producto.Pedido_id   = id_pedido.Id_pedido;
                    producto.Producto_id = product.Producto_id;
                    producto.Cantidad    = product.Cantidad.Value;
                    producto.Precio      = product.Precio;
                    producto.Total       = product.Total;
                    new LEmpleado().InsertarProductos(producto);



                    //descuento la cantidad del producto en el inventario
                    UEncapInventario descontar = new UEncapInventario();
                    descontar.Id        = product.Producto_id;
                    descontar.Ca_actual = product.Cantidad.Value;
                    new LEmpleado().ActualizarCantidadInventario(descontar);
                }

                //elimino los productos en carrito del usuario
                int id_user = ((UEncapUsuario)Session["Valido"]).User_id;
                new LEmpleado().limpiarCarrito(id_user);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "myAlert", "alert('Se genero el pedido No.00" + pedido_Id.ToString() + "');", true);
                Response.Redirect("FacturaVentanilla.aspx");
            }
        }
    }
Ejemplo n.º 7
0
		protected override void RenderAttributes (HtmlTextWriter writer)
		{
#if NET_2_0
			if (Page != null && Events [ServerClickEvent] != null) {
				PostBackOptions options = GetPostBackOptions ();
				Attributes ["onclick"] += Page.ClientScript.GetPostBackEventReference (options, true);
				writer.WriteAttribute ("language", "javascript");
			}
#else		
			ClientScriptManager csm = new ClientScriptManager (Page);
			bool postback = false;

			if (Page != null && Events [ServerClickEvent] != null)
				postback = true;

			if (CausesValidation && Page != null && Page.AreValidatorsUplevel ()) {
				if (postback)
					writer.WriteAttribute ("onclick",
							       String.Concat ("javascript:{if (typeof(Page_ClientValidate) != 'function' ||  Page_ClientValidate()) ",
									      csm.GetPostBackEventReference (this, String.Empty), "}"));
				else
					writer.WriteAttribute ("onclick",
							       "if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate();");

				writer.WriteAttribute ("language", "javascript");
			}
			else if (postback) {
				writer.WriteAttribute ("onclick",
						       Page.ClientScript.GetPostBackClientHyperlink (this, ""));

				writer.WriteAttribute ("language", "javascript");
			}
#endif

			base.RenderAttributes (writer);
		}
Ejemplo n.º 8
0
		protected override void RenderAttributes (HtmlTextWriter writer)
		{
			// we don't want to render the "user" URL, so we either render:
			EventHandler serverClick = (EventHandler) Events [serverClickEvent];
			if (serverClick != null) {
				ClientScriptManager csm;
#if NET_2_0
				// a script
				PostBackOptions options = GetPostBackOptions ();
				csm = Page.ClientScript;
				csm.RegisterForEventValidation (options);
				Attributes ["href"] = csm.GetPostBackEventReference (options, true);
#else
				// a script
				csm = new ClientScriptManager (Page);
				Attributes ["href"] = csm.GetPostBackClientHyperlink (this, String.Empty);
#endif
			} else {
				string hr = HRef;
				if (hr != string.Empty)
#if TARGET_J2EE
					// For J2EE portlets we need to genreate a render URL.
					HRef = ResolveClientUrl (hr, String.Compare (Target, "_blank", StringComparison.InvariantCultureIgnoreCase) != 0);
#else
					HRef = ResolveClientUrl (hr);
#endif
			}

			base.RenderAttributes (writer);

			// but we never set back the href attribute after the rendering
			// nor is the property available after rendering
			Attributes.Remove ("href");
		}
Ejemplo n.º 9
0
        protected void RenderContents()
        {
            // Ensure we have at least the base JQuery UI by loading the internal copy.  This prevents broken tabs in case
            // the CDN is unreachable.
            Page.Header.Controls.Add(
                new System.Web.UI.LiteralControl("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + ResolveUrl("/_layouts/15/SharePointTabify/css/JQuery-UI-base.1.12.1.css") + "\" />"));

            if (_theme == cssOptions.Custom)
            {
                Page.Header.Controls.Add(
                    new System.Web.UI.LiteralControl("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + ResolveUrl(_customCss) + "\" />"));
            }
            else
            {
                Page.Header.Controls.Add(
                    new System.Web.UI.LiteralControl("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + ResolveUrl("//ajax.aspnetcdn.com/ajax/jquery.ui/1.12.1/themes/" + _theme.ToString().Replace("_", "-") + "/jquery-ui.css") + "\" />"));
            }

            StringBuilder TabCommand = new StringBuilder();

            if (!String.IsNullOrEmpty(_tab1Name))
            {
                if (String.IsNullOrEmpty(_tab1Webparts))
                {
                    _tab1Webparts = "Warning: No Value Specified.";
                }
                TabCommand.Append('"' + _tab1Name);
                TabCommand.Append(';');
                TabCommand.Append('#' + (_tab1Webparts.Replace(", ", ",").Replace(",", ";#")) + '"');
            }
            if (!String.IsNullOrEmpty(_tab2Name))
            {
                if (String.IsNullOrEmpty(_tab2Webparts))
                {
                    _tab2Webparts = "Warning: No Value Specified.";
                }
                TabCommand.Append(',');
                TabCommand.Append('"' + _tab2Name);
                TabCommand.Append(';');
                TabCommand.Append('#' + (_tab2Webparts.Replace(", ", ",").Replace(",", ";#")) + '"');
            }
            if (!String.IsNullOrEmpty(_tab3Name))
            {
                if (String.IsNullOrEmpty(_tab3Webparts))
                {
                    _tab3Webparts = "Warning: No Value Specified.";
                }
                TabCommand.Append(',');
                TabCommand.Append('"' + _tab3Name);
                TabCommand.Append(';');
                TabCommand.Append('#' + (_tab3Webparts.Replace(", ", ",").Replace(",", ";#")) + '"');
            }
            if (!String.IsNullOrEmpty(_tab4Name))
            {
                if (String.IsNullOrEmpty(_tab4Webparts))
                {
                    _tab4Webparts = "Warning: No Value Specified.";
                }
                TabCommand.Append(',');
                TabCommand.Append('"' + _tab4Name);
                TabCommand.Append(';');
                TabCommand.Append('#' + (_tab4Webparts.Replace(", ", ",").Replace(",", ";#")) + '"');
            }
            if (!String.IsNullOrEmpty(_tab5Name))
            {
                if (String.IsNullOrEmpty(_tab5Webparts))
                {
                    _tab5Webparts = "Warning: No Value Specified.";
                }
                TabCommand.Append(',');
                TabCommand.Append('"' + _tab5Name);
                TabCommand.Append(';');
                TabCommand.Append('#' + (_tab5Webparts.Replace(", ", ",").Replace(",", ";#")) + '"');
            }
            if (!String.IsNullOrEmpty(_tab6Name))
            {
                if (String.IsNullOrEmpty(_tab6Webparts))
                {
                    _tab6Webparts = "Warning: No Value Specified.";
                }
                TabCommand.Append(',');
                TabCommand.Append('"' + _tab6Name);
                TabCommand.Append(';');
                TabCommand.Append('#' + (_tab6Webparts.Replace(", ", ",").Replace(",", ";#")) + '"');
            }
            if (!String.IsNullOrEmpty(_tab7Name))
            {
                if (String.IsNullOrEmpty(_tab7Webparts))
                {
                    _tab7Webparts = "Warning: No Value Specified.";
                }
                TabCommand.Append(',');
                TabCommand.Append('"' + _tab7Name);
                TabCommand.Append(';');
                TabCommand.Append('#' + (_tab7Webparts.Replace(", ", ",").Replace(",", ";#")) + '"');
            }
            if (!String.IsNullOrEmpty(_tab8Name))
            {
                if (String.IsNullOrEmpty(_tab8Webparts))
                {
                    _tab8Webparts = "Warning: No Value Specified.";
                }
                TabCommand.Append(',');
                TabCommand.Append('"' + _tab8Name);
                TabCommand.Append(';');
                TabCommand.Append('#' + (_tab8Webparts.Replace(", ", ",").Replace(",", ";#")) + '"');
            }
            if (!String.IsNullOrEmpty(_tab9Name))
            {
                if (String.IsNullOrEmpty(_tab9Webparts))
                {
                    _tab9Webparts = "Warning: No Value Specified.";
                }
                TabCommand.Append(',');
                TabCommand.Append('"' + _tab9Name);
                TabCommand.Append(';');
                TabCommand.Append('#' + (_tab9Webparts.Replace(", ", ",").Replace(",", ";#")) + '"');
            }
            if (!String.IsNullOrEmpty(_tab10Name))
            {
                if (String.IsNullOrEmpty(_tab10Webparts))
                {
                    _tab10Webparts = "Warning: No Value Specified.";
                }
                TabCommand.Append(',');
                TabCommand.Append('"' + _tab10Name);
                TabCommand.Append(';');
                TabCommand.Append('#' + (_tab10Webparts.Replace(", ", ",").Replace(",", ";#")) + '"');
            }


            // Create a new client script instance on the page.
            String scriptName = "Invoke_" + ID; // this needs to be unique, in order to support multiple instances per page.
            Type   scriptType = this.GetType();
            // Get a ClientScriptManager reference from the Page class.
            ClientScriptManager scriptInstance = Page.ClientScript;

            // Check to see if the script is already registered.
            if (!scriptInstance.IsStartupScriptRegistered(scriptType, scriptName))
            {
                StringBuilder scriptPayload = new StringBuilder();
                scriptPayload.Append("<script type=text/javascript>");
                scriptPayload.Append("var TabArray = [" + TabCommand + "];");
                scriptPayload.Append("jqueryTabs(TabArray);");
                scriptPayload.Append("</script>");
                scriptInstance.RegisterStartupScript(scriptType, scriptName, scriptPayload.ToString());
            }
        }
		protected override void RenderAttributes (HtmlTextWriter writer)
		{
#if NET_2_0
			CultureInfo inv = Helpers.InvariantCulture;
			string input_type = Type;
			if (0 != String.Compare (input_type, "reset", true, inv) &&
				((0 == String.Compare (input_type, "submit", true, inv)) ||
				(0 == String.Compare (input_type, "button", true, inv) && Events [ServerClickEvent] != null))) {

				string onclick = String.Empty;
				if (Attributes ["onclick"] != null) {
					onclick = ClientScriptManager.EnsureEndsWithSemicolon (Attributes ["onclick"] + onclick);
					Attributes.Remove ("onclick");
				}
				if (Page != null) {
					PostBackOptions options = GetPostBackOptions ();
					onclick += Page.ClientScript.GetPostBackEventReference (options, true);
				}

				if (onclick.Length > 0) {
					writer.WriteAttribute ("onclick", onclick, true);
					writer.WriteAttribute ("language", "javascript");
				}
			}
#else
			if (RenderOnClick ()) {
				string oc = null;
				ClientScriptManager csm = new ClientScriptManager (Page);
				if (Page.AreValidatorsUplevel ()) {
					oc = csm.GetClientValidationEvent ();
				} else if (Events [ServerClickEvent] != null) {
					oc = Attributes ["onclick"] + " " + csm.GetPostBackEventReference (this, "");
				}
				
				if (oc != null) {
					writer.WriteAttribute ("language", "javascript");
					writer.WriteAttribute ("onclick", oc, true);
				}
			}
#endif

			Attributes.Remove ("CausesValidation");
#if NET_2_0
			// LAMESPEC: MS doesn't actually remove this
			//attribute.  it shows up in the rendered
			//output.

			// Attributes.Remove("ValidationGroup");
#endif
			base.RenderAttributes (writer);
		}
Ejemplo n.º 11
0
		void CreateSideBar (TableCell sideBarCell)
		{
			RegisterApplyStyle (sideBarCell, SideBarStyle);

			if (SkipLinkText != "") {
				System.Web.UI.HtmlControls.HtmlAnchor anchor = new System.Web.UI.HtmlControls.HtmlAnchor ();
				anchor.HRef = "#" + ClientID + "_SkipLink";

				Image img = new Image ();
				ClientScriptManager csm = new ClientScriptManager (null);
				img.ImageUrl = csm.GetWebResourceUrl (typeof (SiteMapPath), "transparent.gif");
				img.Attributes.Add ("height", "0");
				img.Attributes.Add ("width", "0");
				img.AlternateText = SkipLinkText;

				anchor.Controls.Add (img);
				sideBarCell.Controls.Add (anchor);
			}

			if (sideBarTemplate != null) {
				sideBarTemplate.InstantiateIn (sideBarCell);
				stepDatalist = sideBarCell.FindControl (DataListID) as DataList;
				if (stepDatalist == null)
					throw new InvalidOperationException ("The side bar template must contain a DataList control with id '" + DataListID + "'.");
				stepDatalist.ItemDataBound += new DataListItemEventHandler(StepDatalistItemDataBound);
			} else {
				stepDatalist = new DataList ();
				stepDatalist.ID = DataListID;
				stepDatalist.SelectedItemStyle.Font.Bold = true;
				stepDatalist.ItemTemplate = SideBarItemTemplate;
				sideBarCell.Controls.Add (stepDatalist);
			}

			if (SkipLinkText != "") {
				System.Web.UI.HtmlControls.HtmlAnchor anchor = new System.Web.UI.HtmlControls.HtmlAnchor ();
				anchor.ID = "SkipLink";
				sideBarCell.Controls.Add (anchor);
			}

			stepDatalist.ItemCommand += new DataListCommandEventHandler (StepDatalistItemCommand);
			stepDatalist.CellSpacing = 0;
			stepDatalist.DataSource = WizardSteps;
			stepDatalist.SelectedIndex = ActiveStepIndex;
			stepDatalist.DataBind ();
		}
Ejemplo n.º 12
0
		public override void RenderBeginTag (HtmlTextWriter writer)
		{
			string skipLinkText = SkipLinkText;
			
			if (!String.IsNullOrEmpty (skipLinkText)) {
				writer.AddAttribute (HtmlTextWriterAttribute.Href, "#" + ClientID + "_SkipLink");
				writer.RenderBeginTag (HtmlTextWriterTag.A);

				Image img = new Image ();
				ClientScriptManager csm = new ClientScriptManager (null);
				img.ImageUrl = csm.GetWebResourceUrl (typeof (SiteMapPath), "transparent.gif");
				img.Attributes.Add ("height", "0");
				img.Attributes.Add ("width", "0");
				img.AlternateText = skipLinkText;
				img.Render (writer);

				writer.RenderEndTag ();
			}
			base.RenderBeginTag (writer);
		}
		protected override void RenderAttributes (HtmlTextWriter writer)
		{
#if NET_2_0
			if (Page != null)
				Page.ClientScript.RegisterForEventValidation (UniqueID);
			
			if (CausesValidation && Page != null && Page.AreValidatorsUplevel (ValidationGroup)) {
				ClientScriptManager csm = Page.ClientScript;
				Attributes ["onclick"] += csm.GetClientValidationEvent (ValidationGroup);
			}
#else		
			if (CausesValidation && Page != null && Page.AreValidatorsUplevel ()) {
				ClientScriptManager csm = new ClientScriptManager (Page);
				writer.WriteAttribute ("onclick", csm.GetClientValidationEvent ());
			}
#endif		

			PreProcessRelativeReference (writer,"src");
			base.RenderAttributes (writer);
		}
Ejemplo n.º 14
0
		protected override void AddAttributesToRender (HtmlTextWriter writer) {
			if (Page != null)
				Page.VerifyRenderingInServerForm (this);
			
#if NET_2_0
			writer.AddAttribute (HtmlTextWriterAttribute.Type, UseSubmitBehavior ? "submit" : "button", false);
			writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);
			writer.AddAttribute (HtmlTextWriterAttribute.Value, Text);

			string onclick = OnClientClick;
			onclick = ClientScriptManager.EnsureEndsWithSemicolon (onclick);
			if (HasAttributes && Attributes ["onclick"] != null) {
				onclick = ClientScriptManager.EnsureEndsWithSemicolon (onclick + Attributes ["onclick"]);
				Attributes.Remove ("onclick");
			}

			if (Page != null) {
				onclick += GetClientScriptEventReference ();
			}

			if (onclick.Length > 0)
				writer.AddAttribute (HtmlTextWriterAttribute.Onclick, onclick);
#else
			writer.AddAttribute (HtmlTextWriterAttribute.Type, "submit");
			writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);
			writer.AddAttribute (HtmlTextWriterAttribute.Value, Text);

			if (CausesValidation && Page != null && Page.AreValidatorsUplevel ()) {
				string onclick = Attributes["onclick"];
				if (onclick != null) {
					Attributes.Remove("onclick");
					int len = onclick.Length;
					if (len > 0 && onclick[len - 1] != ';')
						onclick += ";";
				}
				ClientScriptManager csm = new ClientScriptManager (Page);
				writer.AddAttribute (HtmlTextWriterAttribute.Onclick, onclick + csm.GetClientValidationEvent ());
				writer.AddAttribute ("language", "javascript");
			}
#endif

			base.AddAttributesToRender (writer);
		}
Ejemplo n.º 15
0
        protected void treeView_navigate_SelectedNodeChanged(object sender, EventArgs e)
        {   //更改内容区域显示的内容
            int selectedIndex = int.Parse(treeView_navigate.SelectedValue);

            if (selectedIndex < 10)
            {
                Contents.ActiveViewIndex = selectedIndex - 1;
                treeView_navigate.CollapseAll();
                treeView_navigate.SelectedNode.Expand();
            }
            else
            {
                Contents.ActiveViewIndex = selectedIndex / 10 - 1;
                if (Contents.ActiveViewIndex == 0)
                {
                }
                else if (Contents.ActiveViewIndex == 1)
                {
                }
                else if (Contents.ActiveViewIndex == 2)
                {
                    int leafIndex = selectedIndex % 10;
                    switch (leafIndex)
                    {
                    case 1:
                        state_global_chart.Style["display"]    = "";
                        plan_global_chart.Style["display"]     = "none";
                        resource_global_chart.Style["display"] = "none";
                        except_global_chart.Style["display"]   = "none";

                        state_global_ctrl.Style["display"]    = "";
                        plan_global_ctrl.Style["display"]     = "none";
                        resource_global_ctrl.Style["display"] = "none";
                        except_global_ctrl.Style["display"]   = "none";

                        state_area_chart.Style["display"]    = "";
                        plan_area_chart.Style["display"]     = "none";
                        resource_area_chart.Style["display"] = "none";
                        except_area_chart.Style["display"]   = "none";

                        state_area_ctrl.Style["display"]    = "";
                        plan_area_ctrl.Style["display"]     = "none";
                        resource_area_ctrl.Style["display"] = "none";
                        except_area_ctrl.Style["display"]   = "none";

                        ClientScriptManager clientScriptManagerA = Page.ClientScript;     //倒是顺便验证了后台执行SCRIPT的可行性 一失一得吧 看来无论如何登录信息都得用SESSION保存了
                        clientScriptManagerA.RegisterStartupScript(this.GetType(), "", "<script type=\"text/javascript\">loadChartFromXMLA();</script>");
                        break;

                    case 2:
                        state_global_chart.Style["display"]    = "none";
                        plan_global_chart.Style["display"]     = "";
                        resource_global_chart.Style["display"] = "none";
                        except_global_chart.Style["display"]   = "none";

                        state_global_ctrl.Style["display"]    = "none";
                        plan_global_ctrl.Style["display"]     = "";
                        resource_global_ctrl.Style["display"] = "none";
                        except_global_ctrl.Style["display"]   = "none";

                        state_area_chart.Style["display"]    = "none";
                        plan_area_chart.Style["display"]     = "";
                        resource_area_chart.Style["display"] = "none";
                        except_area_chart.Style["display"]   = "none";

                        state_area_ctrl.Style["display"]    = "none";
                        plan_area_ctrl.Style["display"]     = "";
                        resource_area_ctrl.Style["display"] = "none";
                        except_area_ctrl.Style["display"]   = "none";

                        ClientScriptManager clientScriptManagerB = Page.ClientScript;     //倒是顺便验证了后台执行SCRIPT的可行性 一失一得吧 看来无论如何登录信息都得用SESSION保存了
                        clientScriptManagerB.RegisterStartupScript(this.GetType(), "", "<script type=\"text/javascript\">loadChartFromXMLB();</script>");
                        break;

                    case 3:
                        state_global_chart.Style["display"]    = "none";
                        plan_global_chart.Style["display"]     = "none";
                        resource_global_chart.Style["display"] = "";
                        except_global_chart.Style["display"]   = "none";

                        state_global_ctrl.Style["display"]    = "none";
                        plan_global_ctrl.Style["display"]     = "none";
                        resource_global_ctrl.Style["display"] = "";
                        except_global_ctrl.Style["display"]   = "none";

                        state_area_chart.Style["display"]    = "none";
                        plan_area_chart.Style["display"]     = "none";
                        resource_area_chart.Style["display"] = "";
                        except_area_chart.Style["display"]   = "none";

                        state_area_ctrl.Style["display"]    = "none";
                        plan_area_ctrl.Style["display"]     = "none";
                        resource_area_ctrl.Style["display"] = "";
                        except_area_ctrl.Style["display"]   = "none";

                        ClientScriptManager clientScriptManagerC = Page.ClientScript;     //倒是顺便验证了后台执行SCRIPT的可行性 一失一得吧 看来无论如何登录信息都得用SESSION保存了
                        clientScriptManagerC.RegisterStartupScript(this.GetType(), "", "<script type=\"text/javascript\">loadChartFromXMLC();</script>");
                        break;

                    case 4:
                        state_global_chart.Style["display"]    = "none";
                        plan_global_chart.Style["display"]     = "none";
                        resource_global_chart.Style["display"] = "none";
                        except_global_chart.Style["display"]   = "";

                        state_global_ctrl.Style["display"]    = "none";
                        plan_global_ctrl.Style["display"]     = "none";
                        resource_global_ctrl.Style["display"] = "none";
                        except_global_ctrl.Style["display"]   = "";

                        state_area_chart.Style["display"]    = "none";
                        plan_area_chart.Style["display"]     = "none";
                        resource_area_chart.Style["display"] = "none";
                        except_area_chart.Style["display"]   = "";

                        state_area_ctrl.Style["display"]    = "none";
                        plan_area_ctrl.Style["display"]     = "none";
                        resource_area_ctrl.Style["display"] = "none";
                        except_area_ctrl.Style["display"]   = "";
                        break;

                    default:
                        break;
                    }
                }
            }
        }
Ejemplo n.º 16
0
        protected void BtnSearch_Click(object sender, EventArgs e)
        {
            if (txtProcessDate.Text == string.Empty)
            {
                String csname1         = "PopupScript";
                Type   cstype          = GetType();
                ClientScriptManager cs = Page.ClientScript;

                if (!cs.IsStartupScriptRegistered(cstype, csname1))
                {
                    String cstext1 = "alert('Please insert date!');";
                    cs.RegisterStartupScript(cstype, csname1, cstext1, true);
                }
                txtProcessDate.Focus();
                return;
            }
            string monthnum = "";
            string filename = "";
            string cashcode = "";
            string Month    = "";
            string year     = "";
            string day      = "";
            string FullDate = "";

            for (int i = 0; i < listfile.Items.Count; i++)
            {
                filename = listfile.Items[i].Text;
                cashcode = filename.Substring(1, 8);
                Month    = filename.Substring(9, 3);
                #region MonthNumber
                if (Month == "JAN")
                {
                    monthnum = "01";
                }
                if (Month == "FEB")
                {
                    monthnum = "02";
                }
                if (Month == "MAR")
                {
                    monthnum = "03";
                }
                if (Month == "APR")
                {
                    monthnum = "04";
                }
                if (Month == "MAY")
                {
                    monthnum = "05";
                }
                if (Month == "JUN")
                {
                    monthnum = "06";
                }
                if (Month == "JUL")
                {
                    monthnum = "07";
                }
                if (Month == "AUG")
                {
                    monthnum = "08";
                }
                if (Month == "SEP")
                {
                    monthnum = "09";
                }
                if (Month == "OCT")
                {
                    monthnum = "10";
                }
                if (Month == "NOV")
                {
                    monthnum = "11";
                }
                if (Month == "DEC")
                {
                    monthnum = "12";
                }
                #endregion
                year = filename.Substring(12, 4);
                day  = filename.Substring(16, 2);

                FullDate = day + "/" + monthnum + "/" + year;
                string procdate = Converter.GetString(txtProcessDate.Text);
                if (FullDate == procdate)
                {
                    string find = "B" + cashcode + Month + year + day + ".DAT";
                    chklist.Items.Add(find);

                    BtnUpload.Visible = true;
                }
            }
        }
Ejemplo n.º 17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Register the client side script.
        ClientScriptManager csManager = Page.ClientScript;
        Type   type    = this.GetType();
        string newLine = Environment.NewLine;

        if (!csManager.IsClientScriptBlockRegistered(type, "BodyLoadScript"))
        {
            StringBuilder csText = new StringBuilder();
            csText.Append("<script type=\"text/javascript\">" + newLine);
            csText.Append("<!--" + newLine);
            csText.Append("function onBodyLoad() {" + newLine);
            csText.Append("    var allInputTags = document.getElementsByTagName(\"input\");" + newLine);
            csText.Append("    var msg = \"\";" + newLine);
            csText.Append("    var conformation;" + newLine);
            csText.Append("    for(i = 0; i < allInputTags.length; i++) {" + newLine);
            csText.Append("        if(allInputTags[i].type == \"hidden\") {" + newLine);
            csText.Append("            if(allInputTags[i].name.indexOf(\"DeleteMessageHiddenField\") >= 0)" + newLine);
            csText.Append("                msg = allInputTags[i].value;" + newLine);
            csText.Append("            else if(allInputTags[i].name.indexOf(\"DeleteConformationHiddenField\") >= 0)" + newLine);
            csText.Append("                conformation = allInputTags[i];" + newLine);
            csText.Append("        }" + newLine);
            csText.Append("    } " + newLine);
            csText.Append("    if (msg != \"\") {" + newLine);
            csText.Append("        if (confirm(msg))" + newLine);
            csText.Append("            conformation.value = \"true\";" + newLine);
            csText.Append("        else" + newLine);
            csText.Append("            conformation.value = \"false\";" + newLine);
            csText.Append("        document.forms[0].submit();" + newLine);
            csText.Append("    }" + newLine);
            csText.Append("}" + newLine);
            csText.Append("document.body.onload = onBodyLoad;" + newLine);
            csText.Append("// -->" + newLine);
            csText.Append("</script>");
            csManager.RegisterClientScriptBlock(type, "BodyLoadScript", csText.ToString(), false);
        }

        if (!IsPostBack)
        {
            DeleteMessageHiddenField.Value      = "";
            DeleteConformationHiddenField.Value = "";
            DeleteContactIdHiddenField.Value    = "";
            try
            {
                // Get the common web service instance.
                ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
                FarmService.FarmService farmService   = serviceLoader.GetFarm();
                SearchCriteriaPane.Visible = true;
                SearchResultPane.Visible   = false;
                if (IsAgentRole)
                {
                    AgentListPanel.Visible          = false;
                    FarmDropDownList.DataSource     = farmService.GetFarmListForUser(GetAgentId());
                    FarmDropDownList.DataValueField = "FarmId";
                    FarmDropDownList.DataTextField  = "FarmName";
                    FarmDropDownList.DataBind();
                    FarmDropDownList.Items.Insert(0, new ListItem("All Farms", "0"));
                    PlotDropDownList.Items.Add(new ListItem("All Plots", "0"));
                }
                else
                {
                    AgentListPanel.Visible     = true;
                    SearchCriteriaPane.Visible = false;
                    CommonService commonService = serviceLoader.GetCommon();
                    AgentListDropDownList.DataSource     = commonService.GetAgentsList();
                    AgentListDropDownList.DataValueField = "UserId";
                    AgentListDropDownList.DataTextField  = "UserName";
                    AgentListDropDownList.DataBind();
                    AgentListDropDownList.Items.Insert(0, "Select an Agent");
                }
                ResultCountLiteral.Text = "Search for the Farm Contacts";
                if ((Request.QueryString["accessType"] != "") && (Request.QueryString["accessType"] != null) && (Request.QueryString["accessType"] == "old"))
                {
                    if (Session["SearchFarmDataWhere"] != null)
                    {
                        string where = Session["SearchFarmDataWhere"].ToString();
                        int pageIndex = 1;
                        if (Session["SearchFarmDataPageIndex"] != null)
                        {
                            pageIndex = int.Parse(Session["SearchFarmDataPageIndex"].ToString());
                        }

                        FarmService.FarmDetailsReportInfo[] farms = farmService.GetSearchFarmData(where);
                        SearchFarmResultGridView.DataSource = farms;
                        SearchFarmResultGridView.PageIndex  = pageIndex;
                        SearchFarmResultGridView.DataBind();

                        //Disable actions on deleted Contacts
                        for (int i = 0; i < SearchFarmResultGridView.Rows.Count; i++)
                        {
                            if (farms[SearchFarmResultGridView.Rows[i].DataItemIndex].Deleted)
                            {
                                SearchFarmResultGridView.Rows[i].Cells[1].Enabled = false;
                            }
                        }

                        if (IsPrinterRole)
                        {
                            SearchFarmResultGridView.Columns[0].Visible = false;
                            SearchFarmResultGridView.Columns[1].Visible = false;
                            DeleteButton.Visible = false;
                        }

                        SearchCriteriaPane.Visible = false;
                        SearchResultPane.Visible   = true;
                        ResultCountLiteral.Text    = "Farm data results - " + farms.Length + " Contacts found.";
                        if (!IsAgentRole)
                        {
                            AgentListPanel.Visible = false;
                            if (where.Contains("TBL_FARM.User_Id = "))
                            {
                                int startPos = where.IndexOf("TBL_FARM.User_Id = ") + "TBL_FARM.User_Id = ".Length;
                                int endPos   = where.IndexOf(" AND ");
                                endPos = endPos - startPos;
                                string agentid = where.Substring(startPos, endPos);
                                for (int i = 0; i < AgentListDropDownList.Items.Count; i++)
                                {
                                    if (AgentListDropDownList.Items[i].Value.ToString().Equals(agentid))
                                    {
                                        AgentListDropDownList.SelectedIndex = i;
                                    }
                                }
                                ForAgentLiteral.Text = AgentListDropDownList.SelectedValue + " / " + AgentListDropDownList.SelectedItem.Text;
                            }
                        }
                        MessageLiteral.Text = "";
                    }
                }
            }
            catch (Exception exception)
            {
                log.Error("UNKNOWN ERROR WHILE LOADING SEARCH FARM:", exception);
                ErrorLiteral.Text = "UNKNOWN ERROR: Please Contact Administrator";
            }
        }
        else
        {
            if ((!DeleteMessageHiddenField.Value.ToString().Equals("")) && (DeleteConformationHiddenField.Value.ToString().Equals("true")))
            {
                // List of Contacts to be deleted
                List <Int64> contactIdList = new List <Int64>();
                for (int i = 0; i < SearchFarmResultGridView.Rows.Count; i++)
                {
                    GridViewRow row       = SearchFarmResultGridView.Rows[i];
                    bool        isChecked = ((CheckBox)row.FindControl("SelectContactCheckBox")).Checked;

                    if (isChecked)
                    {
                        Int64 temp = Int64.Parse(((CheckBox)row.FindControl("SelectContactCheckBox")).ToolTip);
                        contactIdList.Add(temp);
                    }
                }

                try
                {
                    // Get the common web service instance.

                    ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
                    FarmService.FarmService farmService   = serviceLoader.GetFarm();
                    for (int j = 0; j < contactIdList.Count; j++)
                    {
                        farmService.DeleteContact(contactIdList[j], LoginUserId);
                    }
                    MessageLiteral.Text = "Selected Contacts have been Deleted";
                    int CurrentPageIndex = SearchFarmResultGridView.PageIndex;

                    string where = GenerateSearchCondition();
                    FarmService.FarmDetailsReportInfo[] farms = farmService.GetSearchFarmData(where);
                    SearchFarmResultGridView.DataSource = farms;
                    SearchFarmResultGridView.PageIndex  = CurrentPageIndex;
                    SearchFarmResultGridView.DataBind();

                    //Disable actions on deleted Contacts
                    for (int k = 0; k < SearchFarmResultGridView.Rows.Count; k++)
                    {
                        if (farms[SearchFarmResultGridView.Rows[k].DataItemIndex].Deleted)
                        {
                            SearchFarmResultGridView.Rows[k].Cells[1].Enabled = false;
                        }
                    }

                    ResultCountLiteral.Text = "Found " + farms.Length + " matching records.";
                }
                catch (Exception exception)
                {
                    log.Error("UNKNOWN ERROR WHILE DELECTING CONATACTS:", exception);
                    MessageLiteral.Text = "UNKNOWN ERROR : Please Contact Administrator";
                }
            }
            DeleteMessageHiddenField.Value      = "";
            DeleteConformationHiddenField.Value = "";
            DeleteContactIdHiddenField.Value    = "";
        }
    }
Ejemplo n.º 18
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string RequestType  = flag.Text.ToString().Trim();
        string RequestTable = xc.SafeChar(Request["fTable"].Trim());
        string UpFileReturnStr;
        string insertIframeCode = string.Empty;
        string fileName         = uploadfile.FileName;

        if (RequestType.Equals("Img"))
        {
            if (WaterMark.Checked)
            {
                UpFileReturnStr = xc.UploadFile(uploadfile, RequestType, true);
            }
            else
            {
                UpFileReturnStr = xc.UploadFile(uploadfile, RequestType, false);
            }
        }
        else
        {
            UpFileReturnStr = xc.UploadFile(uploadfile, RequestType, false);
        }

        if (UpFileReturnStr.Equals("上传成功"))
        {
            //插入数据库
            string insertName = Session["NewFile"].ToString();

            string dimStr = "@fileID,@fileFlag,@fileTable,@fileName,@PostDate,@AdminIP,@AdminID";

            string[] strValue = new string[7];
            strValue[0] = Session["upFileID"].ToString(); //上传图片文件名ID关联"
            strValue[1] = RequestType;
            strValue[2] = RequestTable;
            strValue[3] = insertName;
            strValue[4] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            strValue[5] = xc.GetIP();
            strValue[6] = xc.adminID;

            if (db.InsertUpdateDB("upFileName", dimStr, strValue, string.Empty).Equals("发布成功"))
            {
                UpFileReturnStr += " OK!";
            }
            else
            {
                UpFileReturnStr += " NO!";
            }

            switch (RequestType)
            {
            case "Img":
                insertIframeCode = @"<p><img alt='' src='" + xc.UploadFolder + insertName.Substring(5, 8) + "/" + insertName + "' /></p>";
                break;

            case "Flash":
                insertIframeCode = "<p><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'><param name='quality' value='high' /><param name='movie' value='" + xc.UploadFolder + insertName.Substring(5, 8) + "/" + insertName + "' /><embed pluginspage='http://www.macromedia.com/go/getflashplayer' quality='high' src='" + xc.UploadFolder + insertName.Substring(5, 8) + "/" + insertName + "' type='application/x-shockwave-flash'></embed></object></p>";
                break;

            default:
                insertIframeCode = "<a target='_blank' href=" + xc.UploadFolder + insertName.Substring(5, 8) + "/" + insertName + ">" + insertName + "</a>";
                break;
            }
            insertIframeCode = insertIframeCode + "<p>&nbsp;</p>";

            ClientScriptManager cs = Page.ClientScript;
            cs.RegisterClientScriptBlock(this.GetType(), "ClientScriptBlock", "<script>parent.CKEDITOR.instances.txtContent.insertHtml(\"" + insertIframeCode + "\");</script>");

            lblinfo.Text = uploadfile.FileName.ToString() + "&nbsp;" + UpFileReturnStr;

            if (RequestType.Equals("Img"))
            {
                indexPicSet.Items.Add(new ListItem(insertName, insertName));
                preImage.Visible  = true;   //预览图
                delPreImg.Visible = true;   //删除图片
                preImage.ImageUrl = xc.UploadFolder.ToString() + insertName.Substring(5, 8) + "/" + insertName;
            }
        }
        else
        {
            lblinfo.Text = UpFileReturnStr;
        }
    }
Ejemplo n.º 19
0
        protected void BtnOkay_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtFixedDepositAmount.Text == string.Empty && hdnlblcls.Value == "3")
                {
                    txtFixedDepositAmount.Focus();

                    String csname1         = "PopupScript";
                    Type   cstype          = GetType();
                    ClientScriptManager cs = Page.ClientScript;

                    if (!cs.IsStartupScriptRegistered(cstype, csname1))
                    {
                        String cstext1 = "alert('Please Input Fixed Deposit Amount' );";
                        cs.RegisterStartupScript(cstype, csname1, cstext1, true);
                    }
                    return;
                }
                if (txtPeriod.Text == string.Empty && hdnlblcls.Value == "2")
                {
                    txtPeriod.Focus();

                    String csname1         = "PopupScript";
                    Type   cstype          = GetType();
                    ClientScriptManager cs = Page.ClientScript;

                    if (!cs.IsStartupScriptRegistered(cstype, csname1))
                    {
                        String cstext1 = "alert('Please Input Period' );";
                        cs.RegisterStartupScript(cstype, csname1, cstext1, true);
                    }
                    return;
                }


                Session["AccFlag"] = "1";

                Session["RTranDate"] = hdnTranDate.Value;
                Session["RFuncOpt"]  = hdnFunc.Value;
                Session["RModule"]   = hdnModule.Value;
                Session["RVchNo"]    = hdnVchNo.Value;

                Session["RCUNo"] = hdnCuNo.Value;

                Session["RCType"]  = hdnCType.Value;
                Session["RCNo"]    = hdnCNo.Value;
                Session["RCuName"] = hdnCuName.Value;

                Session["RNewMemNo"]   = hdnNewMemberNo.Value;
                Session["RNewMemName"] = hdnNewMemberName.Value;

                Session["RGLCashCode"] = hdnGLCashCode.Value;

                Session["RTrnCode"] = hdnTrnCode.Value;

                Session["RAccType"] = hdnAccType.Value;
                Session["Rlblcls"]  = hdnlblcls.Value;

                Session["RPeriod"]       = txtPeriod.Text;
                Session["RIntRate"]      = txtIntRate.Text;
                Session["RMaturityDate"] = txtMaturityDate.Text;
                Session["RMaturityAmt"]  = CtrlMatureAmt.Text;

                Session["RFixedDepAmt"] = txtFixedDepositAmount.Text;
                Session["RFixedMthInt"] = txtFixedMthInt.Text;
                Session["RBenefitDate"] = CtrlBenefitDate.Text;

                if (ChkContraInt.Checked == true)
                {
                    Session["RContractInt"] = "1";
                }
                else
                {
                    Session["RContractInt"] = "0";
                }

                Page.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script language=javascript>window.opener.location.href='CSDailyBoothTransaction.aspx';self.close();</script>");
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "scriptkey", "<script>alert('System Error.BtnOkay_Click Problem');</script>");
                //throw ex;
            }
        }
Ejemplo n.º 20
0
    protected void DV_FotoPerfil_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        ClientScriptManager cm = this.ClientScript;

        DataTable foto;

        FileUpload b = (FileUpload)DV_FotoPerfil.Rows[e.RowIndex].FindControl("FileUpload1");

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

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

        if (foto.Rows.Count == 1)
        {
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('No se pueden agregar más fotos');</script>");
            return;
        }

        string nombreArchivo = System.IO.Path.GetFileName(b.PostedFile.FileName);
        string extension     = System.IO.Path.GetExtension(b.PostedFile.FileName);

        if (!(string.Compare(extension, ".jpg", true) == 0 || string.Compare(extension, ".jpeg", true) == 0 || string.Compare(extension, ".gif", true) == 0 || string.Compare(extension, ".jpe", true) == 0))
        {
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Solo se admiten Imagenes');</script>");
            return;
        }

        int tamano = b.PostedFile.ContentLength;

        if (b.PostedFile.ContentLength > (1024 * 1024 * 4))
        {
            double tamanoMb = (double)((double)tamano / ((double)1024 * 1024));
            cm.RegisterClientScriptBlock(this.GetType(), "", string.Format("<script type='text/javascript'>alert('No se pueden agregar archivos adjuntos de más de 4 Megabytes. Tamaño del archivo: {0:F1}MB');</script>", tamanoMb));
            return;
        }

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

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

        try
        {
            b.PostedFile.SaveAs(saveLocation);
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('El archivo adjunto ha sido cargado');</script>");
        }
        catch (Exception exc)
        {
            cm.RegisterClientScriptBlock(this.GetType(), "", string.Format("<script type='text/javascript'>alert('Error: {0}');</script>", exc.Message));
            return;
        }

        DatosUsuario user = new DatosUsuario();
        // user.Url = DV_FotoPerfil.DataKeys[e.RowIndex].Value.ToString();
        // user.Nombre = DV_FotoPerfil.DataKeys[e.RowIndex].Value.ToString();
        FileUpload a = (FileUpload)DV_FotoPerfil.Rows[e.RowIndex].FindControl("FileUpload1");

        user.Url     = "~\\Imagenes\\" + nombreArchivo;
        user.Id_user = int.Parse(_id_user.ToString());

        Usuario userDatos = new Usuario();

        userDatos.modificarImgPerfil(user);

        DV_FotoPerfil.EditIndex = -1;

        Usuario asp = new Usuario();

        asp.obtenerDatosEdit(_id_user);
        DV_FotoPerfil.DataSource = asp.obtenerDatosEdit(_id_user);
        DV_FotoPerfil.DataBind();

        this.RegisterStartupScript("mensaje", "<script type='text/javascript'>alert('Los Datos se han actualizado!');window.location=\"Perfil.aspx\"</script>");
    }
Ejemplo n.º 21
0
    protected void button_enviar(object sender, EventArgs e)
    {
        ClientScriptManager cm = this.ClientScript;

        E_candidato user  = new E_candidato();
        E_conteo    user2 = new E_conteo();
        //-//
        string cedula = Page.Request.Form["cedula"].ToString();
        //-//
        int largoCedula = cedula.Length;

        if (largoCedula < 5 || largoCedula > 10)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('El tamaño de la cédula es inconsistente');window.open('add_candidato.aspx','_self');", true);
        }
        else
        {
            int  validate_cedula = 0;
            bool comprobation    = int.TryParse(cedula, out validate_cedula);
            if (comprobation == true)
            {
                E_candidato checkCandidato = new DAO_User().GetCandidatoCheck(cedula);
                if (checkCandidato == null)
                {
                    //ClientScriptManager cm = this.ClientScript;
                    //E_candidato user = new E_candidato();
                    //E_conteo user2 = new E_conteo();
                    //string cedula = Page.Request.Form["cedula"].ToString();

                    string fileName     = System.IO.Path.GetFileName(Foto_Candidato.PostedFile.FileName);
                    string extension    = System.IO.Path.GetExtension(Foto_Candidato.PostedFile.FileName);
                    string saveLocation = "~/Util_Support/Perfil_Fotos/" + DateTime.Now.ToFileTime().ToString() + extension;
                    //Foto_Candidato.PostedFile.SaveAs(Server.MapPath(saveLocation));

                    string user_name = Page.Request.Form["name"].ToString();
                    if (string.IsNullOrEmpty(user_name))
                    {
                        //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ingrese el nombre');</script>");
                        Response.Write("<script>alert('Ingrese el nombre')</script>");
                    }
                    else
                    {
                        user.Nombre  = user_name;
                        user2.Nombre = user_name;
                    }

                    string user_lastname = Page.Request.Form["lastname"].ToString();
                    if (string.IsNullOrEmpty(user_lastname))
                    {
                        cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ingrese el apellido');</script>");
                    }
                    else
                    {
                        user.Apellido  = user_lastname;
                        user2.Apellido = user_lastname;
                    }

                    string user_partido = Page.Request.Form["partido"].ToString();
                    if (string.IsNullOrEmpty(user_partido))
                    {
                        cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Digite su email');</script>");
                    }
                    else
                    {
                        user.Partido  = user_partido;
                        user2.Partido = user_partido;
                    }

                    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 (Foto_Candidato.PostedFile.ContentLength >= 15000000)
                    {
                        cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Tamaño maximo de 15mb');</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
                    {
                        Foto_Candidato.PostedFile.SaveAs(Server.MapPath(saveLocation));
                        cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('El archivo ha sido cargado');</script>");
                        user.Foto = saveLocation;
                    }
                    catch (Exception exc)
                    {
                        cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Error: ');</script>");
                        return;
                    }

                    try
                    {
                        if (user.Foto == " ")
                        {
                            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('No ha subido ninguna foto');</script>");
                            user.Foto = Server.MapPath("~\\Util_Support\\Perfil_Fotos\\default_profile.jpg");
                            return;
                        }
                    }
                    catch (NullReferenceException)
                    {
                    }

                    user.Cc       = cedula;
                    user2.N_votos = 0;

                    new DAO_User().save_candidatos(user);
                    new DAO_User().conteo_add(user2);

                    ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('El candidato ha sido registrado con exito');window.open('admin_menu.aspx','_self');", true);
                    //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ha funcionado');</script>");
                    //Response.Redirect("~/View/admin_menu.aspx");
                }
                else if (checkCandidato.Cc == cedula)
                {
                    cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Es candidato ya existe');</script>");
                }
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Digite su cedula');window.open('add_candidato.aspx','_self');", true);
                //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Digite su cedula');</script>");
                //Response.Redirect("~/View/admin_menu.aspx");
            }
        }
    }
Ejemplo n.º 22
0
    protected void btn_submit_Click(object sender, EventArgs e)
    {
        if (mode == "edit")
        {
            //update existing request data

            #region Request

            //1. update request
            process_req_row.projectid    = Convert.ToInt64(ddl_project.SelectedValue);
            process_req_row.analysistype = ddl_typeanalysis.SelectedValue;
            process_req_row.reqtype      = ddl_typerequest.SelectedValue;
            process_req_row.responsible  = ddl_lead.SelectedValue;
            process_req_row.statusid     = 2;
            process_req_row.req_cmnt     = tb_addinfo.Text;
            requests.update_Request(process_req_row);

            #endregion

            #region Samples

            //2. update sample values
            int tab_no = 1;
            AjaxControlToolkit.TabContainer container = (AjaxControlToolkit.TabContainer)TabContainer1;
            foreach (object obj in container.Controls)
            {
                if (obj is AjaxControlToolkit.TabPanel)
                {
                    AjaxControlToolkit.TabPanel tabPanel = (AjaxControlToolkit.TabPanel)obj;
                    {
                        GridView gv   = ((GridView)(tabPanel.FindControl("GridView" + tab_no.ToString())));
                        int      cols = gv.Columns.Count;
                        for (int i_col = 2; i_col < cols; i_col++)
                        {
                            int    sampleno = Convert.ToInt32(gv.Columns[i_col].HeaderText.Substring(6));
                            string sampleid = String.Concat(process_reqid, sampleno.ToString("00"));

                            //insert a row in req_samples table

                            String value = "";
                            int    propertyid;
                            foreach (GridViewRow gvr in gv.Rows)
                            {
                                if (gvr.RowType == DataControlRowType.DataRow)
                                {
                                    propertyid = Convert.ToInt32(gvr.Cells[0].Text);
                                    if (gvr.RowIndex != 11)
                                    {
                                        value = ((TextBox)(gvr.Cells[i_col].Controls[1])).Text;
                                    }
                                    else
                                    {
                                        value = ((DropDownList)(gvr.Cells[i_col].Controls[5])).SelectedValue;
                                    }

                                    //update a row in sample_pvalue table
                                    sample_pvalue.updateSample_Pvalue(sampleid, propertyid, value);
                                }
                            }
                        }
                    }
                    tab_no++;
                }
            }
            #endregion

            #region Tests

            foreach (GridViewRow gvr in gv_tests.Rows)
            {
                if (gvr.RowType == DataControlRowType.DataRow)
                {
                    long   test_id   = Convert.ToInt64(gv_tests.DataKeys[gvr.RowIndex].Value);
                    string testname  = ((TextBox)gvr.FindControl("tb_testname")).Text;
                    string reference = ((DropDownList)gvr.FindControl("dd_specification")).SelectedValue;
                    string standard  = ((TextBox)gvr.FindControl("tb_standard")).Text;
                    string unit      = ((TextBox)gvr.FindControl("tb_unit")).Text;

                    //Update Test Details in req_tests table
                    req_tests.update_Req_Tests(testname, reference, standard, unit, test_id);
                }
            }
            #endregion

            #region Test_Samples

            if (!is_test_sample_selected())
            {
                string errorText       = "You have not selected the samples for all tests. You should select at least one sample for each test.";
                ClientScriptManager cs = Page.ClientScript;
                cs.RegisterStartupScript(this.GetType(), "error", "<script>alert('" + errorText + "');</script>");
            }
            else if (gv_test_sample.EditIndex == -1)
            {
                dt_test_sample = (DataTable)Session["dt_test_sample"];
                foreach (DataRow dr in dt_test_sample.Rows)
                {
                    long test_id = Convert.ToInt64(dr["test_id"]);
                    for (int no = 3; no <= dt_test_sample.Columns.Count - 1; no++)
                    {
                        bool   isselected = Convert.ToBoolean(dr[no]);
                        string sampleid   = process_reqid + (no - 2).ToString("00");
                        //update test_sample
                        test_samples.updateTest_Sample(test_id, sampleid, isselected);
                    }
                }

                //redirect
                string url = "home.aspx";
                ClientScript.RegisterStartupScript(this.GetType(), "callfunction", "alert('Updated Request Submitted Successfully.');window.location.href = '" + url + "';", true);
            }
            else
            {
                string errorText       = "Error: Selection of Samples for Test is not correct. Please ensure you have selected samples for each test.";
                ClientScriptManager cs = Page.ClientScript;
                cs.RegisterStartupScript(this.GetType(), "error", "<script>alert('" + errorText + "');</script>");
            }
            #endregion

            //mail
            do_mail(mode, process_req_row.reqid);
        }
        else if (mode == "copy")
        {
            if (!is_test_sample_selected())
            {
                string errorText       = "You have not selected the samples for all tests. You should select at least one sample for each test.";
                ClientScriptManager cs = Page.ClientScript;
                cs.RegisterStartupScript(this.GetType(), "error", "<script>alert('" + errorText + "');</script>");
            }
            else if (gv_test_sample.EditIndex == -1)
            {
                //insert new request data

                #region Request

                string new_reqid = requests.get_new_reqid();
                //Insert Request Details + add info
                requests.insert_request(new_reqid, Convert.ToInt64(ddl_project.SelectedValue), ddl_typeanalysis.SelectedValue, ddl_typerequest.SelectedValue, userid, ddl_lead.SelectedValue, ddl_lead.SelectedValue, null, 2, tb_addinfo.Text);

                #endregion

                #region Samples

                int tab_no = 1;
                AjaxControlToolkit.TabContainer container = (AjaxControlToolkit.TabContainer)TabContainer1;
                foreach (object obj in container.Controls)
                {
                    if (obj is AjaxControlToolkit.TabPanel)
                    {
                        AjaxControlToolkit.TabPanel tabPanel = (AjaxControlToolkit.TabPanel)obj;
                        {
                            GridView gv   = ((GridView)(tabPanel.FindControl("GridView" + tab_no.ToString())));
                            int      cols = gv.Columns.Count;
                            for (int i_col = 2; i_col < cols; i_col++)
                            {
                                int    sampleno = Convert.ToInt32(gv.Columns[i_col].HeaderText.Substring(6));
                                string sampleid = String.Concat(new_reqid, sampleno.ToString("00"));

                                //insert a row in req_samples table
                                req_samples.insert_Req_Samples(sampleid, new_reqid, sampleno, true);

                                String value = "";
                                int    propertyid;
                                foreach (GridViewRow gvr in gv.Rows)
                                {
                                    if (gvr.RowType == DataControlRowType.DataRow)
                                    {
                                        propertyid = Convert.ToInt32(gvr.Cells[0].Text);
                                        if (gvr.RowIndex != 11)
                                        {
                                            value = ((TextBox)(gvr.Cells[i_col].Controls[1])).Text;
                                        }
                                        else
                                        {
                                            value = ((DropDownList)(gvr.Cells[i_col].Controls[5])).SelectedValue;
                                        }

                                        //insert a row in sample_pvalue table
                                        sample_pvalue.insertSample_Pvalue(sampleid, propertyid, value);
                                    }
                                }
                            }
                        }
                        tab_no++;
                    }
                }
                #endregion

                #region Tests

                foreach (GridViewRow gvr in gv_tests.Rows)
                {
                    if (gvr.RowType == DataControlRowType.DataRow)
                    {
                        string testname  = ((TextBox)gvr.FindControl("tb_testname")).Text;
                        string reference = ((DropDownList)gvr.FindControl("dd_specification")).SelectedValue;
                        string standard  = ((TextBox)gvr.FindControl("tb_standard")).Text;
                        string unit      = ((TextBox)gvr.FindControl("tb_unit")).Text;

                        //Insert Test Details in req_tests table
                        long?test_id = req_tests.insert_Req_Tests(new_reqid, testname, reference, standard, unit);
                        if (test_id.HasValue)
                        {
                            #region Test-Samples

                            dt_test_sample = (DataTable)Session["dt_test_sample"];
                            for (int no = 3; no <= dt_test_sample.Columns.Count - 1; no++)
                            {
                                //in copy request "dt_test_sample" has one extra column named test_id
                                bool   isselected = Convert.ToBoolean(dt_test_sample.Rows[gvr.RowIndex][no]);
                                string sampleid   = new_reqid + (no - 2).ToString("00");
                                //Insert Test-Samples Selected in test_samples table
                                test_samples.insertTest_Sample(test_id, sampleid, isselected);
                            }
                            #endregion
                        }
                    }
                }
                #endregion

                //mail
                do_mail(mode, new_reqid);

                //redirect
                string url = "home.aspx";
                ClientScript.RegisterStartupScript(this.GetType(), "callfunction", "alert('Request Submitted Successfully.');window.location.href = '" + url + "';", true);
            }
            else
            {
                string errorText       = "You have not selected the samples for tests appropriately. You should select at least one sample for each test.";
                ClientScriptManager cs = Page.ClientScript;
                cs.RegisterStartupScript(this.GetType(), "error", "<script>alert('" + errorText + "');</script>");
            }
        }
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["PatientId"] = 0;

            //(Master.FindControl("lblheader") as Label).Text = "Configure Custom Fields";
            //(Master.FindControl("lblMark") as Label).Visible = false;
            (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblRoot") as Label).Visible = false;
            (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblheader") as Label).Text = "Configure Custom Fields";
            ICustomFields CustomFields;

            // CODE TO IMPLEMENT CLIENT CALL BACK METHODS  -- START
            //rbtnselect.Attributes.Add("onClick", "javaScript:return SendCodeName();");
            //rbtnmulti.Attributes.Add("onClick", "javaScript:return SendCodeName();");

            ClientScriptManager m = Page.ClientScript;
            str = m.GetCallbackEventReference(this, "args", "ReceiveServerData", "'this is context from server'");
            strCallback = "function CallServer(args,context){" + str + ";}";

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "CallServer", strCallback, true);

            // CODE TO IMPLEMENT CLIENT CALL BACK METHODS  -- FINISH

            try
            {
                if (!IsPostBack)
                {
                    FillDropDownFeatures();

                    CustomFields = (ICustomFields)ObjectFactory.CreateInstance("BusinessProcess.Administration.BCustomFields, BusinessProcess.Administration");
                    DataSet theDS = CustomFields.GetCustomFields(Convert.ToInt32(Session["SystemId"].ToString()));
                    this.grdCustomfields.DataSource = theDS.Tables[0];
                    this.grdCustomfields.DataBind();
                    if (ViewState["grdDataSource"] == null)
                        ViewState["grdDataSource"] = theDS.Tables[0];
                    ViewState["SortDirection"] = "Desc";
                    BindGrid();
                    ViewState["temptable"] = theDS.Tables[0];
                }
                else
                {
                    if ((DataTable)Session["AddCustomList"] != null)
                    {
                        DataTable theDT = (DataTable)Session["AddCustomList"];
                        //Application.Remove("AddCustomList");
                        ViewState["CustomList"] = theDT;
                    }
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareMsgBox.Show("#C1", theBuilder, this);
                return;
            }
            finally
            {
                CustomFields = null;
            }

            txtmin.Attributes.Add("onkeypress", "return CheckNumericValue(event);");
            txtmax.Attributes.Add("onKeypress", "return CheckNumericValue(event);");
            txtflabel.Attributes.Add("onkeypress", "return CheckAlphaNumeric(event);");
            txtfdesc.Attributes.Add("onkeypress", "return CheckAlpha(event);");
            txtflabel.Attributes.Add("onBlur", "CheckAlphaFirstLetter();");
        }
Ejemplo n.º 24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // ポストバック時、回答画面の戻り以外はリターン

            if (IsPostBack == true)
            {
                // 回答更新後のリフレッシュ
                if (hdSubmit.Value == "1")
                {
                    DispDataGet();  // 画面表示データ取得処理
                }
                return;
            }

            CommonLogic bcom = new CommonLogic();

            try
            {
                String[] strArrayData;

                pnlFollowAnswer.Visible = false;

                String paraEventCode = (String)Session[Def.DefPARA_FOLLOW];

                Boolean result = false;

                ClientScriptManager csManager = Page.ClientScript;
                Type      csType       = this.GetType();
                ArrayList arrayMessage = new ArrayList();

                // フォロー情報キー情報
                if (paraEventCode == "" || paraEventCode == null)
                {
                    btnDisp.Enabled = false;    // 表示ボタン使用不可
                    arrayMessage.Add(Def.DefMsg_URLERR);
                    bcom.ShowMessage(csType, csManager, arrayMessage);
                    return;
                }

                // Windowsログイン・ユーザマスタチェック
                result = bcom.CheckUser();
                if (result)
                {
                    btnDisp.Enabled = false;    // 表示ボタン使用不可
                    arrayMessage.Add(Def.DefMsg_USERERR);
                    bcom.ShowMessage(csType, csManager, arrayMessage);
                    return;
                }

                // 作業対象部署にフォーカス
                txtKacode.Focus();
                // HiddenField フィールドクリア
                hdPageNo.Value = "0";

                strArrayData                 = paraEventCode.Trim().Split(',');
                ViewState["FMC_mc"]          = strArrayData[0];
                ViewState["KAIHATU_ID"]      = strArrayData[1];
                ViewState["BY_PU"]           = strArrayData[2];
                ViewState["EVENT_NO"]        = strArrayData[3];
                ViewState["FullEventName"]   = strArrayData[4];
                Session[Def.DefPARA_EVENTNM] = strArrayData[4];
                ViewState["EventName"]       = strArrayData[5];

                // フォロー対象部署オートコンプリート処理 // 2017/07/14 Add
                getKaCodeData(ViewState["FMC_mc"].ToString(), ViewState["KAIHATU_ID"].ToString(),
                              ViewState["BY_PU"].ToString(), ViewState["EVENT_NO"].ToString());

                Session[Def.DefPARA_FOLLOW] = "";         // セッションクリア
            }
            // システムエラー処理(ログ出力、エラー画面遷移)
            catch (Exception ex)
            {
                // システムエラー処理(ログ出力&エラーページ表示)
                bcom.ErrorProcess("frmFollowAnswer", "Page_Load", ex, this.Response);
            }
        }
Ejemplo n.º 25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request["id"] != null)
                {
                    // get info
                    try
                    {
                        string username = User.Identity.Name;
                        int    id       = Convert.ToInt32(Request["id"]);
                        if (MeetingClass.CParticipant.isParticipant(id, username))
                        {
                            var evn = MeetingClass.MeetingInfo.GetMeeting(id);
                            tbID.Value    = id.ToString();
                            tbtitle.Value = evn.Title;
                            tbSDate.Value = evn.Start.ToShortDateString();
                            tbEDate.Value = evn.End.ToShortDateString();
                            tbSTime.Value = evn.Start.ToShortTimeString();
                            tbETime.Value = evn.End.ToShortTimeString();
                            tbDesc.Value  = evn.Desc;
                            ClientScriptManager script = Page.ClientScript;

                            // check if the user is allowed

                            script.RegisterClientScriptBlock(this.GetType(), "test", "<script>setMeetingID(" + id + "); </script>");

                            // fill locations
                            var locations = MeetingClass.CResource.GetAvailableLocations(evn.Start, evn.End);
                            if (locations.Count() == 0)
                            {
                                lbLocation.Items.Add("No Location available for this meeting's time and date");
                            }
                            else
                            {
                                lbLocation.DataSource     = locations;
                                lbLocation.DataValueField = "LocationID";
                                lbLocation.DataTextField  = "LocationName";
                                lbLocation.DataBind();
                            }

                            // get discussions
                            var    result    = DiscussionClass.MeetingDiscussion.GetListMeetingDiscussions(id);
                            string disScript = @"<p><a href=""#"" title=""{0}"" onclick=""ShowDiscussion(this); return false;"">{1}</a></p><p class=""pull-right""><b> Created by:</b> {2}<b> On:</b> {3}<b> Replys: </b>{4}</p><hr />";
                            foreach (var t in result)
                            {
                                DiscussionList.InnerHtml += string.Format(disScript, t.ID, t.Title, t.UserName, t.Date.ToString("MM/dd/yyyy | hh:mm:ss"), t.Replies.ToString());
                            }

                            // Privacy fro Agenda
                            if (AgendaClass.AgendaPrivacyClass.CheckRole(username, id, MeetingRoles.Creator))
                            {
                                divAddAgendaTask.Visible = true;
                            }
                            else
                            {
                                divAddAgendaTask.Visible = false;
                            }
                        }
                        else
                        {
                            Response.Redirect("~/Error.aspx");
                        }
                    }
                    catch
                    {
                    }

                    // get participant
                    //var parti = MeetingClass.Participant.getMeetingParticipant(id);
                    //int index = 1;
                    //foreach (var r in parti)
                    //{
                    //    HtmlTableRow row = new HtmlTableRow();
                    //    HtmlTableCell num = new HtmlTableCell();
                    //    num.InnerText = index.ToString();
                    //    row.Cells.Add(num);
                    //    HtmlTableCell user = new HtmlTableCell();
                    //    user.InnerText = r.UserName;
                    //    row.Cells.Add(user);
                    //    HtmlTableCell role = new HtmlTableCell();
                    //    role.InnerText = r.Role;
                    //    row.Cells.Add(role);
                    //    HtmlTableCell res = new HtmlTableCell();
                    //    res.InnerText = r.Response;
                    //    row.Cells.Add(res);
                    //    HtmlTableCell note = new HtmlTableCell();
                    //    note.InnerText = r.Note;
                    //    row.Cells.Add(note);
                    //    HtmlTableCell close = new HtmlTableCell();
                    //    close.InnerHtml = "<a href='#' onclick='return Delete(this)'><span class='icon-x'></span></a>";
                    //    row.Cells.Add(close);

                    //    // add row to table
                    //    parTable.Rows.Add(row);
                    //    index++;
                    //    btnInvite.Visible = true;
                    //}
                }
                else
                {
                    if (!Roles.ChkAdmin(User.Identity.Name))
                    {
                        Response.Redirect("~/Error.aspx");
                    }
                }
                // fill resources
                SetResources();
                // fill MTypes
                ddlMType.DataSource     = MeetingClass.getMeetingTypes();
                ddlMType.DataTextField  = "Type";
                ddlMType.DataValueField = "CatID";
                ddlMType.DataBind();
                // get all participants
                string[] users = ldap.getListOfUsersTemp().OrderBy(a => a).ToArray();
                lbPart.DataSource = users;
                lbPart.DataBind();
                //for (int o = 0; o < users.Count(); o++ )
                //{

                //    //string str = @"<label class=""checkbox""><input type=""checkbox"" id=""chk"" runat=""server"">";
                //    //str += @"<span class=""metro-checkbox"">" + users[o] + "</span></label>";
                //    //if (o < users.Count()/2)
                //    //{
                //    //    divAttendees1.InnerHtml += str;
                //    //}
                //    //else
                //    //{
                //    //    divAttendees2.InnerHtml += str;
                //    //}
                //}
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        /// ページ読み込み処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            Boolean             bRet      = false;
            ClientScriptManager csManager = Page.ClientScript;
            Type      csType       = this.GetType();
            ArrayList arrayMessage = new ArrayList();

            // Windowsログイン・ユーザマスタチェック
            bRet = bcom.CheckUser();
            if (bRet)
            {
                //DetailDiv.Visible = false; // 画面詳細項目を表示しない

                arrayMessage.Add(Def.DefMsg_USERERR);
                bcom.ShowMessage(csType, csManager, arrayMessage);
                return;
            }

            // ログインユーザーID取得
            string sUser = bcom.GetWindowsUser();

            // ユーザー情報取得
            _UserMater = new SqlCommon().SelectUser(sUser);

            // クエリパラメータから管理番号を取得
            if (IsPostBack != true)
            {
                // クエリパラメータを取得する(過去トラ観たか管理No)
                if (Request.QueryString.Get("ManageNo") != null)
                {
                    _QueryManagementNo = Request.QueryString.Get("ManageNo");
                }
            }
            // 管理番号が取得できなかった場合
            if (_QueryManagementNo == null)
            {
                // 過去トラ観たか新規登録
                PageTitle.Text = "過去トラ観たか新規登録";

                // 過去トラ観たか情報取得  初期処理
                getMitakaData();

                //_ParamKeyword = (String)Session[Def.DefPARA_WORD];    // 文字列検索
                //_ParamCotegoryTable = (DataTable)Session[Def.DefPARA_TABLE];   // カテゴリ検索
                //_ParamSearchCondition = (String)Session[Def.DefPARA_CONDITION_FLG];  // AND/OR検索条件
            }
            else
            {
                // 過去トラ観たか編集
                PageTitle.Text    = "過去トラ観たか編集";
                HdnManageNo.Value = _QueryManagementNo;

                // 過去トラ観たか情報取得
                getMitakaData(_QueryManagementNo, sUser);

                _TroubleData.Columns.Add("BUSYO_SEKKEI");
                _TroubleData.Columns.Add("BUSYO_HYOUKA");
                _TroubleData.Columns.Add("BUSYO_KAITOU");


                List <string> SekkeiDepartList       = new List <string>();
                List <string> HyoukaDepartList       = new List <string>();
                List <string> AnswerTargetDepartList = new List <string>();

                for (int i = 0; i < _TroubleData.Rows.Count; i++)
                {
                    for (int j = 0; j < _TroubleData.Rows[i].ItemArray.Length; j++)
                    {
                        // 設計部署をリストに格納
                        if (_TroubleData.Rows[i].Table.Columns[j].ToString().StartsWith("BUSYO_SEKKEI"))
                        {
                            if (_TroubleData.Rows[i].ItemArray[j].ToString().Length > 0)
                            {
                                SekkeiDepartList.Add(_TroubleData.Rows[i].ItemArray[j].ToString());
                            }
                        }
                        // 評価部署をリストに格納
                        if (_TroubleData.Rows[i].Table.Columns[j].ToString().StartsWith("BUSYO_HYOUKA"))
                        {
                            if (_TroubleData.Rows[i].ItemArray[j].ToString().Length > 0)
                            {
                                HyoukaDepartList.Add(_TroubleData.Rows[i].ItemArray[j].ToString());
                            }
                        }
                        // 回答対象部署をリストに格納
                        if (_TroubleData.Rows[i].Table.Columns[j].ToString().StartsWith("BUSYO_"))
                        {
                            if (_TroubleData.Rows[i].ItemArray[j].ToString().Length > 0)
                            {
                                AnswerTargetDepartList.Add(_TroubleData.Rows[i].ItemArray[j].ToString());
                            }
                        }
                    }

                    string skkei = "";
                    if (SekkeiDepartList.Count > 0)
                    {
                        SekkeiDepartList.CombineFromString(ref skkei);
                    }

                    string hyouka = "";
                    if (HyoukaDepartList.Count > 0)
                    {
                        HyoukaDepartList.CombineFromString(ref hyouka);
                    }

                    string kaitou = "";
                    if (AnswerTargetDepartList.Count > 0)
                    {
                        AnswerTargetDepartList.CombineFromString(ref kaitou);
                    }

                    _TroubleData.Columns.Add("BUSYO_SEKKEI_R");
                    _TroubleData.Rows[i]["BUSYO_SEKKEI_R"] = skkei;
                    _TroubleData.Columns.Add("BUSYO_HYOUKA_R");
                    _TroubleData.Rows[i]["BUSYO_HYOUKA_R"] = hyouka;
                    _TroubleData.Columns.Add("BUSYO_KAITOU_R");
                    _TroubleData.Rows[i]["BUSYO_KAITOU_R"] = kaitou;
                }
            }
        }
Ejemplo n.º 27
0
    protected void BTN_registrar_Click(object sender, EventArgs e)
    {
        ClientScriptManager cm = this.ClientScript;
        //creo objeto para verificar correo
        UEncapUsuario verificarCorreo = new UEncapUsuario();

        verificarCorreo.Correo = TB_correo.Text;
        //creo objeto para verificar identificacion
        UEncapUsuario verificarIdentificacion = new UEncapUsuario();

        verificarIdentificacion.Identificacion = TB_identificacion.Text;
        //envio secuencias de verificacion
        bool veriCorreo         = new LLogin().verificarCorreo(verificarCorreo);
        bool veriIdentificacion = new LLogin().verificarIdentificacion(verificarIdentificacion);

        if (veriCorreo == true && veriIdentificacion == true)
        {
            //traigo valores de los texbox
            UEncapUsuario User = new UEncapUsuario();
            User.Nombre           = TB_nombres.Text;
            User.Apellido         = TB_apellidos.Text;
            User.Correo           = TB_correo.Text;
            User.Clave            = TB_contraseña.Text;
            User.Fecha_nacimiento = DateTime.Parse(TB_fecha_nacimiento.Text);
            int actual = DateTime.Now.Year;
            if ((actual - (int)User.Fecha_nacimiento.Year) < 18)
            {
                //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert ( 'Debe ser mayor de edad para poderse registrar' );</script>");
                //return;
                MostrarMensaje1($"Para registrarse debe ser mayor de edad");
                return;
            }
            if ((actual - (int)User.Fecha_nacimiento.Year) > 80)
            {
                //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert ( 'No aceptamos edades mayores a 80' );</script>");
                //return;
                MostrarMensaje1($"No aceptamos personas mayores de 80 años");
                return;
            }

            User.Identificacion = TB_identificacion.Text;
            User.Rol_id         = 4;
            User.Estado_id      = 1;
            //apunto a metodo de insert
            new LLogin().insertarUsuario(User);
            //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert ( 'El usuario se ha registrado satisfactoriamente' );</script>");
            MostrarMensaje2($"El usuario se ha registrado satisfactoriamente");
            TB_nombres.Text          = "";
            TB_apellidos.Text        = "";
            TB_correo.Text           = "";
            TB_contraseña.Text       = "";
            TB_confirmar_contra.Text = "";
            TB_identificacion.Text   = "";
            TB_fecha_nacimiento.Text = "";
            return;
        }

        if (veriCorreo != true)
        {
            //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert ( 'El correo ya se encuentra registrado' );</script>");
            //return;
            MostrarMensaje($"El correo ya se encuentra registrado");
            return;
        }
        if (veriIdentificacion != true)
        {
            //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert ( 'La identificacion ya se encuentra registrada' );</script>");
            //return;
            MostrarMensaje($"La identificacion ya se encuentra registrada");
            return;
        }
    }
Ejemplo n.º 28
0
    protected void button_enviar(object sender, EventArgs e)
    {
        ClientScriptManager cm = this.ClientScript;
        E_user user            = new E_user();


        string user_name = Page.Request.Form["name"].ToString();

        if (string.IsNullOrEmpty(user_name))
        {
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ingrese el nombre');</script>");
        }
        else
        {
            user.User_name = user_name;
        }

        string user_lastname = Page.Request.Form["lastname"].ToString();

        if (string.IsNullOrEmpty(user_lastname))
        {
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ingrese el apellido');</script>");
        }
        else
        {
            user.User_lastname = user_lastname;
        }

        string cedula          = Page.Request.Form["cedula"].ToString();
        int    validate_cedula = 0;
        bool   comprobation    = int.TryParse(cedula, out validate_cedula);

        if (comprobation == true)
        {
            //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Funciona perro');</script>");
            user.Cedula = cedula;
        }
        else
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Digite su cedula');window.open('Form.aspx','_self');", true);
            //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Digite su cedula');</script>");
            //Response.Redirect("~/View/admin_menu.aspx");
        }

        string date_nac = Page.Request.Form["date_nac"].ToString();

        if (string.IsNullOrEmpty(date_nac))
        {
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Ingrese su fecha de nacimiento');</script>");
        }
        else
        {
            DateTime date_now    = DateTime.Now;
            DateTime pruebaMeste = Convert.ToDateTime(date_nac);
            int      year        = date_now.Year - pruebaMeste.Year;
            int      month       = date_now.Month - pruebaMeste.Month;
            int      day         = date_now.Day - pruebaMeste.Day;
            if (month < 0)
            {
                year--;
            }
            else if (month == 0)
            {
                //day <= 0 ? year : year - 1;
                if (day <= 0)
                {
                    year--;
                }
            }
            if (year < 18)
            {
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Usuario Menor de edad');</script>");
            }
            else
            {
                user.Nacimiento = date_nac;
            }
        }

        string date_exp = Page.Request.Form["date_e"].ToString();

        if (string.IsNullOrEmpty(date_exp))
        {
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Usuario Menor de Edad');</script>");
        }
        else
        {
            user.Expe = date_exp;
        }

        Session["validUser"] = user;
        user = new DAO_User().compareUser(user);

        E_user pa = new DAO_User().getCandidatoVoto(cedula);

        if (user == null)
        {
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Esta persona no existe o no puede votar');</script>");
        }
        else if (user.Cedula != cedula)
        {
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Esa cedula no existe');</script>");
        }
        else if (pa.Voto == true)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Usted ya realizo la votacion');window.open('index.aspx','_self');", true);
        }
        else
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Bienvenido, por favor vote a conciencia');window.open('selection_candidate.aspx','_self');", true);
            //cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Bienvenido');</script>");
            //Response.Redirect("~/View/selection_candidate.aspx");
        }
    }
Ejemplo n.º 29
0
    protected void B_obtener_accesorio_Click(object sender, ImageClickEventArgs e)
    {
        ClientScriptManager cm = this.ClientScript;

        cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('Debes iniciar session, para ver detalles y adquirir nuestro producto :');</script>");
    }
Ejemplo n.º 30
0
        public void dgAttendance_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                if (dgAttendance.EditItemIndex == -1)
                {
                    ClientScriptManager csm = Page.ClientScript;
                    DataRowView         drv = (DataRowView)e.Item.DataItem;
                    Control             holder = (PersonDetailPageID == -1 ? e.Item.Controls[1] : e.Item.Controls[0]);
                    Control             hover = holder.Controls[1];
                    LinkButton          lbReprint = (LinkButton)holder.Controls[3];
                    LinkButton          lbPost = (LinkButton)holder.Controls[5];
                    String  html = "", securityNumber;
                    Boolean hasCCCEV = false;


                    try
                    {
                        String   arenaBin;
                        Assembly asm;

                        //
                        // Find the location of the Arena bin directory and then try to load
                        // the Cccev assembly file.
                        //
                        arenaBin = new Organization().GetType().Assembly.CodeBase.Split(new string[] { "/Arena." }, StringSplitOptions.None)[0];
                        asm      = System.Reflection.Assembly.LoadFrom(arenaBin + "/Arena.Custom.Cccev.CheckIn.dll");
                        if (asm != null)
                        {
                            hasCCCEV = true;
                        }
                    }
                    catch { }

                    //
                    // Add the link to the person.
                    //
                    if (PersonDetailPageID != -1)
                    {
                        ((LinkButton)hover).Attributes["href"] = "default.aspx?page=" + PersonDetailPageID.ToString() + "&guid=" + drv["guid"];
                    }

                    //
                    // If we have the CCCEV check-in library, provide a re-print button.
                    //
                    if (hasCCCEV && LabelPrintProviderID != -1)
                    {
                        html += "<span class=\"smallText\"><a href=\"" + csm.GetPostBackClientHyperlink(lbReprint, null) + "\">Reprint</a> labels for " + drv["first_name"] + "<br /></span>";
                        html += "<br />";
                    }

                    //
                    // If we have a topic area, provide a post/remove security number.
                    //
                    if (TopicAreaID != -1 && drv["security_code"].ToString().Length > 2)
                    {
                        //
                        // Check if the security code is already posted.
                        //
                        securityNumber = drv["security_code"].ToString().Substring(2).Trim();
                        if (FindPromotionRequest(Convert.ToInt32(drv["occurrence_attendance_id"])) != -1)
                        {
                            html = html + "<span class=\"smallText\">Remove security number <a href=\"" + csm.GetPostBackClientHyperlink(lbPost, null) + "\">" + securityNumber + "</a><br /></span>";
                        }
                        else
                        {
                            html = html + "<span class=\"smallText\">Post security number <a href=\"" + csm.GetPostBackClientHyperlink(lbPost, null) + "\">" + securityNumber + "</a><br /></span>";
                        }
                    }

                    html = html.Replace("'", "\\'");
                    ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "hover" + hover.ClientID, "$(document).ready(function() {popupOverObject('" + hover.ClientID + "', '" + html + "');});", true);
                }
            }
        }
Ejemplo n.º 31
0
    protected void btnSave_Click(object sender, System.EventArgs e)
    {
        byte SysMessageTypeId = 0;
        int  SysMessageId     = 0;

        System.Int32 EditId;
        OnePayTrans  m_OnePayTrans = new OnePayTrans();

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


            m_OnePayTrans.CrUserId = ActUserId;

            if (txvpc_OrderInfo.Text != "")
            {
                m_OnePayTrans.vpc_OrderInfo = txvpc_OrderInfo.Text;
            }

            m_OnePayTrans.vpc_Amount = int.Parse(txvpc_Amount.Text);

            if (txvpc_TicketNo.Text != "")
            {
                m_OnePayTrans.vpc_TicketNo = txvpc_TicketNo.Text;
            }

            if (txAgainLink.Text != "")
            {
                m_OnePayTrans.AgainLink = txAgainLink.Text;
            }

            m_OnePayTrans.vpc_TxnResponseCode = int.Parse(txvpc_TxnResponseCode.Text);

            if (txvpc_TransactionNo.Text != "")
            {
                m_OnePayTrans.vpc_TransactionNo = txvpc_TransactionNo.Text;
            }

            if (txvcp_Message.Text != "")
            {
                m_OnePayTrans.vcp_Message = txvcp_Message.Text;
            }

            m_OnePayTrans.CustomerId = int.Parse(txCustomerId.Text);

            if (txResponseTime.Text != "")
            {
                m_OnePayTrans.ResponseTime = DateTime.Parse(txResponseTime.Text);
            }


            m_OnePayTrans.TransId = EditId;
            SysMessageTypeId      = m_OnePayTrans.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);
        }
    }
Ejemplo n.º 32
0
        protected override void Render(HtmlTextWriter writer)
        {
            ClientScriptManager csm = Page.ClientScript;

            string source = ParseUrlProperty(_xapFile);

            Dictionary <string, string> initParamList = new Dictionary <string, string>();

            initParamList["UploadHandlerPath"] = ParseUrlProperty(_handlerPath);

            if (MaxUploads > 0)
            {
                initParamList["MaxUploads"] = MaxUploads.ToString();
            }

            if (MaxFileSizeKB > 0)
            {
                initParamList["MaxFileSizeKB"] = MaxFileSizeKB.ToString();
            }

            if (ChunkSizeMB > 0)
            {
                initParamList["ChunkSizeMB"] = ChunkSizeMB.ToString();
            }

            if (!string.IsNullOrEmpty(FileFilter))
            {
                initParamList["FileFilter"] = FileFilter;
            }

            if (!string.IsNullOrEmpty(UploadedFileProcessorType))
            {
                initParamList["UploadedFileProcessorType"] = UploadedFileProcessorType;
            }

            initParamList["MultiSelect"] = _multiSelect.ToString();

            string sInitParams = SilverlightUtility.BuildInitParamsString(initParamList);

            // NOTE: this uses "windowless" mode by default; feel free to change this as you see fit... in an app like
            // this that is not particularly intensive on the UI side of things, using windowless mode makes embedding
            // the control into your pages much more manageable, particularly in firefox -- avoids a lot of the issues
            // with setting dimensions on containers and using display:none

            writer.Write(@"
<object id=""silverlight" + this.ID + @""" data=""data:application/x-silverlight-2,"" type=""application/x-silverlight-2"" width=""100%"" height=""100%"">
    <param name=""source"" value=""" + source + @"""/>
    <param name=""minRuntimeVersion"" value=""2.0.31005.0"" />
    <param name=""autoUpgrade"" value=""true"" />
    <param name=""initParams"" value=""" + sInitParams + @""" />
    <param name=""windowless"" value=""true"" />
    <param name=""onLoad"" value=""UploaderControl_onLoad_" + this.ID + @""" />
    <a href=""http://go.microsoft.com/fwlink/?LinkID=124807"" style=""text-decoration: none;"">
        <img src=""http://go.microsoft.com/fwlink/?LinkId=108181"" alt=""Get Microsoft Silverlight"" style=""border-style: none""/>
    </a>
</object>
<iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe>
");

            string script = @"
function UploaderControl_onLoad_" + this.ID + @"() {
    UploaderControl.getInstance(""" + this.ID + @""").onLoad();
}

function UploaderControl_uploadStarted_" + this.ID + @"(sender, e) {
    UploaderControl.getInstance(""" + this.ID + @""").uploadStarted(sender, e);    
}

function UploaderControl_singleFileUploadFinished_" + this.ID + @"(sender, e) {
    UploaderControl.getInstance(""" + this.ID + @""").singleFileUploadFinished(sender, e);    
}

function UploaderControl_allFilesFinished_" + this.ID + @"(sender, e) {
    UploaderControl.getInstance(""" + this.ID + @""").allFilesFinished(sender, e);    
}

function UploaderControl_errorOccurred_" + this.ID + @"(sender, e) {
    UploaderControl.getInstance(""" + this.ID + @""").errorOccurred(sender, e);    
}

UploaderControl.getInstance(""" + this.ID + @""").initialize(" + (UserContext == null ? "null" : "\"" + UserContext + "\"") + @");
";

            csm.RegisterStartupScript(this.GetType(), this.ID, script, true);
        }
        private void enviar()
        {
            ClientScriptManager cm = this.ClientScript;

            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>open('../Ayuda/Mensaje.aspx', 'Proyección de ventas', 'width=500,height=400');</script>");
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        InvestmentDSTableAdapters.GetInvestmentAppTableAdapter invApp = new InvestmentDSTableAdapters.GetInvestmentAppTableAdapter();


        #region "QueryString Block"
        string EncID = Request.QueryString["id"];
        int    DecID = Convert.ToInt32(MyEncryption.Decrypt(EncID, "12345678910"));
        MySessionManager.InvAppID = DecID;
        MySessionManager.ClientID = Convert.ToInt32(invApp.GetClientID(MySessionManager.InvAppID));

        if (!(Request.QueryString["ops"] == null))
        {
            if (!(Request.QueryString["tab"] == null))
            {
                if (!(Request.QueryString["tab"] == ""))
                {
                    currentTab = int.Parse(Request.QueryString["tab"]);
                }
                else
                {
                    currentTab = Convert.ToInt32(MySessionManager.CurrentTab);
                }
                ops = Request.QueryString["ops"].ToString();
                setTab(currentTab);
                MySessionManager.CurrentTab = currentTab.ToString();
                MySessionManager.OpsTab     = "load";

                string urlpath = util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "tab");
                urlpath = util.RemoveQueryStringByKey(urlpath, "ops");
                Response.Redirect(urlpath);
            }
            else
            {
                if (!(Request.QueryString["tab"] == ""))
                {
                    currentTab = int.Parse(Request.QueryString["tab"]);
                }
                else
                {
                    currentTab = 1;
                }

                ops = "load";
                setTab(currentTab);

                MySessionManager.CurrentTab = currentTab.ToString();
                MySessionManager.OpsTab     = "load";
                util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "tab");
                util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "ops");
            }
        }
        else
        {
            ops = MySessionManager.OpsTab.ToString();

            //For handling the tabs
            if (!(MySessionManager.CurrentTab == ""))
            {
                currentTab = int.Parse(MySessionManager.CurrentTab);
            }
            else
            {
                currentTab = 1;
            }
            MySessionManager.CurrentTab = currentTab.ToString();
            setTab(currentTab);
        }
        #endregion


        //For posting the alert that has been placed on the application
        if ((!(util.alert1() == "")) && (MySessionManager.skipAlert == 0))
        {
            this.pAlertmsg.InnerText = util.alert1();
            // Define the name and type of the client scripts on the page.
            String csname1 = "PopupScript";
            String csname2 = "ButtonClickScript";
            Type   cstype  = this.GetType();

            // Get a ClientScriptManager reference from the Page class.
            ClientScriptManager cs = Page.ClientScript;

            // Check to see if the startup script is already registered.
            if (!cs.IsStartupScriptRegistered(cstype, csname1))
            {
                String cstext1 = "alertMessage();";
                cs.RegisterStartupScript(cstype, csname1, cstext1, true);
            }
            MySessionManager.skipAlert = 1;
        }

        setURLs();
        showLoanAppInfo();
        setNotifications();
    }
Ejemplo n.º 35
0
 public override string GetConfigUrl(ClientScriptManager cs)
 {
     return("CCH/Default.aspx");
 }
    protected void BTN_subir_Click(object sender, EventArgs e)
    {
        ClientScriptManager cm = this.ClientScript;

        int auxprecio  = int.Parse(TB_Precio.Text);
        int aux_minimo = int.Parse(TB_Minima.Text);

        if (auxprecio <= 0 || aux_minimo <= 0)
        {
            //MostrarMensaje($"No se permiten datos negativos");
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert ('NO SE PERMITE DATOS NEGATIVOS' );</script>");
            return;//Devolverse
        }


        //Propiedades del archivo a subirs


        string nombreArchivo = System.IO.Path.GetFileName(FU_Archivo.PostedFile.FileName);
        string extension     = System.IO.Path.GetExtension(FU_Archivo.PostedFile.FileName);

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

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


        //verificar existencia de un arhivo con el mismo nombre
        if (System.IO.File.Exists(saveLocationAdmin))
        {
            //MostrarMensaje1($"Imagen existente");
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert ('Imagen Existente' );</script>");
            return;
        }
        //Validaciones
        var db        = new Mapeo();
        var consulta1 = (from x in db.inventario where x.Referencia.Equals(TB_referencia.Text) select x.Referencia).Count();
        UEncapInventario referencia = new UEncapInventario();

        referencia.Referencia = TB_referencia.Text;
        bool consultRef = new LAdministrador().consultarReferencia(referencia);

        //si referencia ya existe

        if (consultRef == true)
        {
            //MostrarMensaje1($"La referencia ya existe");
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert ('La Referencia Ya Existe' );</script>");
            return;
        }

        else
        {
            try
            {
                //Guardar Archivo local
                FU_Archivo.PostedFile.SaveAs(saveLocationAdmin);


                UEncapInventario invent = new UEncapInventario();


                invent.Imagen     = Ruta;
                invent.Titulo     = TB_Titulo.Text;
                invent.Referencia = TB_referencia.Text;
                invent.Precio     = int.Parse(TB_Precio.Text);

                invent.Ca_minima    = int.Parse(TB_Minima.Text);
                invent.Id_marca     = int.Parse(DDL_Marca.Text);
                invent.Id_categoria = int.Parse(DDL_Categoria.Text);
                invent.Id_estado    = 1;
                invent.Ca_actual    = 0;
                invent.Last_modify  = DateTime.Now;
                invent.Session      = Session["Nombre"].ToString();

                new LAdministrador().insertarItem(invent);

                //MostrarMensaje2($"Item registrado correctamente");
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert ('Item registrado correctamente' );</script>");
            }
            catch (Exception exc)
            {
                //MostrarMensaje($"Error");
                cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert ('Error' );</script>");
                return;
            }
        }

        TB_Titulo.Text     = "";
        TB_referencia.Text = "";

        TB_Minima.Text = "";
        TB_Precio.Text = "";
    }
Ejemplo n.º 37
0
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder       sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            string _ID             = Request["ID"];
            string _PID            = Request["PID"];
            string _Ten            = Request["Ten"];
            string _Mota           = Request["Mota"];
            string _Ma             = Request["Ma"];
            string _Url            = Request["Url"];
            string _GiaTriMacDinh  = Request["GiaTriMacDinh"];
            string _Loai           = Request["Loai"];
            string _ThuTu          = Request["ThuTu"];
            string _Publish        = Request["Publish"];
            string _Anh            = Request["Anh"];
            string _Desk           = Request["Desk"];
            string _DeskMacDinh    = Request["DeskMacDinh"];

            switch (subAct)
            {
            case "get":
                #region lấy danh sách
                List <Function> ListGet = getTree(FunctionDal.SelectTree(Request["q"]));
                List <jgridRow> ListRow = new List <jgridRow>();
                foreach (Function item in ListGet)
                {
                    ListRow.Add(new jgridRow(item.ID.ToString(), new string[] {
                        item.ID.ToString()
                        , item.Ten
                        , item.Loai != 3 ? string.Format("<img class=\"adm-fn-icon\" src=\"../up/i/{0}\" />", string.IsNullOrEmpty(item.Anh) ? "fn-icon.jpg" :item.Anh) : ""
                        , item.Ma
                        , item.Url
                        , item.ThuTu.ToString()
                        , item.Loai.ToString()
                        , item.Publish.ToString()
                        , item.GiaTriMacDinh.ToString()
                        , item.Level.ToString(), item.PID.ToString(), "true", "false"
                    }));
                }
                jgrid grid = new jgrid("1", "1", ListGet.Count.ToString(), ListRow);
                sb.Append(JavaScriptConvert.SerializeObject(grid));
                break;

                #endregion
            case "getPid":
                #region danh sách chọn sẵn
                FunctionCollection ListGetPid = FunctionDal.SelectTree(Request["q"]);
                sb.Append(JavaScriptConvert.SerializeObject(ListGetPid));
                break;

                #endregion
            case "del":
                #region Xóa
                if (!string.IsNullOrEmpty(_ID))
                {
                    FunctionDal.DeleteById(Convert.ToInt32(_ID));
                }
                break;

                #endregion
            case "edit":
                #region chỉnh sửa
                if (!string.IsNullOrEmpty(_ID))
                {
                    sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(FunctionDal.SelectById(Convert.ToInt32(_ID))));
                }
                break;

                #endregion
            case "save":
                #region lưu dữ liệu
                Function ItemSave = new Function();
                if (!string.IsNullOrEmpty(_ID))
                {
                    ItemSave = FunctionDal.SelectById(Convert.ToInt32(_ID));
                }
                ItemSave.NgayCapNhat = DateTime.Now;
                ItemSave.Ten         = _Ten;
                ItemSave.MoTa        = _Mota;
                ItemSave.Loai        = Convert.ToInt16(_Loai);
                ItemSave.Ma          = _Ma;
                ItemSave.Anh         = string.Empty;
                int ThuTu = 0;
                if (!string.IsNullOrEmpty(_ThuTu))
                {
                    ThuTu = Convert.ToInt32(_ThuTu);
                }
                ItemSave.Publish       = Convert.ToBoolean(_Publish);
                ItemSave.PID           = string.IsNullOrEmpty(_PID) ? 0 : Convert.ToInt32(_PID);
                ItemSave.ThuTu         = ThuTu;
                ItemSave.Url           = _Url;
                ItemSave.NguoiTao      = Security.Username;
                ItemSave.GiaTriMacDinh = Convert.ToBoolean(_GiaTriMacDinh);
                ItemSave.Anh           = _Anh;
                ItemSave.Desk          = Convert.ToBoolean(_Desk);
                ItemSave.DeskMacDinh   = Convert.ToBoolean(_DeskMacDinh);
                if (ItemSave.Desk)
                {
                    try
                    {
                        //ItemSave.Doc = ;
                        XmlDocument doc  = new XmlDocument();
                        XmlNode     node = doc.ImportNode(PlugHelper.RenderXml(ItemSave.Url), true);
                        doc.AppendChild(node);
                        string _DocValue = linh.common.Lib.GetXmlString(doc);
                        ItemSave.Doc = _DocValue;
                    }
                    catch (Exception ex)
                    {
                        ItemSave.Doc  = string.Empty;
                        ItemSave.Desk = false;
                        sb.Append("Loi + " + ex.Message);
                    }
                }
                else
                {
                    ItemSave.Doc = string.Empty;
                }
                if (!string.IsNullOrEmpty(_ID))
                {
                    ItemSave = FunctionDal.Update(ItemSave);
                }
                else
                {
                    ItemSave.NgayTao = DateTime.Now;
                    ItemSave.Level   = 0;
                    ItemSave.PIDList = string.Empty;
                    ItemSave.RowId   = Guid.NewGuid();
                    ItemSave         = FunctionDal.Insert(ItemSave);
                }
                sb.Append("1");
                break;

                #endregion
            default:
                #region nạp
                FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                //<input type=""text"" class=""mdl-head-txt mdl-head-search"" />
                sb.Append(@"<div class=""mdl-head"">
<span class=""mdl-head-searchPnl ui-state-default ui-corner-all"">
<a href=""javascript:;"" class=""mdl-head-clearSearch""></a>
<input type=""text"" class=""mdl-head-txt mdl-head-search mdl-head-search-functions"" />
</span>
<a class=""mdl-head-btn mdl-head-add"" id=""functionsmdl-addBtn"" href=""javascript:functions.add();"">Thêm</a>
<a class=""mdl-head-btn mdl-head-edit"" id=""functionsmdl-editBtn"" href=""javascript:functions.edit();"">Sửa</a>
<a class=""mdl-head-btn mdl-head-del"" id=""functionsmdl-delBtn"" href=""javascript:functions.del();"">Xóa</a>
</div>
<table id=""functionsmdl-List"" class=""mdl-list"">
</table>
<div id=""functionsmdl-Pager""></div>");
                sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                                , cs.GetWebResourceUrl(typeof(Class1), "docsoft.plugin.hethong.functions.JScript1.js")
                                , "{functions.loadgrid();}");
                sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                break;
                #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Ejemplo n.º 38
0
		public override void RenderBeginTag (HtmlTextWriter writer)
		{
			string skipLinkText = SkipLinkText;
			
			if (!String.IsNullOrEmpty (skipLinkText)) {
				writer.AddAttribute (HtmlTextWriterAttribute.Href, "#" + ClientID + "_SkipLink");
				writer.RenderBeginTag (HtmlTextWriterTag.A);

				ClientScriptManager csm = new ClientScriptManager (null);
				
				writer.AddAttribute (HtmlTextWriterAttribute.Alt, skipLinkText);
				writer.AddAttribute (HtmlTextWriterAttribute.Src, csm.GetWebResourceUrl (typeof (SiteMapPath), "transparent.gif"));
				writer.AddAttribute (HtmlTextWriterAttribute.Height, "0");
				writer.AddAttribute (HtmlTextWriterAttribute.Width, "0");
				writer.AddStyleAttribute (HtmlTextWriterStyle.BorderWidth, "0px");
				writer.RenderBeginTag (HtmlTextWriterTag.Img);
				
				writer.RenderEndTag (); // img
				writer.RenderEndTag (); // a
			}
			base.RenderBeginTag (writer);
		}
Ejemplo n.º 39
0
		protected override void AddAttributesToRender (HtmlTextWriter writer)
		{			
			Page page = Page;
			if (page != null)
				page.VerifyRenderingInServerForm (this);
			
			writer.AddAttribute (HtmlTextWriterAttribute.Type, "image", false);
			writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);

			base.AddAttributesToRender (writer);
#if NET_2_0
			string onclick = OnClientClick;
			if (!String.IsNullOrEmpty (onclick))
				onclick = ClientScriptManager.EnsureEndsWithSemicolon (onclick);
			else
				onclick = String.Empty;
			
			if (HasAttributes && Attributes ["onclick"] != null) {
				onclick = ClientScriptManager.EnsureEndsWithSemicolon (onclick + Attributes ["onclick"]);
				Attributes.Remove ("onclick");
			}
			
			if (page != null)
				onclick += GetClientScriptEventReference ();
			
			if (onclick.Length > 0)
				writer.AddAttribute (HtmlTextWriterAttribute.Onclick, onclick);
#else
			if (CausesValidation && page != null && page.AreValidatorsUplevel ()) {
				ClientScriptManager csm = new ClientScriptManager (page);
				writer.AddAttribute (HtmlTextWriterAttribute.Onclick, csm.GetClientValidationEvent ());
				writer.AddAttribute ("language", "javascript");
			}
#endif
		}
Ejemplo n.º 40
0
		protected override void AddAttributesToRender (HtmlTextWriter w)
		{
			Page page = Page;
			if (page != null)
				page.VerifyRenderingInServerForm (this);

			bool enabled = IsEnabled;
#if NET_2_0
			string onclick = OnClientClick;
			onclick = ClientScriptManager.EnsureEndsWithSemicolon (onclick);
			if (HasAttributes && Attributes ["onclick"] != null) {
				onclick = ClientScriptManager.EnsureEndsWithSemicolon (onclick + Attributes ["onclick"]);
				Attributes.Remove ("onclick");
			}

			if (onclick.Length > 0)
				w.AddAttribute (HtmlTextWriterAttribute.Onclick, onclick);

			if (enabled && page != null) {
				PostBackOptions options = GetPostBackOptions ();
				string href = page.ClientScript.GetPostBackEventReference (options, true);
				w.AddAttribute (HtmlTextWriterAttribute.Href, href);
			}
			base.AddAttributesToRender (w);
			AddDisplayStyleAttribute (w);
#else
			base.AddAttributesToRender (w);
			if (page == null || !enabled)
				return;
			
			if (CausesValidation && page.AreValidatorsUplevel ()) {
				ClientScriptManager csm = new ClientScriptManager (page);
				w.AddAttribute (HtmlTextWriterAttribute.Href,
						String.Concat ("javascript:{if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); ",
							       csm.GetPostBackEventReference (this, String.Empty), ";}"));
			} else {
				w.AddAttribute (HtmlTextWriterAttribute.Href, page.ClientScript.GetPostBackClientHyperlink (this, String.Empty));
			}
#endif
		}