public void Start()
    {
        Show_BuyUnitText();

        scriptManager = GameObject.Find("ScriptManager").GetComponent<ScriptManager>();
        messageController = scriptManager.messageController;
    }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ScriptManager sm = new ScriptManager();
            sm.EnablePageMethods = true;

            this.form1.Controls.Add(sm);
        }
        public static bool ContainsService(ScriptManager manager, string service)
        {
            Assert.ArgumentNotNull(manager, "manager");
             Assert.ArgumentNotNullOrEmpty(service, "service");

             return manager.Services.FirstOrDefault(s => s.Path == service) != null;
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            // add the script manager to the site to use Ajax
            if (ScriptManager.GetCurrent(this.Page) == null)
            {
                this._sm = new ScriptManager();
                _sm.EnablePageMethods = true;
                this._sm.ID = "ScriptManager";
                if (this.Page.IsPostBack)
                {
                    this.Page.ClientScript.RegisterStartupScript(typeof(VanickApproveControlUserControl),
                        this.ID,
                        "_spOriginalFormAction = document.forms[0].action; _spSuppressFormOnSubmitWrapper=true;");

                        /*typeof("The Class Name of WebPart "),
                                "",
                                "_spOriginalFormAction = document.forms[0].action; _spSuppressFormOnSubmitWrapper=true;",
                                true);*/
                }
                if (this.Page.Form != null)
                {
                    string str = this.Page.Form.Attributes["onsubmit"];
                    if (!(string.IsNullOrEmpty(str) || !(str == "return _spFormOnSubmitWrapper();")))
                    {
                        this.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();";
                    }
                    this.Page.Form.Controls.AddAt(0, this._sm);
                }

            }
        }
        /// <summary>
        /// Registers the JavaScript to display the map.
        /// </summary>
        /// <param name="scriptManager">The page's script manager.</param>
        /// <param name="mapType">Type of the map.</param>
        /// <param name="mapSectionId">The ID of the section (div) on the page in which the map should be created.</param>
        /// <param name="currentLocationSpanId">The ID of the span showing the current location text.</param>
        /// <param name="noLocationSpanId">The ID of the span shown when no location is selected.</param>
        /// <param name="instructionSpanId">The ID of the span with driving directions, etc.</param>
        /// <param name="directionsLinkId">The ID of the link to driving directions.</param>
        /// <param name="directionsSectionId">The ID of the section (div) with driving directions text.</param>
        /// <param name="locations">The list of locations to display.</param>
        /// <param name="showAllLocationsOnLoad">if set to <c>true</c> shows the map with all locations on it by default.</param>
        public override void GenerateMapScriptCore(ScriptManager scriptManager, MapType mapType, string mapSectionId, string currentLocationSpanId, string noLocationSpanId, string instructionSpanId, string directionsLinkId, string directionsSectionId, LocationCollection locations, bool showAllLocationsOnLoad)
        {
            ICollection<JavaScript.Location> locationsAsJson = locations.AsJson();
            string mapParameters = String.Format(CultureInfo.InvariantCulture, "currentLocationSpan: {0}, noLocationSpan: {1}, instructionSpan: {2}, directionsLink: {3}, directionsSection: {4}, mapType: {5}, locationsArray: {6}", GetElementJavaScript(currentLocationSpanId), GetElementJavaScript(noLocationSpanId), GetElementJavaScript(instructionSpanId), GetElementJavaScript(directionsLinkId), GetElementJavaScript(directionsSectionId), ConvertMapType(mapType), new JavaScriptSerializer().Serialize(locationsAsJson));

            scriptManager.Scripts.Add(new ScriptReference(GetLoaderUrl(this.ApiKey)));
            scriptManager.Scripts.Add(new ScriptReference("Engage.Dnn.Locator.JavaScript.BaseLocator.js", "EngageLocator"));
            scriptManager.Scripts.Add(new ScriptReference("Engage.Dnn.Locator.JavaScript.GoogleLocator.js", "EngageLocator"));
            ScriptManager.RegisterStartupScript(
                    scriptManager.Page,
                    typeof(GoogleProvider),
                    "Initialize",
                    "google.setOnLoadCallback(jQuery(function(){ jQuery.noConflict(); $create(Engage.Dnn.Locator.GoogleMap, {" + mapParameters + "}, {}, {}, $get('" + mapSectionId + "')); }));",
                    true);

            if (showAllLocationsOnLoad)
            {
                ScriptManager.RegisterStartupScript(
                        scriptManager.Page,
                        typeof(GoogleProvider),
                        "showAllLocations",
                        "google.setOnLoadCallback(jQuery(function(){ $find('" + mapSectionId + "$GoogleMap').showAllLocations(); }));",
                        true);
            }
        }
 public void Start()
 {
     scriptManager = GameObject.Find("ScriptManager").GetComponent<ScriptManager>();
     guiController = scriptManager.guiController;
     turnController = scriptManager.turnController;
     infopanel = scriptManager.infopanel;
 }
Exemplo n.º 7
0
        public string GetUrl(ScriptManager scriptManager)
        {
            string url = string.Empty;
            if (String.IsNullOrEmpty(Path))
            {
                try
                {
                    PropertyInfo piScriptManager_IControl = scriptManager.GetType().GetProperty("Control", BindingFlags.NonPublic | BindingFlags.Instance);
                    MethodInfo miScriptReference_GetUrl = typeof(ScriptReference).GetMethod("GetUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                    Type typeIControl = Type.GetType(piScriptManager_IControl.PropertyType.AssemblyQualifiedName.ToString(), false, true);
                    //object value = Convert.ChangeType(piScriptManager_IControl.PropertyType, typeIControl);
                    object value = piScriptManager_IControl.GetValue(scriptManager, null);
                    url = (string)miScriptReference_GetUrl.Invoke(this, new object[] { scriptManager, value, false });

                    /*return base.GetUrl(scriptManager, false); //Ajax 3.5*/
                    //MethodInfo miGetScriptResourceUrl = typeof(ScriptManager).GetMethod("GetScriptResourceUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                    //Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
                    //url = (string)miGetScriptResourceUrl.Invoke(scriptManager, new object[] { Name, asm });
                }
                catch (Exception ex) { }
            }
            else
            {
                url = scriptManager.ResolveClientUrl(Path);
            }
            return url;
        }
        private static void GenerateInitializationScript(ref StringBuilder sb, HttpContext context, ScriptManager scriptManager, string serviceUrl) {
            bool authEnabled = ApplicationServiceHelper.AuthenticationServiceEnabled;

            if (authEnabled) {
                if (sb == null) {
                    sb = new StringBuilder(ApplicationServiceManager.StringBuilderCapacity);
                }

                // The default path points to the built-in service (if it is enabled)
                // Note that the client can't default to this path because it doesn't know what the app root is, we must tell it.
                // We must specify the default path to the proxy even if a custom path is provided, because on the client they could
                // reset the path back to the default if they want.
                string defaultServicePath = scriptManager.ResolveClientUrl("~/" + System.Web.Script.Services.WebServiceData._authenticationServiceFileName);
                sb.Append("Sys.Services._AuthenticationService.DefaultWebServicePath = '");
                sb.Append(HttpUtility.JavaScriptStringEncode(defaultServicePath));
                sb.Append("';\n");
            }

            bool pathSpecified = !String.IsNullOrEmpty(serviceUrl);
            if(pathSpecified) {
                if (sb == null) {
                    sb = new StringBuilder(ApplicationServiceManager.StringBuilderCapacity);
                }
                sb.Append("Sys.Services.AuthenticationService.set_path('");
                sb.Append(HttpUtility.JavaScriptStringEncode(serviceUrl));
                sb.Append("');\n");
            }

            // only emit this script if (1) the auth webservice is enabled or (2) a custom webservice url is specified
            if ((authEnabled || pathSpecified) &&
                (context != null && context.Request.IsAuthenticated)) {
                Debug.Assert(sb != null);
                sb.Append("Sys.Services.AuthenticationService._setAuthenticated(true);\n");
            }
       } 
        internal static void ConfigureAuthenticationService(ref StringBuilder sb, HttpContext context, ScriptManager scriptManager, List<ScriptManagerProxy> proxies) {
            string authServiceUrl = null;
            AuthenticationServiceManager authManager;

            if(scriptManager.HasAuthenticationServiceManager) {
                authManager = scriptManager.AuthenticationService;

                // get ScriptManager.ServiceUrl
                authServiceUrl = authManager.Path.Trim();
                if(authServiceUrl.Length > 0) {
                    authServiceUrl = scriptManager.ResolveUrl(authServiceUrl);
                }
            }

            // combine proxy ServiceUrls (find the first one that has specified one)
            if(proxies != null) {
                foreach(ScriptManagerProxy proxy in proxies) {
                    if(proxy.HasAuthenticationServiceManager) {
                        authManager = proxy.AuthenticationService;

                        // combine urls
                        authServiceUrl = ApplicationServiceManager.MergeServiceUrls(authManager.Path, authServiceUrl, proxy);
                    }
                }
            }
            AuthenticationServiceManager.GenerateInitializationScript(ref sb, context, scriptManager, authServiceUrl);
        }
        protected override void CreateChildControls()
        {
            smCurrentScriptManager = new ScriptManager();
            Controls.Add(smCurrentScriptManager);

            base.CreateChildControls();
        }
        protected virtual bool initAjax()
        {
            if (!VirtualPreviewUtil.IsVirtualPreview(this.Page))
                {
                    ScriptManager scriptManager = AjaxManager.Current;
                    if (AjaxManager.Current == null)
                    {
                        scriptManager = new ScriptManager();
                        scriptManager.ID = StaticSettings.ScriptManagerID;

                        Controls.Add(scriptManager);
                    }

                    if (!scriptManager.EnablePartialRendering)
                    {
                        scriptManager.EnablePartialRendering = true;
                    }

                    if (!AjaxManager.ContainsService(scriptManager, StaticSettings.ServiceReference))
                    {
                        scriptManager.Services.Add(new ServiceReference(StaticSettings.ServiceReference));
                    }
                }

              	return true;
        }
Exemplo n.º 12
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="sm"></param>
		/// <param name="page"></param>
		public static void EnsureScriptManager(ref ScriptManager sm, Page page)
		{
			if (sm == null)
			{
				sm = ScriptManager.GetCurrent(page);
				if (sm == null)
				{
					ExceptionHelper.TrueThrow(page.Form.Controls.IsReadOnly, Resources.DeluxeWebResource.E_NoScriptManager);

					sm = new ScriptManager();

					//根据应用的Debug状态来决定ScriptManager的状态 2008-9-18
					bool debug = WebAppSettings.IsWebApplicationCompilationDebug();
					sm.ScriptMode = debug ? ScriptMode.Debug : ScriptMode.Release;

					sm.EnableScriptGlobalization = true;
					page.Form.Controls.Add(sm);
				}
			}
			else
			{
				ExceptionHelper.FalseThrow(sm.EnableScriptGlobalization, "页面中ScriptManger对象中属性EnableScriptGlobalization值应该设置为True!");
			}

			if (sm != null)
			{
				sm.AsyncPostBackError -= sm_AsyncPostBackError;
				sm.AsyncPostBackError += new EventHandler<AsyncPostBackErrorEventArgs>(sm_AsyncPostBackError);
			}
		}
 public string GetUrl(ScriptManager scriptManager) {
     if (String.IsNullOrEmpty(Path)) {
         return base.GetUrl(scriptManager, false);
     }
     else {
         return scriptManager.ResolveClientUrl(Path);
     }
 }
 public void AddTest_1()
 {
     string temp;
     ScriptManager sm = new ScriptManager();
     bool result = sm.Add("text", true, out temp);
     Assert.IsNotNull(temp);
     Assert.IsFalse(result);
 }
        public void ScriptManager_Constructor_Returns_Not_Null()
        {
            var cacheManager = new Mock<ICacheManager>();
            var contextAccessor = new Mock<IHttpContextAccessor>();
            var target = new ScriptManager(cacheManager.Object, contextAccessor.Object);

            Assert.IsNotNull(target);
        }
 public void AddTest_3()
 {
     string temp;
     ScriptManager sm = new ScriptManager();
     bool result = sm.Add(_incorrectCode, true, out temp);
     Assert.AreNotEqual(temp, "");
     Assert.IsFalse(result);
 }
    public void Start()
    {
        WarCostText.text = "" + Fighter.FighterCost;
        RangeCostText.text = "" + Ranger.RangerCost;
        MageCostText.text = "" + Sorcerer.SorcererCost;

        scriptManager = GameObject.Find("ScriptManager").GetComponent<ScriptManager>();
        spriteModels = scriptManager.spriteModels;
    }       
        public void ScriptManager_Add_Null_Throws_Exception_Test()
        {
            var cacheManager = new Mock<ICacheManager>();
            var contextAccessor = new Mock<IHttpContextAccessor>();
            var target = new ScriptManager(cacheManager.Object, contextAccessor.Object);

            ScriptInfo info = null;
            target.Add(info);
        }
    public void Start()
    {
        scriptmanager = GameObject.Find("ScriptManager").GetComponent<ScriptManager>();

        cameraDefaultPosition = Camera.main.gameObject.transform.position;
        cameraDefaultRotation = Camera.main.gameObject.transform.rotation;

        turnController = scriptmanager.turnController;
    }
Exemplo n.º 20
0
    protected void OnPreInit(EventArgs e)
    {
        ScriptManager oScriptManager = ScriptManager.GetCurrent(Page);
        if (oScriptManager == null)
        {
            oScriptManager = new ScriptManager { ID = "ScriptManager1" };
            Page.Controls.AddAt(0, oScriptManager);
        }

    }
    public void Start()
    {
        scriptManager = GameObject.Find("ScriptManager").GetComponent<ScriptManager>();
        spriteModels = scriptManager.spriteModels;
        turnController = scriptManager.turnController;
        messageController = scriptManager.messageController;
        cameraController = scriptManager.cameraController;

        grid = scriptManager.grid;
    }
 public void AddTest_4()
 {
     string temp;
     ScriptManager sm = new ScriptManager();
     File.WriteAllText("AddTest_4.cs", _correctCode);
     bool result = sm.Add("AddTest_4.cs", true, out temp);
     File.Delete("AddTest_4.cs");
     Assert.AreEqual(temp, "");
     Assert.IsTrue(result);
 }
    public void Start()
    {
        scriptManager = GameObject.Find("ScriptManager").GetComponent<ScriptManager>();
        unitstore = scriptManager.unitStore;
        dumbComputer = scriptManager.dumbComputer;
        guiController = scriptManager.guiController;

        addObstacles();

        SetUpPhase();        
    }
Exemplo n.º 24
0
        //public const string JQueryUrl = "http://code.jquery.com/jquery-1.8.3.min.js";
        public static void Register(ScriptManager scriptManager)
        {
            // Check if JQuery has been added before
            if (scriptManager.Scripts.FirstOrDefault(s => s.Path == JQueryUrl) != null)
            {
                return;
            }

            var sr = new ScriptReference(JQueryUrl);
            scriptManager.Scripts.Add(sr);
        }
        public static MvcHtmlString AddScriptSource(this HtmlHelper helper, Func<dynamic, HelperResult> source, string key, string area = null)
        {
            var scriptType = ScriptType.JavaScript;

            var info = new ScriptInfo(source(null).ToHtmlString(), scriptType, key, area);

            var manager = new ScriptManager();

            manager.Add(info);

            return MvcHtmlString.Empty;
        }
    void Start()
    {
        scriptManager = GameObject.Find("ScriptManager").GetComponent<ScriptManager>();
        turnController = scriptManager.turnController;
        dumbComputer = scriptManager.dumbComputer;
        messageController = scriptManager.messageController;
        gridscr = scriptManager.grid;
        placeunits = scriptManager.placeUnits;
        cameraController = scriptManager.cameraController;

        playerPieces = GameObject.Find("PlayerPieces");
    }
        public static MvcHtmlString AddJavaScript(this HtmlHelper helper, string localPath, string area = null)
        {
            var scriptType = ScriptType.JavaScript;

            var info = new ScriptInfo(localPath, helper.ViewContext.HttpContext.Server.MapPath(localPath).Replace(@"/", @"\"), scriptType,  area);

            var manager = new ScriptManager();

            manager.Add(info);

            return MvcHtmlString.Empty;
        }
Exemplo n.º 28
0
        protected override void CreateChildControls()
        {
            Controls.Clear();
            try
            {
                ScriptManager sm = new ScriptManager();
                sm.Services.Add(new ServiceReference("~/Cathexis.LandingPage.Services.StateServices.asmx"));
                Controls.Add(sm);

                //ScriptManager sm = ScriptManager.GetCurrent(this.Page);
                //sm.Services.Add(new ServiceReference("~/Cathexis.PMA.Core.Services.StateServices.asmx"));

                _ddlState = new DropDownList();
                _ddlState.ID = "ddlState";

                _ddlCountry = new DropDownList();
                _ddlCountry.ID = "ddlCountry";


                _lblMessage = new Label();

                _cddCountry = new CascadingDropDown();
                _cddCountry.ID = "CascadingDropDown1";
                _cddCountry.TargetControlID = _ddlCountry.ID;
                _cddCountry.Category = "country";
                _cddCountry.PromptText = "Select One";
                _cddCountry.LoadingText = "Loading...";
                _cddCountry.ServiceMethod = "GetCountries";
                _cddCountry.ServicePath = "~/Cathexis.LandingPage.Services.StateServices.asmx";

                _cddState = new CascadingDropDown();
                _cddState.ID = "CascadingDropDown2";
                _cddState.TargetControlID = _ddlState.ID;
                _cddState.Category = "state";
                _cddState.PromptText = "Select One";
                _cddState.LoadingText = "Loading...";
                _cddState.ServiceMethod = "GetDropDownContent";
                _cddState.ParentControlID = _ddlCountry.ID;
                _cddState.ServicePath = "~/Cathexis.LandingPage.Services.StateServices.asmx";

                Controls.Add(_ddlCountry);
                Controls.Add(_ddlState);
                Controls.Add(_lblMessage);
                Controls.Add(_cddCountry);
                Controls.Add(_cddState);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }

        }
Exemplo n.º 29
0
        protected override void OnPreRender(EventArgs e)
        {
            if (!this.DesignMode)
            {
                sm = ScriptManager.GetCurrent(Page);

                if (sm == null)
                   throw new HttpException("A ScriptManager control must exist on the page");

                sm.RegisterScriptControl(this);
            }
            base.OnPreRender(e);
        }
Exemplo n.º 30
0
 protected internal virtual string GetProxyScript(ScriptManager scriptManager, Control containingControl) {
     string serviceUrl = GetServiceUrl(containingControl, false);
     try {
         serviceUrl = VirtualPathUtility.Combine(containingControl.Context.Request.FilePath, serviceUrl);
     }
     catch {
         throw new ArgumentException(
             String.Format(CultureInfo.InvariantCulture, AtlasWeb.WebService_InvalidInlineVirtualPath, serviceUrl));
     }
     return WebServiceClientProxyGenerator.GetInlineClientProxyScript(serviceUrl,
         containingControl.Context,
         scriptManager.IsDebuggingEnabled);
 }
Exemplo n.º 31
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        SearchReport.CreateReportReset(); // takes off the selected report in ddlCreateReport

        // get the last Report ID
        string query = "SELECT MAX(ReportId) AS ReportId FROM dbo.Report_MerrylandsRSLSupervisor";
        int lastRId, result, returnFlag = 2;
        // compare date entered to current date
        DateTime temp, date = DateTime.Parse(DateTime.Now.ToShortDateString());
        Report.ErrorMessage = "";

        con.Open();
        SqlCommand getRId = new SqlCommand(query, con);
        try
        {
            lastRId = (int)getRId.ExecuteScalar();
            // add plus one to the current report id to be used in this report
            lastRId += 1;
        }
        catch
        {
            lastRId = 3000001;
        }
        con.Close();

        Report.LastReportId = lastRId.ToString();

        if (txtDatePicker.Text == "")
        {
            Report.ErrorMessage = Report.ErrorMessage + "\\n* Shift Date shouldn't be empty.";
            txtDatePicker.Focus();
            returnFlag = 1;
        }
        else if (!DateTime.TryParse(txtDatePicker.Text, out temp))
        {
            Report.ErrorMessage = Report.ErrorMessage + "\\n* Shifts Date entry is not in date format please select an appropriate date.";
            txtDatePicker.Focus();
            returnFlag = 1;
        }
        else if (DateTime.TryParse(txtDatePicker.Text, out temp))
        {
            // compare selected date to current date
            result = DateTime.Compare(DateTime.Parse(DateTime.Parse(txtDatePicker.Text).ToShortDateString()), date);
            if (result > 0)
            {
                Report.ErrorMessage = Report.ErrorMessage + "\\n* DATE MUST BE BEFORE CURRENT DATE.";
                txtDatePicker.Focus();
                returnFlag = 1;
            }
        }

        if (returnFlag == 1)
        {
            ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", "alert(\"" + Report.ErrorMessage + "\");", true);
            return;
        }

        // change the format of the shift date to timestamp format
        DateTime shift_date = DateTime.Parse(txtDatePicker.Text);
        string shift_tDate = shift_date.ToString("yyyyMMdd");

        // separate the shift date day of week value
        string shift_DOW = shift_date.DayOfWeek.ToString();

        // change the format of the entry date to timestamp format
        DateTime entry_date = DateTime.Now;

        // pop a message if shift is unchanged
        if (ddlShift.SelectedItem.Value == "-1")
        {
            showAlert("Please select Shift.");
            ddlShift.Focus();
            return;
        }

        // get staff's id
        string cmdText = "SELECT StaffId FROM Staff WHERE Username = '******'",
               variable = "getStaff";
        readFiles(cmdText, variable);

        // insert data to table
        using (DataClassesDataContext dc = new DataClassesDataContext())
        {
            Report_MerrylandsRSLSupervisor dm = new Report_MerrylandsRSLSupervisor();
            dm.ReportId = Int32.Parse(Report.LastReportId);
            dm.RCatId = 3; // MR Supervisor Category
            dm.StaffId = Int32.Parse(Session["currentStaffId"].ToString());
            dm.StaffName = UserCredentials.DisplayName;
            dm.ShiftId = Int32.Parse(ddlShift.SelectedItem.Value);
            dm.ShiftDate = shift_date.Date;
            dm.ShiftDOW = shift_DOW;
            dm.EntryDate = entry_date;
            dm.Report_Table = "Report_MerrylandsRSLSupervisor";
            dm.AuditVersion = 1;
            dm.ReportStat = "Awaiting Completion";
            dm.Report_Version = 1; // current version
            dm.ReadByList = "," + UserCredentials.StaffId + ",";
            dm.SignInSlip = txtSignInSlip.Text.Replace("\n", "<br />").Replace("'", "^");
            dm.Reception = txtReception.Text.Replace("\n","<br />").Replace("'", "^");
            dm.Gaming = txtGaming.Text.Replace("\n","<br />").Replace("'", "^");
            dm.Bar = txtBar.Text.Replace("\n","<br />").Replace("'", "^");
            dm.TabKeno = txtTABKeno.Text.Replace("\n","<br />").Replace("'", "^");
            dm.HouseKeeping = txtHouseKeep.Text.Replace("\n","<br />").Replace("'", "^");
            dm.Bistro = txtBistro.Text.Replace("\n","<br />").Replace("'", "^");
            dm.FoodHygiene = txtFoodHygiene.Text.Replace("\n","<br />").Replace("'", "^");
            dm.Events = txtEvents.Text.Replace("\n","<br />").Replace("'", "^");
            dm.CustomerService = txtCustomerServ.Text.Replace("\n","<br />").Replace("'", "^");
            dm.GeneralComments = txtGenComm.Text.Replace("\n","<br />").Replace("'", "^");
            dm.LuckyRewards = txtLuckyRewards.Text.Replace("\n","<br />").Replace("'", "^");
            dm.RSA = txtRSA.Text.Replace("\n","<br />").Replace("'", "^");
            dm.AMLCTF = txtAMLCTF.Text.Replace("\n","<br />").Replace("'", "^");
            dc.Report_MerrylandsRSLSupervisors.InsertOnSubmit(dm);
            dc.SubmitChanges();
        }

        //log the create activity
        RunStoredProcedure rsp = new RunStoredProcedure();
        try
        {
            rsp.Log(4, Int32.Parse(Report.LastReportId));
        }
        catch { }

        //showAlert("Report Submitted.");
        //Response.Redirect("Default.aspx", false);
        ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect",
        "alert('Report Submitted.'); window.location='" +
        Request.ApplicationPath + "Default.aspx';", true);
        SearchReport.SetAccordion = "1";
        SearchReport.RunOnStart = true;
        SearchReport.FromCreateReport = true;
    }
Exemplo n.º 32
0
 protected void showAlert(string message)
 {
     // display a message box
     message = "alert(\"" + message + "\");";
     ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", message, true);
 }
Exemplo n.º 33
0
 private void ExceptionHandler(string errorMsg, string expMsg)
 {
     //redirecting to exception page from javascript. to avoid prompt on window close when exception occured
     Session["Exception_Reason"] = errorMsg + "<br />" + expMsg;
     ScriptManager.RegisterStartupScript(this, typeof(Page), "ErrorPage", "RedirectToErrorPage();", true);
 }
Exemplo n.º 34
0
        /// <summary>
        /// 儲存
        /// </summary>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int SID = int.Parse(Request.QueryString["id"].ToString());

            #region Update SubjectInfo

            //第幾次上課
            string SubCount = txtSubCount1.Text.Trim() + int.Parse(txtSubCount2.Text).ToString("00").Trim();

            //報名條件
            string SUCondition = txtSUCondition.Text;

            //地點
            string SubLocation = txtSubLocation.Text;

            //報名日期
            string SubStrDate = txtSubStrDate.Text;

            //報名截止
            string SubEndDate = txtSubEndDate.Text;

            //備註
            string Memo = txtMemo.Text;

            //HTML
            StringBuilder sb = new StringBuilder();
            sb.Append("<div class='class-info'>");
            sb.Append("<div role='alert' class='el - alert el - alert--info'>");
            sb.Append("<!---->");
            sb.Append("<div class='el - alert__content'>");
            sb.Append("<!---->");
            sb.Append("<p class='el - alert__description'>");
            sb.Append("本表個人資料將作建檔處理,並於日後會務活動運作之目的內,由教會及同工作為聯絡通訊、關懷及相關合理運用。我們會盡善良管理人責任,妥善保管資料,避免外洩或不當用途之使用。");
            sb.Append("</p>");
            sb.Append("<i class='el - alert__closebtn el - icon - close' style='display: none; '>");
            sb.Append("</i>");
            sb.Append("</div>");
            sb.Append("</div>");
            sb.Append("<ul class='class-detail'>");
            sb.Append("<li>");

            sb.Append("<div class='class-detail-title'>");
            sb.Append("報名條件:"); //SUCondition
            sb.Append("</div>");
            sb.Append("<div class='class-detail-text'>");
            //2018年1月~2018年12月來的新朋友,或是還沒上過的會友。
            sb.Append(SUCondition);
            sb.Append("</div>");
            sb.Append("</li>");
            sb.Append("<li>");

            sb.Append("<div class='class-detail-title'>");
            sb.Append("上課日期:"); //SDate, SubTime
            sb.Append("</div>");
            sb.Append("<div class='class-detail-text'>");

            //08/05(日)、08/12(日) 下午 14:30~17:30
            if (ckbIsSub12.Checked)
            {
                sb.Append("C1 一、二課:" + txtSDate12.Text.Trim().Replace(DateTime.UtcNow.AddHours(8).Year.ToString() + "/", "") +
                          "(" + Api_Info.GetDayOfWeek(DateTime.Parse(txtSDate12.Text.Trim())) + ") " + " ");
                sb.Append(dropSubTime12.Text + " " + txtSubTime12.Text.Trim());
            }

            if (ckbIsSub34.Checked)
            {
                sb.Append("<br/>");
                sb.Append("C1 三、四課:" + txtSDate34.Text.Trim().Replace(DateTime.UtcNow.AddHours(8).Year.ToString() + "/", "") +
                          "(" + Api_Info.GetDayOfWeek(DateTime.Parse(txtSDate34.Text.Trim())) + ") " + " ");
                sb.Append(dropSubTime34.Text + " " + txtSubTime34.Text.Trim());
            }

            sb.Append("</div>");
            sb.Append("</li>");
            sb.Append("<li>");

            sb.Append("<div class='class-detail-title'>");
            sb.Append("地點:"); //SubLocation
            sb.Append("</div>");
            sb.Append("<div class='class-detail-text'>");
            //江子翠行道會主會堂
            sb.Append(SubLocation.Replace("\r\n", "<br/>"));
            sb.Append("</div>");
            sb.Append("</li>");
            sb.Append("<li>");

            sb.Append("<div class='class-detail-title'>");
            sb.Append("報名日期:"); //SubEndDate
            sb.Append("</div>");
            sb.Append("<div class='class-detail-text'>");
            //即日起~07/31(二) 截止報名,之後請現場報名。
            sb.Append("即日起~" +
                      SubEndDate.Replace(DateTime.UtcNow.AddHours(8).Year.ToString() + "/", "") +
                      "(" + Api_Info.GetDayOfWeek(DateTime.Parse(SubEndDate)) + ") " +
                      "截止報名,之後請現場報名。");
            sb.Append("</div>");

            sb.Append("<div class='class-detail-title'>");
            sb.Append("備註:"); //Memo
            sb.Append("</div>");
            sb.Append("<div class='class-detail-text'>");
            sb.Append(Memo.Replace("\r\n", "<br/>"));
            sb.Append("</div>");


            sb.Append("</li>");
            sb.Append("</ul>");
            sb.Append("</div>");
            string HtmlSubDesc = sb.ToString();


            SubjectInfo.Update_SubjectInfo(SubCount, SUCondition, SubLocation, SubStrDate, SubEndDate, SID, Memo, HtmlSubDesc, ckbIsCheckOpen.Checked, 99999);

            #endregion

            #region Update SubjectDate

            //上課時間
            //C1 一、二課
            SubjectDate.DelSubjectDate(SID, "C112");
            if (ckbIsSub12.Checked)
            {
                //更新課程
                SubjectDate.InsSubjectDate(
                    SID,
                    "C112",
                    txtSDate12.Text.Trim(),
                    dropSubTime12.Text + " " + txtSubTime12.Text.Trim()
                    );
            }


            //C1 三、四課
            SubjectDate.DelSubjectDate(SID, "C134");
            if (ckbIsSub34.Checked)
            {
                //更新課程
                SubjectDate.InsSubjectDate(
                    SID,
                    "C134",
                    txtSDate34.Text.Trim(),
                    dropSubTime34.Text + " " + txtSubTime34.Text.Trim()
                    );
            }

            SubjectInfo.sp_Delete_SubjectInfo(SID);

            #endregion

            btnSave.PostBackUrl = "~/Admin/SubjectData/SubjectList.aspx";
            ScriptManager.RegisterStartupScript(Page, GetType(), "Save", "<script>clickSave()</script>", false);
            //Response.Write("<script>alert('C1 課程儲存成功!');location.href='SubjectList.aspx';</script>");
        }
Exemplo n.º 35
0
 protected void ImageButton2_Click(object sender, EventArgs e)
 {
     ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "window.open('UploadModeloFinancieroEvaluador.aspx','_blank','width=580,height=300,toolbar=no, scrollbars=no, resizable=no');", true);
 }
Exemplo n.º 36
0
    protected void SerachButton_Click(object sender, EventArgs e)
    {
        StringBuilder sbMaster     = new StringBuilder();
        DataTable     dtSearchInfo = new DataTable();

        if (string.Compare(fundCodeDDL.SelectedValue.ToString().ToUpper(), "IAMPH", true) == 0)
        {
            sbMaster.Append("SELECT REG_BK, REG_BR, REG_NO, HNAME, ADDRESS, JNT_NAME, CIP, ID_FLAG, BK_FLAG,TIN,NID,FMH_NAME,MO_NAME,BIRTH_CERT_NO,PASS_NO,MOBILE1  ");
            sbMaster.Append(" FROM  (SELECT   U_MASTER.REG_BK, U_MASTER.REG_BR, U_MASTER.REG_NO, U_MASTER.HNAME,U_MASTER.TIN,U_MASTER.NID, U_MASTER.FMH_NAME, U_MASTER.MO_NAME,U_MASTER.PASS_NO, U_MASTER.BIRTH_CERT_NO, U_MASTER.MOBILE1,");
            sbMaster.Append(" U_MASTER.ADDRS1 || U_MASTER.ADDRS2 || ',' || U_MASTER.CITY AS ADDRESS, NULL AS JNT_NAME,U_MASTER.CIP,");
            sbMaster.Append(" U_MASTER.ID_FLAG, U_MASTER.BK_FLAG  FROM U_MASTER) A WHERE 1=1 AND REG_BK='" + fundCodeDDL.SelectedValue.ToString().ToUpper() + "'");
        }
        else
        {
            sbMaster.Append("SELECT REG_BK, REG_BR, REG_NO, HNAME, ADDRESS, JNT_NAME, CIP, ID_FLAG, BK_FLAG,TIN,NID,FMH_NAME,MO_NAME,BIRTH_CERT_NO,PASS_NO,MOBILE1 ");
            sbMaster.Append(" FROM  (SELECT   U_MASTER.REG_BK, U_MASTER.REG_BR, U_MASTER.REG_NO, U_MASTER.HNAME,U_MASTER.TIN,U_MASTER.NID, U_MASTER.FMH_NAME, U_MASTER.MO_NAME,U_MASTER.PASS_NO, U_MASTER.BIRTH_CERT_NO, U_MASTER.MOBILE1,");
            sbMaster.Append(" U_MASTER.ADDRS1 || U_MASTER.ADDRS2 || ',' || U_MASTER.CITY AS ADDRESS, U_JHOLDER.JNT_NAME, U_MASTER.CIP,");
            sbMaster.Append(" U_MASTER.ID_FLAG, U_MASTER.BK_FLAG  FROM U_MASTER LEFT OUTER JOIN   U_JHOLDER ON U_MASTER.REG_BK = U_JHOLDER.REG_BK AND U_MASTER.REG_BR = U_JHOLDER.REG_BR AND");
            sbMaster.Append(" U_MASTER.REG_NO = U_JHOLDER.REG_NO) A WHERE 1=1 AND REG_BK='" + fundCodeDDL.SelectedValue.ToString().ToUpper() + "'");

            if (jHolderTextBox.Text != "")
            {
                sbMaster.Append(" AND ( JNT_NAME LIKE '%" + jHolderTextBox.Text.Trim().ToUpper().ToString() + "%')");
            }
        }
        if (regNoTextBox.Text != "")
        {
            sbMaster.Append(" AND (REG_NO=" + Convert.ToInt32(regNoTextBox.Text.Trim()) + ")");
            sbMaster.Append(" AND (REG_BR='" + branchCodeDDL.SelectedValue.ToString() + "')");
        }
        if (holderNameTextBox.Text != "")
        {
            sbMaster.Append(" AND ( HNAME LIKE '%" + holderNameTextBox.Text.Trim().ToUpper().ToString() + "%')");
        }
        if (holderAddressTextBox.Text != "")
        {
            sbMaster.Append(" AND ( ADDRESS LIKE '%" + holderAddressTextBox.Text.Trim().ToUpper().ToString() + "%')");
        }
        if (NIDTextBox.Text != "")
        {
            sbMaster.Append(" AND ( NID = '" + NIDTextBox.Text.Trim().ToUpper().ToString() + "')");
        }
        if (TINTextBox.Text != "")
        {
            sbMaster.Append(" AND (  TIN = '" + TINTextBox.Text.Trim().ToUpper().ToString() + "')");
        }
        if (mobileNumberTextBox.Text != "")
        {
            sbMaster.Append(" AND ( MOBILE1 = '" + mobileNumberTextBox.Text.Trim().ToUpper().ToString() + "')");
        }
        if (PassportNoTextBox.Text != "")
        {
            sbMaster.Append(" AND ( PASS_NO = '" + PassportNoTextBox.Text.Trim().ToUpper().ToString() + "')");
        }
        if (BirthCertNoTextBox.Text != "")
        {
            sbMaster.Append(" AND (  BIRTH_CERT_NO= '" + BirthCertNoTextBox.Text.Trim().ToUpper().ToString() + "')");
        }
        if (certNoDropDownList.SelectedValue != "0" && certNoTextBox.Text != "")
        {
            sbMaster.Append(" AND REG_NO IN (SELECT REG_NO FROM SALE_CERT WHERE CERT_TYPE='" + certNoDropDownList.SelectedValue.ToString() + "' AND CERT_NO=" + Convert.ToUInt32(certNoTextBox.Text.Trim().ToString()) + " )");
            sbMaster.Append(" AND REG_BR IN (SELECT REG_BR FROM SALE_CERT WHERE CERT_TYPE='" + certNoDropDownList.SelectedValue.ToString() + "' AND CERT_NO=" + Convert.ToUInt32(certNoTextBox.Text.Trim().ToString()) + " )");
        }
        sbMaster.Append(" ORDER BY REG_BR, REG_NO");

        if (string.Compare(fundCodeDDL.SelectedValue.ToString().ToUpper(), "IAMPH", true) == 0)
        {
            OracleConnection Conn = new OracleConnection(ConfigReader.PENSION.ToString());
            Conn.Open();
            dtSearchInfo = commonGatewayObj.Select(sbMaster.ToString(), Conn);
        }
        else
        {
            dtSearchInfo = commonGatewayObj.Select(sbMaster.ToString());
        }
        if (dtSearchInfo.Rows.Count > 0)
        {
            totalRecordCountLabel.Text = dtSearchInfo.Rows.Count.ToString();
            dvSearchRegi.Visible       = true;

            dgSearchRegi.DataSource = dtSearchInfo;
            dgSearchRegi.DataBind();
        }
        else
        {
            dvSearchRegi.Visible       = false;
            totalRecordCountLabel.Text = "0";
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('No Data Found');", true);
        }
    }
Exemplo n.º 37
0
 public void Show(string message)
 {
     ScriptManager.RegisterStartupScript(this, GetType(), "msg", "alert('" + message + "');", true);
 }
Exemplo n.º 38
0
 protected void dgDebitNote_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         if ((string)e.CommandArgument == "0" || (string)e.CommandArgument == "")
         {
             return;
         }
         if (e.CommandName.Equals("View"))
         {
             if (CommonClasses.ValidRights(int.Parse(right.Substring(1, 1)), this, "For View"))
             {
                 string type     = "VIEW";
                 string inv_code = e.CommandArgument.ToString();
                 Response.Redirect("~/Transactions/ADD/DebitNote.aspx?c_name=" + type + "&inv_code=" + inv_code, false);
             }
             else
             {
                 PanelMsg.Visible = true;
                 lblmsg.Text      = "You Have No Rights To View";
                 ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                 return;
             }
         }
         if (e.CommandName.Equals("Modify"))
         {
             if (CommonClasses.ValidRights(int.Parse(right.Substring(2, 1)), this, "For Modify"))
             {
                 if (!ModifyLog(e.CommandArgument.ToString()))
                 {
                     string type     = "MODIFY";
                     string inv_code = e.CommandArgument.ToString();
                     Response.Redirect("~/Transactions/ADD/DebitNote.aspx?c_name=" + type + "&inv_code=" + inv_code, false);
                 }
             }
             else
             {
                 PanelMsg.Visible = true;
                 lblmsg.Text      = "You Have No Rights To Modify";
                 ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                 return;
             }
         }
         if (e.CommandName.Equals("Print"))
         {
             if (CommonClasses.ValidRights(int.Parse(right.Substring(5, 1)), this, "For Print"))
             {
                 if (!ModifyLog(e.CommandArgument.ToString()))
                 {
                     //string type = rbReportType.SelectedValue.ToString();  //&rptType=" + rptType + "
                     string inv_code = e.CommandArgument.ToString();
                     Code = inv_code;
                     type = "Single";
                     Response.Redirect("~/RoportForms/ADD/DebitPrint.aspx?inv_code=" + inv_code + "&type=" + type, false);
                     //type = "Single";
                     //Response.Redirect("~/RoportForms/ADD/TaxInvoicePrint.aspx?inv_code=" + inv_code + "&type=" + type, false);
                     //popUpPanel5.Visible = true;
                     //ModalPopupPrintSelection.Show();
                     //return;
                 }
             }
             else
             {
                 PanelMsg.Visible = true;
                 lblmsg.Text      = "You Have No Rights To Print";
                 ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                 return;
             }
         }
         if (e.CommandName.Equals("PrintMult"))
         {
             if (!ModifyLog(e.CommandArgument.ToString()))
             {
                 //string type = "MODIFY";
                 //string inv_code = e.CommandArgument.ToString();
                 //type = "Mult";
                 //Response.Redirect("~/RoportForms/VIEW/ViewInvoiceReport.aspx?inv_code=" + inv_code + "&type=" + type, false);
                 //popUpPanel5.Visible = true;
                 //ModalPopupPrintSelection.Show();
                 //return;
             }
         }
     }
     catch (Exception Ex)
     {
         CommonClasses.SendError("Tax Invoice View", "dgDebitNote_RowCommand", Ex.Message);
     }
 }
Exemplo n.º 39
0
        protected void btnOrder_Click(object sender, EventArgs e)
        {
            DateTime currentDate = DateTime.Now;
            string   username    = Request.Cookies["userLoginSystem"].Value;
            var      acc         = AccountController.GetByUsername(username);

            if (acc != null)
            {
                if (acc.RoleID == 0 || acc.RoleID == 2)
                {
                    // Change user
                    string OrderNote = "";
                    if (username != hdfUsernameCurrent.Value)
                    {
                        OrderNote = "Được tính tiền giúp bởi " + username;
                        username  = hdfUsernameCurrent.Value;
                    }

                    int    AgentID     = Convert.ToInt32(acc.AgentID);
                    int    OrderType   = hdfOrderType.Value.ToInt();
                    string AdditionFee = "0";
                    string DisCount    = "0";
                    int    CustomerID  = 0;

                    string CustomerPhone   = txtPhone.Text.Trim().Replace(" ", "");
                    string CustomerName    = txtFullname.Text.Trim();
                    string Nick            = txtNick.Text.Trim();
                    string CustomerEmail   = "";
                    string CustomerAddress = txtAddress.Text.Trim();

                    var checkCustomer = CustomerController.GetByPhone(CustomerPhone);

                    if (checkCustomer != null)
                    {
                        CustomerID = checkCustomer.ID;
                        string kq = CustomerController.Update(CustomerID, CustomerName, checkCustomer.CustomerPhone, CustomerAddress, "", Convert.ToInt32(checkCustomer.CustomerLevelID), Convert.ToInt32(checkCustomer.Status), checkCustomer.CreatedBy, currentDate, username, false, checkCustomer.Zalo, checkCustomer.Facebook, checkCustomer.Note, checkCustomer.ProvinceID.ToString(), Nick, checkCustomer.Avatar, Convert.ToInt32(checkCustomer.ShippingType), Convert.ToInt32(checkCustomer.PaymentType), Convert.ToInt32(checkCustomer.TransportCompanyID), Convert.ToInt32(checkCustomer.TransportCompanySubID), checkCustomer.CustomerPhone2);
                    }
                    else
                    {
                        string kq = CustomerController.Insert(CustomerName, CustomerPhone, CustomerAddress, CustomerEmail, 0, 0, currentDate, username, false, "", "", "", "", Nick);
                        if (kq.ToInt(0) > 0)
                        {
                            CustomerID = kq.ToInt(0);
                        }
                    }

                    string totalPrice            = hdfTotalPrice.Value.ToString();
                    string totalPriceNotDiscount = hdfTotalPriceNotDiscount.Value;
                    int    PaymentStatus         = 3;
                    int    ExcuteStatus          = 2;
                    int    PaymentType           = 1;
                    int    ShippingType          = 1;
                    bool   IsHidden = false;
                    int    WayIn    = 1;

                    double DiscountPerProduct = Convert.ToDouble(pDiscount.Value);

                    double TotalDiscount = Convert.ToDouble(pDiscount.Value) * Convert.ToDouble(hdfTotalQuantity.Value);
                    string FeeShipping   = pFeeShip.Value.ToString();
                    double GuestPaid     = Convert.ToDouble(pGuestPaid.Value);
                    double GuestChange   = Convert.ToDouble(totalPrice) - GuestPaid;
                    string OtherFeeName  = txtOtherFeeName.Text;
                    double OtherFeeValue = Convert.ToDouble(pOtherFee.Value);

                    var ret = OrderController.InsertOnSystem(AgentID, OrderType, AdditionFee, DisCount, CustomerID, CustomerName, CustomerPhone, CustomerAddress,
                                                             CustomerEmail, totalPrice, totalPriceNotDiscount, PaymentStatus, ExcuteStatus, IsHidden, WayIn, currentDate, username, DiscountPerProduct,
                                                             TotalDiscount, FeeShipping, GuestPaid, GuestChange, PaymentType, ShippingType, OrderNote, DateTime.Now, OtherFeeName, OtherFeeValue, 1);
                    int OrderID = ret.ID;

                    if (OrderID > 0)
                    {
                        ProductPOS              POS          = JsonConvert.DeserializeObject <ProductPOS>(hdfListProduct.Value);
                        List <tbl_OrderDetail>  orderDetails = new List <tbl_OrderDetail>();
                        List <tbl_StockManager> stockManager = new List <tbl_StockManager>();

                        foreach (ProductGetOut item in POS.productPOS)
                        {
                            orderDetails.Add(
                                new tbl_OrderDetail()
                            {
                                AgentID                   = AgentID,
                                OrderID                   = OrderID,
                                SKU                       = item.SKU,
                                ProductID                 = item.ProductType == 1 ? item.ProductID : 0,
                                ProductVariableID         = item.ProductType == 1 ? 0 : item.ProductVariableID,
                                ProductVariableDescrition = item.ProductVariableSave,
                                Quantity                  = item.QuantityInstock,
                                Price                     = item.Giabanle,
                                Status                    = 1,
                                DiscountPrice             = 0,
                                ProductType               = item.ProductType,
                                CreatedDate               = currentDate,
                                CreatedBy                 = username,
                                IsCount                   = true
                            }
                                );

                            int parentID = item.ProductID;
                            var variable = ProductVariableController.GetByID(item.ProductVariableID);
                            if (variable != null)
                            {
                                parentID = Convert.ToInt32(variable.ProductID);
                            }

                            stockManager.Add(
                                new tbl_StockManager()
                            {
                                AgentID           = AgentID,
                                ProductID         = item.ProductType == 1 ? item.ProductID : 0,
                                ProductVariableID = item.ProductType == 1 ? 0 : item.ProductVariableID,
                                Quantity          = item.QuantityInstock,
                                QuantityCurrent   = 0,
                                Type        = 2,
                                NoteID      = "Xuất kho bán POS",
                                OrderID     = OrderID,
                                Status      = 3,
                                SKU         = item.SKU,
                                CreatedDate = currentDate,
                                CreatedBy   = username,
                                MoveProID   = 0,
                                ParentID    = parentID
                            }
                                );
                        }

                        OrderDetailController.Insert(orderDetails);
                        StockManagerController.Insert(stockManager);

                        string refund = Request.Cookies["refund"].Value;
                        if (refund != "1")
                        {
                            string[] RefundID = refund.Split('|');
                            var      update   = RefundGoodController.UpdateStatus(RefundID[0].ToInt(), username, 2, OrderID);
                            var      updateor = OrderController.UpdateRefund(OrderID, RefundID[0].ToInt(), username);
                        }

                        Response.Cookies["refund"].Expires = DateTime.Now.AddDays(-1d);
                        Response.Cookies.Add(Response.Cookies["refund"]);

                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$(function () { printInvoice(" + OrderID + ") });", true);
                    }
                }
            }
        }
Exemplo n.º 40
0
    //设置进度
    protected void Button1_Com1(object sender, EventArgs e)
    {
        try
        {
            if (labelcodition.Text == "设置")//新增进度
            {
                string TB1;
                int    TB3;
                string TB2;
                int    TB4;
                if (TextBox1.Text.ToString() == "")
                {
                    ScriptManager.RegisterClientScriptBlock(UpdatePanel_ProjectSchedule, GetType(), "alert", "alert('标记*的为必填项,请填写完整!')", true);
                    return;
                }
                else
                {
                    TB1 = TextBox1.Text.ToString();
                }
                if (TextBox3.Text == "")
                {
                    ScriptManager.RegisterClientScriptBlock(UpdatePanel_ProjectSchedule, GetType(), "alert", "alert('标记*的为必填项,请填写完整!')", true);
                    return;
                }
                else
                {
                    TB3 = Int32.Parse(TextBox3.Text.ToString());
                }
                if (TextBox2.Text.ToString() == "")
                {
                    ScriptManager.RegisterClientScriptBlock(UpdatePanel_ProjectSchedule, GetType(), "alert", "alert('标记*的为必填项,请填写完整!')", true);
                    return;
                }
                else
                {
                    TB2 = TextBox2.Text.ToString();
                }
                if (TextBox4.Text.ToString() == "")
                {
                    ScriptManager.RegisterClientScriptBlock(UpdatePanel_ProjectSchedule, GetType(), "alert", "alert('标记*的为必填项,请填写完整!')", true);
                    return;
                }
                else
                {
                    TB4 = Int32.Parse(TextBox4.Text.ToString());
                }

                string    condition = "and PRMP_ID='" + label_supplytypeid.Text.ToString() + "'" + "and PRMPS_Num='" + TextBox4.Text.ToString() + "'";
                DataSet   ds        = prmps.SelectPRMProject_Schedule_One(condition);
                DataTable dt        = ds.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    ScriptManager.RegisterClientScriptBlock(UpdatePanel_ProjectSchedule, GetType(), "alert", "alert('该进度序号已存在!')", true);
                    return;
                }
                else
                {
                    Guid   ips  = new Guid(label_supplytypeid.Text);
                    string name = Session["UserName"].ToString().Trim();
                    prmps.InsertPRMProjectSchedule(ips, TB1, TB3, TB2, name, TB4);
                    BindGridView_ProjectSchedule(ips);
                }
            }
            if (labelcodition.Text == "修改")//修改进度
            {
                string TB1;
                int    TB3;
                string TB2;
                if (TextBox1.Text.ToString() == "")
                {
                    ScriptManager.RegisterClientScriptBlock(UpdatePanel_ProjectSchedule, GetType(), "alert", "alert('标记*的为必填项,请填写完整!')", true);
                    return;
                }
                else
                {
                    TB1 = TextBox1.Text.ToString();
                }
                if (TextBox3.Text == "")
                {
                    ScriptManager.RegisterClientScriptBlock(UpdatePanel_ProjectSchedule, GetType(), "alert", "alert('标记*的为必填项,请填写完整!')", true);
                    return;
                }
                else
                {
                    TB3 = Int32.Parse(TextBox3.Text.ToString());
                }
                if (TextBox2.Text.ToString() == "")
                {
                    ScriptManager.RegisterClientScriptBlock(UpdatePanel_ProjectSchedule, GetType(), "alert", "alert('标记*的为必填项,请填写完整!')", true);
                    return;
                }
                else
                {
                    TB2 = TextBox2.Text.ToString();
                }

                Guid   ips  = new Guid(label1_BasicID.Text.ToString());
                string name = Session["UserName"].ToString().Trim();
                prmps.UpdatePRMProjectSchedule(ips, TB1, TB3, TB2, name);
                Guid iips = new Guid(label_supplytypeid.Text.ToString());
                BindGridView_ProjectSchedule(iips);
            }
            labelcodition.Text      = "设置";
            TextBox4.Enabled        = true;
            label_Setting.Text      = label_PNum.Text + "  " + label_PName.Text + "  " + "进度设置";
            TextBox1.Text           = "";
            TextBox3.Text           = "";
            TextBox2.Text           = "";
            TextBox4.Text           = "";
            Panel_PSchedule.Visible = true;
            UpdatePanel_PSchedule.Update();
        }
        catch (Exception)
        {
            throw;
        }
    }
Exemplo n.º 41
0
    //安排部门、设置进度、查看进度的链接
    protected void Gridview_Project_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Check1")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            Gridview2.SelectedIndex = row.RowIndex;
            label_supplytypeid.Text = Convert.ToString(e.CommandArgument);
            Guid      pps = new Guid(label_supplytypeid.Text);
            DataSet   ds  = prmp.SelectPRMProject_One(pps);
            DataTable dt  = ds.Tables[0];
            if (dt.Rows.Count > 0)
            {
                label_PNum.Text  = dt.Rows[0][1].ToString();
                label_PName.Text = dt.Rows[0][2].ToString();
            }
            label_arrange.Text = label_PNum.Text + "  " + label_PName.Text + "  " + "安排部门";
            BindGridView_Organizationinfo("");
            Panel_Organization.Visible = true;
            UpdatePanel_Organization.Update();
        }
        if (e.CommandName == "Check2")
        {
            // int index = Convert.ToInt32(e.CommandArgument);

            //GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            Gridview2.SelectedIndex = row.RowIndex;
            label1_PanelSupply.Text = e.CommandArgument.ToString();
            string sg = "";
            label_supplytypeid.Text = Convert.ToString(e.CommandArgument);
            Guid      pps = new Guid(label_supplytypeid.Text);
            DataSet   ds  = prmp.SelectPRMProject_One(pps);
            DataTable dt  = ds.Tables[0];
            if (dt.Rows.Count > 0)
            {
                label_PNum.Text  = dt.Rows[0][1].ToString();
                label_PName.Text = dt.Rows[0][2].ToString();
                sg = dt.Rows[0][9].ToString();
            }
            if (Session["Department"].ToString() == sg)
            {
                TextBox1.Text                 = "";
                TextBox3.Text                 = "";
                TextBox2.Text                 = "";
                TextBox4.Text                 = "";
                labelcodition.Text            = "设置";
                Button6.Visible               = true;
                Button7.Visible               = true;
                Button9.Visible               = false;
                Gridview1.Columns[5].Visible  = true;
                Gridview1.Columns[6].Visible  = true;
                Panel_ProjectSchedule.Visible = true;
                Panel_PSchedule.Visible       = true;
                TextBox4.Enabled              = true;
                UpdatePanel_ProjectSchedule.Update();
                UpdatePanel_PSchedule.Update();
                label_Setting.Text = label_PNum.Text + "  " + label_PName.Text + "  " + "进度设置";
                label_JDB.Text     = label_PNum.Text + "  " + label_PName.Text + "  " + "进度表";
                BindGridView_ProjectSchedule(pps);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(Page, GetType(), "aa", "alert('抱歉,你没有此权限!')", true);
                return;
            }
        }
        if (e.CommandName == "Look1")
        {
            GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow;
            Gridview2.SelectedIndex = row.RowIndex;
            label_supplytypeid.Text = Convert.ToString(e.CommandArgument);
            Guid      pps = new Guid(label_supplytypeid.Text);
            DataSet   ds  = prmp.SelectPRMProject_One(pps);
            DataTable dt  = ds.Tables[0];
            if (dt.Rows.Count > 0)
            {
                label_PNum.Text  = dt.Rows[0][1].ToString();
                label_PName.Text = dt.Rows[0][2].ToString();
            }
            label_JDB.Text = label_PNum.Text + "  " + label_PName.Text + "  " + "进度表";
            BindGridView_ProjectSchedule(pps);
            Panel_PSchedule.Visible = true;

            Gridview1.Columns[5].Visible = false;
            Gridview1.Columns[6].Visible = false;
            Button6.Visible = false;
            Button7.Visible = false;
            Button9.Visible = true;
            UpdatePanel_PSchedule.Update();
        }
    }
Exemplo n.º 42
0
        private bool PushChanges(IWin32Window owner)
        {
            ErrorOccurred = false;
            if (PushToUrl.Checked && string.IsNullOrEmpty(PushDestination.Text))
            {
                MessageBox.Show(owner, _selectDestinationDirectory.Text);
                return(false);
            }

            if (/* PushToRemote.Checked */ !CheckIfRemoteExist())
            {
                return(false);
            }

            var selectedRemoteName = _selectedRemote.Name;

            if (TabControlTagBranch.SelectedTab == TagTab && string.IsNullOrEmpty(TagComboBox.Text))
            {
                MessageBox.Show(owner, _selectTag.Text);
                return(false);
            }

            // Extra check if the branch is already known to the remote, give a warning when not.
            // This is not possible when the remote is an URL, but this is ok since most users push to
            // known remotes anyway.
            if (TabControlTagBranch.SelectedTab == BranchTab && PushToRemote.Checked &&
                !Module.IsBareRepository())
            {
                // If the current branch is not the default push, and not known by the remote
                // (as far as we know since we are disconnected....)
                if (_NO_TRANSLATE_Branch.Text != AllRefs &&
                    RemoteBranch.Text != _remoteManager.GetDefaultPushRemote(_selectedRemote, _NO_TRANSLATE_Branch.Text) &&
                    !IsBranchKnownToRemote(selectedRemoteName, RemoteBranch.Text))
                {
                    // Ask if this is really what the user wants
                    if (!AppSettings.DontConfirmPushNewBranch &&
                        MessageBox.Show(owner, _branchNewForRemote.Text, _pushCaption.Text, MessageBoxButtons.YesNo) == DialogResult.No)
                    {
                        return(false);
                    }
                }
            }

            if (PushToUrl.Checked)
            {
                var path = PushDestination.Text;
                ThreadHelper.JoinableTaskFactory.Run(() => RepositoryHistoryManager.Remotes.AddAsMostRecentAsync(path));
            }

            AppSettings.RecursiveSubmodules = RecursiveSubmodules.SelectedIndex;

            var    remote = "";
            string destination;

            if (PushToUrl.Checked)
            {
                destination = PushDestination.Text;
            }
            else
            {
                EnsurePageant(selectedRemoteName);

                destination = selectedRemoteName;
                remote      = selectedRemoteName.Trim();
            }

            string pushCmd;

            if (TabControlTagBranch.SelectedTab == BranchTab)
            {
                bool track = ReplaceTrackingReference.Checked;
                if (!track && !string.IsNullOrWhiteSpace(RemoteBranch.Text))
                {
                    GitRef selectedLocalBranch = _NO_TRANSLATE_Branch.SelectedItem as GitRef;
                    track = selectedLocalBranch != null && string.IsNullOrEmpty(selectedLocalBranch.TrackingRemote) &&
                            !UserGitRemotes.Any(x => _NO_TRANSLATE_Branch.Text.StartsWith(x.Name, StringComparison.OrdinalIgnoreCase));
                    var autoSetupMerge = Module.EffectiveConfigFile.GetValue("branch.autoSetupMerge");
                    if (autoSetupMerge.IsNotNullOrWhitespace() && autoSetupMerge.ToLowerInvariant() == "false")
                    {
                        track = false;
                    }

                    if (track && !AppSettings.DontConfirmAddTrackingRef)
                    {
                        var result = MessageBox.Show(owner,
                                                     string.Format(_updateTrackingReference.Text, selectedLocalBranch.Name, RemoteBranch.Text),
                                                     _pushCaption.Text,
                                                     MessageBoxButtons.YesNoCancel);
                        if (result == DialogResult.Cancel)
                        {
                            return(false);
                        }

                        track = result == DialogResult.Yes;
                    }
                }

                if (ForcePushBranches.Checked)
                {
                    if (GitCommandHelpers.VersionInUse.SupportPushForceWithLease)
                    {
                        var choice = MessageBox.Show(owner,
                                                     _useForceWithLeaseInstead.Text,
                                                     "", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question,
                                                     MessageBoxDefaultButton.Button1);
                        switch (choice)
                        {
                        case DialogResult.Yes:
                            ForcePushBranches.Checked = false;
                            ckForceWithLease.Checked  = true;
                            break;

                        case DialogResult.Cancel:
                            return(false);
                        }
                    }
                }

                if (_NO_TRANSLATE_Branch.Text == AllRefs)
                {
                    pushCmd = Module.PushAllCmd(destination, GetForcePushOption(), track, RecursiveSubmodules.SelectedIndex);
                }
                else
                {
                    pushCmd = Module.PushCmd(destination, _NO_TRANSLATE_Branch.Text, RemoteBranch.Text,
                                             GetForcePushOption(), track, RecursiveSubmodules.SelectedIndex);
                }
            }
            else if (TabControlTagBranch.SelectedTab == TagTab)
            {
                string tag         = TagComboBox.Text;
                bool   pushAllTags = false;
                if (tag == AllRefs)
                {
                    tag         = "";
                    pushAllTags = true;
                }

                pushCmd = GitCommandHelpers.PushTagCmd(destination, tag, pushAllTags, GetForcePushOption());
            }
            else
            {
                // Push Multiple Branches Tab selected
                var pushActions = new List <GitPushAction>();
                foreach (DataRow row in _branchTable.Rows)
                {
                    var push   = Convert.ToBoolean(row[PushColumnName]);
                    var force  = Convert.ToBoolean(row[ForceColumnName]);
                    var delete = Convert.ToBoolean(row[DeleteColumnName]);

                    if (push || force)
                    {
                        pushActions.Add(new GitPushAction(row[LocalColumnName].ToString(), row[RemoteColumnName].ToString(), force));
                    }
                    else if (delete)
                    {
                        pushActions.Add(GitPushAction.DeleteRemoteBranch(row[RemoteColumnName].ToString()));
                    }
                }

                pushCmd = GitCommandHelpers.PushMultipleCmd(destination, pushActions);
            }

            ScriptManager.RunEventScripts(this, ScriptEvent.BeforePush);

            // controls can be accessed only from UI thread
            _selectedBranch = _NO_TRANSLATE_Branch.Text;
            _candidateForRebasingMergeCommit = PushToRemote.Checked && (_selectedBranch != AllRefs) && TabControlTagBranch.SelectedTab == BranchTab;
            _selectedRemoteBranchName        = RemoteBranch.Text;

            using (var form = new FormRemoteProcess(Module, pushCmd)
            {
                Remote = remote,
                Text = string.Format(_pushToCaption.Text, destination),
                HandleOnExitCallback = HandlePushOnExit
            })
            {
                form.ShowDialog(owner);
                ErrorOccurred = form.ErrorOccurred();

                if (!Module.InTheMiddleOfAction() && !form.ErrorOccurred())
                {
                    ScriptManager.RunEventScripts(this, ScriptEvent.AfterPush);
                    if (_createPullRequestCB.Checked)
                    {
                        UICommands.StartCreatePullRequest(owner);
                    }

                    return(true);
                }
            }

            return(false);
        }
        protected void ddlAction_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                //DropDownList ddlAction = (DropDownList)sender;
                //GridViewRow gvr = (GridViewRow)ddlAction.NamingContainer;
                //int selectedRow = gvr.RowIndex;

                RadComboBox  ddlAction   = (RadComboBox)sender;
                GridDataItem gvr         = (GridDataItem)ddlAction.NamingContainer;
                int          selectedRow = gvr.ItemIndex + 1;

                EQAccountId               = int.Parse(gvEQAcc.MasterTableView.DataKeyValues[selectedRow - 1]["AccountId"].ToString());
                Session["AccountId"]      = EQAccountId;
                Session["EQAccountVoRow"] = CustomerTransactionBo.GetCustomerEQAccountDetails(EQAccountId, portfolioId);
                if (ddlAction.SelectedValue.ToString() == "Edit")
                {
                    if (hdnIsCustomerLogin.Value == "Customer" && hdnIsMainPortfolio.Value == "1")
                    {
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", @"alert('Permisssion denied for Manage Portfolio !!');", true);
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('CustomerEQAccountAdd','action=Edit');", true);
                    }
                }
                if (ddlAction.SelectedValue.ToString() == "View")
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('CustomerEQAccountAdd','action=View');", true);
                }
                if (ddlAction.SelectedValue.ToString() == "Delete")
                {
                    if (hdnIsCustomerLogin.Value == "Customer" && hdnIsMainPortfolio.Value == "1")
                    {
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", @"alert('Permisssion denied for Manage Portfolio !!');", true);
                    }
                    else
                    {
                        bool CheckTradeAccAssociationWithTransactions;
                        CheckTradeAccAssociationWithTransactions = CustomerTransactionBo.CheckEQTradeAccNoAssociatedWithTransactions(EQAccountId);

                        if (CheckTradeAccAssociationWithTransactions == true)
                        {
                            ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", @"alert('Trade Account can not be deleted as some Transactions are Associated with this Trade Account Number.');", true);
                        }
                        else if (CheckTradeAccAssociationWithTransactions == false)
                        {
                            Page.ClientScript.RegisterStartupScript(this.GetType(), "Message", "ShowAlertToDelete();", true);
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "CustomerMFFolioView.ascx:ddlAction_OnSelectedIndexChange()");
                object[] objects = new object[1];
                objects[0]   = FolioId;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
Exemplo n.º 44
0
        private void SetPreRowitm()
        {
            try
            {
                int rowIndex = 0;
                if (ViewState["dt_adItm"] != null)
                {
                    DataTable dt = (DataTable)ViewState["dt_adItm"];
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            TextBox     TBItms     = (TextBox)GV_POS.Rows[rowIndex].Cells[0].FindControl("TBItms");
                            Label       lblItmpris = (Label)GV_POS.Rows[rowIndex].Cells[1].FindControl("lblItmpris");
                            TextBox     TBItmQty   = (TextBox)GV_POS.Rows[rowIndex].Cells[2].FindControl("TBItmQty");
                            Label       lblcat     = (Label)GV_POS.Rows[rowIndex].Cells[3].FindControl("lblcat");
                            Label       lblttl     = (Label)GV_POS.Rows[rowIndex].Cells[4].FindControl("lblttl");
                            HiddenField HFDSal     = (HiddenField)GV_POS.Rows[rowIndex].Cells[5].FindControl("HFDSal");
                            Label       lbl_Flag   = (Label)GV_POS.Rows[i].FindControl("lbl_Flag");
                            HiddenField HFPROID    = (HiddenField)GV_POS.Rows[rowIndex].Cells[0].FindControl("PROID");
                            HiddenField HFPROCATID = (HiddenField)GV_POS.Rows[rowIndex].Cells[3].FindControl("PROCATID");

                            string Itms = dt.Rows[i]["Items"].ToString();

                            if (Itms != "")
                            {
                                TBItms.Text = dt.Rows[i]["Items"].ToString();
                            }
                            else
                            {
                                TBItms.Text = "";
                            }

                            string Itempric = dt.Rows[i]["Itempric"].ToString();

                            if (Itempric != "")
                            {
                                lblItmpris.Text = dt.Rows[i]["Itempric"].ToString();
                            }
                            else
                            {
                                lblItmpris.Text = "0.00";
                            }

                            string QTY = dt.Rows[i]["QTY"].ToString();

                            if (QTY != "")
                            {
                                TBItmQty.Text = dt.Rows[i]["QTY"].ToString();
                            }
                            else
                            {
                                TBItmQty.Text = "0.00";
                            }

                            string Itemcat = dt.Rows[i]["Itemcat"].ToString();

                            if (Itemcat != "")
                            {
                                lblcat.Text = dt.Rows[i]["Itemcat"].ToString();
                            }
                            else
                            {
                                lblcat.Text = "0.00";
                            }

                            string netttl = dt.Rows[i]["TTL"].ToString();

                            if (netttl != "")
                            {
                                lblttl.Text = dt.Rows[i]["TTL"].ToString();
                            }
                            else
                            {
                                lblttl.Text = "0.00";
                            }

                            HFDSal.Value     = dt.Rows[i]["Dposid"].ToString();
                            HFPROID.Value    = dt.Rows[i]["ProductID"].ToString();
                            HFPROCATID.Value = dt.Rows[i]["ProductTypeID"].ToString();


                            if (TBItms.Text == "")
                            {
                                lbl_Flag.Text = "0";
                            }
                            else
                            {
                                lbl_Flag.Text = "1";
                            }

                            rowIndex++;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "alert('some');", true);
                //lbl_Heading.Text = "Error!";
                //lblalert.Text = ex.Message;
            }
        }
Exemplo n.º 45
0
 /// <summary>
 ///  写入JS脚本
 /// </summary>
 /// <param name="paramAction">内容</param>
 /// <param name="parmaName"></param>
 public void JsWrite(string paramAction)
 {
     ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "JS", paramAction, true);
 }
Exemplo n.º 46
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     odswiez();
     ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "print2", "JavaScript: window.print();", true);
     // ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "print", "window.open('raport_01_print.aspx', '')", true);
 }
Exemplo n.º 47
0
 public static void Initialize()
 {
     ScriptManager.RegisterShortcutsDefinitions((typeof(CustomConditions)));
 }
 //METODOS EXTRAS
 protected void ExibirMensagem(string atencao, string mensagem)
 {
     ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "exibir_msn('" + atencao + "','" + mensagem + "');", true);
 }
        protected void btnImportRecord_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                // if you have Excel 2007 uncomment this line of code
                //string excelConnectionString =string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Excel 8.0",path);
                string ExcelContentType     = "application/vnd.ms-excel";
                string Excel2010ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                if (FileUpload1.HasFile)
                {
                    //Check the Content Type of the file
                    if (FileUpload1.PostedFile.ContentType == ExcelContentType || FileUpload1.PostedFile.ContentType == Excel2010ContentType)
                    {
                        try
                        {
                            //Save file path
                            string path = string.Concat(Server.MapPath("../UploadFile/"), FileUpload1.FileName);
                            //Save File as Temp then you can delete it if you want
                            FileUpload1.SaveAs(path);
                            //string path = @"C:\Users\Johnney\Desktop\ExcelData.xls";
                            //For Office Excel 2010  please take a look to the followng link  http://social.msdn.microsoft.com/Forums/en-US/exceldev/thread/0f03c2de-3ee2-475f-b6a2-f4efb97de302/#ae1e6748-297d-4c6e-8f1e-8108f438e62e
                            string excelConnectionString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=Excel 8.0", path);

                            // Create Connection to Excel Workbook
                            using (OleDbConnection connection =
                                       new OleDbConnection(excelConnectionString))
                            {
                                OleDbCommand command = new OleDbCommand
                                                           ("Select * FROM [Sheet1$]", connection);
                                connection.Open();
                                // Create DbDataReader to Data Worksheet
                                using (DbDataReader dr = command.ExecuteReader())
                                {
                                    // SQL Server Connection String
                                    string sqlConnectionString = ConfigurationManager.ConnectionStrings["PMCDBConnectionString"].ConnectionString;

                                    // Bulk Copy to SQL Server
                                    using (SqlBulkCopy bulkCopy =
                                               new SqlBulkCopy(sqlConnectionString))
                                    {
                                        bulkCopy.DestinationTableName = "tbl05_SinhVien";
                                        bulkCopy.WriteToServer(dr);
                                        panelError.Visible = true;
                                        lblError.Text      = "The data has been exported succefuly from Excel to SQL";
                                        GridView1.DataBind();
                                    }
                                }
                            }
                            StringBuilder sb = new StringBuilder();
                            sb.Append(@"<script type='text/javascript'>");
                            sb.Append("alert('Record Imported Successfully');");
                            sb.Append("$('#importModal').modal('hide');");
                            sb.Append(@"</script>");
                            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ImportHideModalScript", sb.ToString(), false);
                        }

                        catch (Exception ex)
                        {
                            lblError.Text = ex.Message;
                        }
                    }
                }
            }
        }
    private void save(int saveStatus)
    {
        try
        {
            Hashtable ht = new Hashtable();

            ht.Add("@ReimbursmentID", Request.QueryString["ReimbursmentID"]);
            ht.Add("@isRecalled", bool.Parse(Request.QueryString["isRecalled"]));
            ht.Add("@EmployeeUserID", rCmbEmployee.Items[0].Value);
            ht.Add("@SaveStatus", saveStatus);

            ht.Add("@employeeIDD", rCmbEmployee.Items[0].Value);
            ht.Add("@employeeCode", rCmbEmployee.Items[0].Text);

            ht.Add("@rembusIdd", rCmbReimbursment.Items[0].Value);
            ht.Add("@rembuscod", rCmbReimbursment.Items[0].Text);

            ht.Add("@rembusamt", string.IsNullOrEmpty(txtAmount.Text) ? 0 : Convert.ToDecimal(txtAmount.Text));
            ht.Add("@rembussub1", string.IsNullOrEmpty(txtSub1.Text) ? 0 : Convert.ToDecimal(txtSub1.Text));
            ht.Add("@rembussub2", string.IsNullOrEmpty(txtSub2.Text) ? 0 : Convert.ToDecimal(txtSub2.Text));
            ht.Add("@rembussub3", string.IsNullOrEmpty(txtSub3.Text) ? 0 : Convert.ToDecimal(txtSub3.Text));
            ht.Add("@rembusdsc", txtDescription.Text);
            ht.Add("@rembusdsc1", txtDescription1.Text);
            ht.Add("@rembusdsc2", txtDescription2.Text);
            ht.Add("@rembusdsc3", txtDescription3.Text);
            ht.Add("@FormTypeID", Request.QueryString["FormType"]);


            ht.Add("@SubmittedByUserID", Convert.ToInt16((string)Session["_UserID"]));
            ht.Add("@DBMessage", "");

            {
                string DBMessage = clsDAL.ExecuteNonQuery("sp_User_Update_Reimbursment", ht, "@DBMessage", System.Data.SqlDbType.NVarChar, 255) as string;

                Hashtable ht_attachments = new Hashtable();
                if (ruDocument.UploadedFiles.Count > 0)
                {
                    for (int l = 0; l <= ruDocument.UploadedFiles.Count - 1; l++)
                    {
                        var currentFile = ruDocument.UploadedFiles[l];
                        var filedsc     = currentFile.GetFieldValue("TextBox").ToString();
                        var filename    = ruDocument.UploadedFiles[l].FileName;
                        var imgStream   = currentFile.InputStream;
                        int imgLen      = int.Parse(currentFile.ContentLength.ToString());

                        byte[] imgBinaryData = new byte[imgLen];
                        int    n             = imgStream.Read(imgBinaryData, 0, imgLen);

                        // Image to Base64 string and save in database
                        // Convert byte[] to Base64 String

                        string base64String = Convert.ToBase64String(imgBinaryData);

                        ht_attachments = new Hashtable();
                        ht_attachments.Add("@transactionname", "PayrollReimbursment");
                        ht_attachments.Add("@transactionidd", Request.QueryString["ReimbursmentID"]);
                        ht_attachments.Add("@transactioncode", hfTransactionNo.Value);
                        ht_attachments.Add("@description", filedsc);

                        ht_attachments["@File"]     = imgBinaryData;
                        ht_attachments["@Filetype"] = currentFile.ContentType;
                        ht_attachments["@Filename"] = filename;


                        clsDAL.ExecuteNonQuery(Constraints.sp_User_Insert_Attachment, ht_attachments);
                    }
                }

                if (saveStatus == 2)
                {
                    ht = null;
                    ht = new Hashtable();
                    ht.Add("@ReimbursmentID", Request.QueryString["ReimbursmentID"]);
                    ht.Add("@RedirectURL", Request.Url.AbsoluteUri);

                    clsCommon.SendMail(3, ht);
                }

                if ((null != DBMessage) && DBMessage.Contains("ERROR:"))
                {
                    ShowClientMessage("Sorry! some error has occurred. Please try again later.", MessageType.Error);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, Page.GetType(), "mykey", "CloseAndRebind('" + "Processed Successfully" + "');", true);
                }
            }
        }
        catch (Exception ex)
        {
            ShowMessage(ex.Message, MessageType.Error);
        }
    }
 protected void Submit_click(object sender, EventArgs e)
 {
     ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditorResponse", "alert('Submitted:\\n\\n" + editor.EditPanel.Content.Replace("\"", "\\\"").Replace("\n", "\\n").Replace("\r", "").Replace("'", "\\'") + "');", true);
 }
Exemplo n.º 52
0
 public void StartInteract()
 {
     ScriptManager.RunScript(Utils.GetScriptParser(ScriptFile, this));
 }
Exemplo n.º 53
0
    protected void ctk_values(object sender, EventArgs e)
    {
        if (txt_dar.Text != "" && txt_seh.Text != "" || DropDownList3.SelectedValue != "")
        {
            select_qry();
            DataSet   ds = new DataSet();
            DataTable dt = new DataTable();
            dt = dbcon.Ora_Execute_table("" + sqry + "");
            RptviwerStudent.Reset();
            ds.Tables.Add(dt);

            List <DataRow> listResult = dt.AsEnumerable().ToList();
            listResult.Count();
            int countRow = 0;
            countRow = listResult.Count();
            string ss1 = string.Empty, ss2 = string.Empty, ss3 = string.Empty, ss4 = string.Empty, ss5 = string.Empty;
            if (DropDownList3.SelectedValue != "")
            {
                ss1 = DropDownList3.SelectedItem.Text;
            }

            if (dd_pen.SelectedValue != "")
            {
                ss2 = dd_pen.SelectedItem.Text;
            }

            if (dd_ajk1.SelectedValue != "")
            {
                ss3 = dd_ajk1.SelectedItem.Text;
            }

            if (dd_ajk2.SelectedValue != "")
            {
                ss4 = dd_ajk2.SelectedItem.Text;
            }

            RptviwerStudent.LocalReport.DataSources.Clear();
            if (countRow != 0)
            {
                RptviwerStudent.LocalReport.ReportPath = "Aset/ast_klupus.rdlc";
                ReportDataSource rds = new ReportDataSource("astskupus", dt);

                ReportParameter[] rptParams = new ReportParameter[] {
                    new ReportParameter("h1", txt_dar.Text),
                    new ReportParameter("h2", txt_seh.Text),
                    new ReportParameter("h3", ss1),
                    new ReportParameter("h4", TextBox2.Text),
                    new ReportParameter("h5", ss2),
                    new ReportParameter("h6", ss3),
                    new ReportParameter("h7", ss4),
                };


                RptviwerStudent.LocalReport.SetParameters(rptParams);

                RptviwerStudent.LocalReport.DataSources.Add(rds);
                RptviwerStudent.LocalReport.Refresh();

                Warning[] warnings;
                string[]  streamids;
                string    mimeType;
                string    encoding;
                string    extension;
                string    filename;

                if (sel_frmt.SelectedValue == "01")
                {
                    filename = string.Format("{0}.{1}", "Kelulusan_Rekod_Pelupusan_Aset_" + DateTime.Now.ToString("ddMMyyyy") + ".", "pdf");
                    byte[] bytes = RptviwerStudent.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings);
                    Response.Buffer = true;
                    Response.Clear();
                    Response.ContentType = mimeType;
                    Response.AddHeader("content-disposition", "attachment; filename=" + filename);
                    Response.BinaryWrite(bytes);
                    Response.Flush();
                    Response.End();
                }
                else if (sel_frmt.SelectedValue == "02")
                {
                    StringBuilder builder     = new StringBuilder();
                    string        strFileName = string.Format("{0}.{1}", "SEMAKAN_REKOD_PELUPUSAN_ASET_" + DateTime.Now.ToString("ddMMyyyy") + "", "csv");
                    builder.Append("Organisation ,Nama Aset,Kuantiti, Usia Aset, Seunit (RM), Jumlah (RM), Seunit (RM), Jumlah (RM), Kaedah Pelupusan, NILAI REZAB (RM)" + Environment.NewLine);
                    foreach (GridViewRow row in gvSelected.Rows)
                    {
                        string oname   = ((Label)row.FindControl("Label3")).Text.ToString();
                        string naset   = ((Label)row.FindControl("Label2")).Text.ToString();
                        string qty     = ((Label)row.FindControl("Label6")).Text.ToString();
                        string uaset   = ((Label)row.FindControl("Label7")).Text.ToString();
                        string hss     = ((Label)row.FindControl("Label8")).Text.ToString();
                        string hsj     = ((Label)row.FindControl("Label9")).Text.ToString();
                        string nss     = ((Label)row.FindControl("Label10")).Text.ToString();
                        string nsj     = ((Label)row.FindControl("Label11")).Text.ToString();
                        string res_amt = ((Label)row.FindControl("lbl_ramt")).Text.ToString();
                        string kp      = ((DropDownList)row.FindControl("lbl_kp")).Text.ToString();
                        builder.Append(oname + "," + naset + "," + qty + "," + uaset + "," + hss + "," + hsj + "," + nss + "," + nsj + "," + res_amt + "," + kp + Environment.NewLine);
                    }
                    Response.Clear();
                    Response.ContentType = "text/csv";
                    Response.AddHeader("Content-Disposition", "attachment;filename=" + strFileName);
                    Response.Write(builder.ToString());
                    Response.End();
                }
                else if (sel_frmt.SelectedValue == "03")
                {
                    byte[] bytes = RptviwerStudent.LocalReport.Render("Word", null, out mimeType, out encoding, out extension, out streamids, out warnings);
                    filename        = string.Format("{0}.{1}", "SEMAKAN_REKOD_PELUPUSAN_ASET_" + DateTime.Now.ToString("ddMMyyyy") + "", "doc");
                    Response.Buffer = true;
                    Response.Clear();
                    Response.AddHeader("Content-Disposition", "attachment;filename=" + filename);
                    Response.ContentType = mimeType;
                    Response.BinaryWrite(bytes);
                    Response.Flush();
                    Response.End();
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "$.Zebra_Dialog('Rekod tidak dijumpai. Sila Pastikan Semua Maklumat Dimasukkan Dengan Betul.',{'type': 'warning','title': 'warning','auto_close': 2000});", true);
            }
        }
        else
        {
            BindGrid();
            ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "$.Zebra_Dialog('Medan Input Adalah Mandatori.',{'type': 'warning','title': 'warning','auto_close': 2000});", true);
        }
    }
Exemplo n.º 54
0
 protected void btnFind_Click(object sender, EventArgs e)
 {         
    BindSearchApprovalSettingGrid();
    ScriptManager.RegisterStartupScript(this, GetType(), "showSearch", "showSearch();", true);
 }
Exemplo n.º 55
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //codProyecto = FieldValidate.GetSessionString("CodProyecto");
                codProyecto = HttpContext.Current.Session["CodProyecto"].ToString();
                //codConvocatoria = FieldValidate.GetSessionString("CodConvocatoria");
                codConvocatoria = HttpContext.Current.Session["CodConvocatoria"].ToString();

                if (codProyecto.Equals(String.Empty))
                {
                    throw new ApplicationException(" No se pudo obtener la información del usuario y el proyecto.");
                }

                //Consultar si es miembro.
                esMiembro = fnMiembroProyecto(usuario.IdContacto, codProyecto);

                //Consultar si está "realizado".
                bRealizado = esRealizado(Constantes.ConstSubModeloFinanciero, Int32.Parse(codProyecto), Int32.Parse(codConvocatoria));

                if (!IsPostBack)
                {
                    #region En el page_load.

                    inicioEncabezado(codProyecto, codConvocatoria, Constantes.ConstSubModeloFinanciero);
                    if (miembro == true && usuario.CodGrupo == Constantes.CONST_Evaluador || usuario.CodGrupo == Constantes.CONST_CoordinadorEvaluador || usuario.CodGrupo == Constantes.CONST_GerenteEvaluador)
                    {
                        VerificarLinKModeloFinanciero();

                        if (usuario.CodGrupo == Constantes.CONST_CoordinadorEvaluador)
                        {
                            ImageButton2.Visible = false;
                            ImageButton2.Enabled = false;
                            HyperLink1.Visible   = false;
                        }
                        else if (usuario.CodGrupo == Constantes.CONST_Evaluador && realizado)
                        {
                            ImageButton2.Visible = false;
                            ImageButton2.Enabled = false;
                        }

                        if (usuario.CodGrupo == Constantes.CONST_GerenteEvaluador)
                        {
                            HyperLink1.Visible   = false;
                            ImageButton2.Visible = false;
                        }

                        PanelModelo.Visible = true;
                    }

                    #endregion

                    ObtenerDatosUltimaActualizacion();
                }


                if (esMiembro && !bRealizado)
                {
                    this.div_Post_It1.Visible = true; Post_It1._mostrarPost = true;
                }
                //CtrlCheckedProyecto1.tabCod = Constantes.ConstSubModeloFinanciero;
                //CtrlCheckedProyecto1.CodProyecto = codProyecto;
            }
            catch (ApplicationException ex)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "alert('" + ex.Message + "');", true);
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Mensaje", "alert('Sucedio un error, intentelo de nuevo. detalle : " + ex.Message + " ');", true);
            }
        }
Exemplo n.º 56
0
        private void ExecScriptModalSelect(bool EsVisible, string mensajeRetorno)
        {
            string script = @"$('#Select-modal-default-Menu').modal('" + (EsVisible == true ? "show" : "hide") + "'); ";

            ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString().Replace("-", ""), script, true);
        }
Exemplo n.º 57
0
    protected void btnxls_Click(object sender, EventArgs e)
    {
        try
        {
            DateTime date = Convert.ToDateTime("01-01-1900");
            DataSet  ds   = new DataSet();

            string connection = string.Empty;

            if (Request.Cookies["Company"] != null)
            {
                connection = Request.Cookies["Company"].Value;
            }
            else
            {
                Response.Redirect("Login.aspx");
            }

            ds = objBL.ListProducts(connection, "", "");

            if (ds.Tables[0].Rows.Count > 0)
            {
                DataTable dt = new DataTable();
                dt.Columns.Add(new DataColumn("ProductName"));
                dt.Columns.Add(new DataColumn("ItemCode"));
                dt.Columns.Add(new DataColumn("Model"));
                dt.Columns.Add(new DataColumn("Brand"));
                dt.Columns.Add(new DataColumn("MRP"));
                dt.Columns.Add(new DataColumn("MRP Date"));
                dt.Columns.Add(new DataColumn("DP"));
                dt.Columns.Add(new DataColumn("DP Date"));
                dt.Columns.Add(new DataColumn("NLC"));
                dt.Columns.Add(new DataColumn("NLC Date"));
                dt.Columns.Add(new DataColumn("Vat"));
                dt.Columns.Add(new DataColumn("StockLevel"));

                DataRow dr_final123 = dt.NewRow();
                dt.Rows.Add(dr_final123);

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    DataRow dr_final1 = dt.NewRow();
                    dr_final1["ProductName"] = dr["ProductName"];
                    dr_final1["ItemCode"]    = dr["ItemCode"];
                    dr_final1["Model"]       = dr["Model"];
                    dr_final1["Brand"]       = dr["productdesc"];
                    dr_final1["MRP"]         = dr["rate"];
                    dr_final1["MRP Date"]    = dr["MRPEffDate"];
                    dr_final1["DP"]          = dr["Dealerrate"];
                    dr_final1["DP Date"]     = dr["DPEffDate"];
                    dr_final1["NLC"]         = dr["NLC"];
                    dr_final1["NLC Date"]    = dr["NLCEffDate"];
                    dr_final1["Vat"]         = dr["Vat"];
                    dr_final1["NLC"]         = dr["rol"];
                    dr_final1["StockLevel"]  = dr["rol"];
                    dt.Rows.Add(dr_final1);
                }
                DataRow dr_final2 = dt.NewRow();
                dr_final2["ProductName"] = "";
                dr_final2["ItemCode"]    = "";
                dr_final2["Model"]       = "";
                dr_final2["Brand"]       = "";
                dr_final2["MRP"]         = "";
                dr_final2["MRP Date"]    = "";
                dr_final2["DP"]          = "";
                dr_final2["DP Date"]     = "";
                dr_final2["NLC"]         = "";
                dr_final2["NLC Date"]    = "";
                dr_final2["Vat"]         = "";
                dr_final2["NLC"]         = "";
                dr_final2["StockLevel"]  = "";
                dt.Rows.Add(dr_final2);
                ExportToExcel(dt);
            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, typeof(Button), "MyScript", "alert('No Data Found');", true);
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Exemplo n.º 58
0
    public void MessageBox(string msg)
    {
        string jv = "alert('" + msg + "');";

        ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "msg", jv, true);
    }
Exemplo n.º 59
0
        private void RegPcal()
        {
            string scrp1 = "var objCal1 = new AMIB.persianCalendar('ContentPlaceHolder1_txtFirstSession', {extraInputID: 'ContentPlaceHolder1_txtFirstSession',extraInputFormat: 'yyyy/mm/dd'}); ";

            ScriptManager.RegisterClientScriptBlock(this, GetType(), ClientID, scrp1, true);
        }
    public void loder(string msg)
    {
        string jv = "sloder('" + msg + "');";

        ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "msg", jv, true);
    }