Пример #1
0
        protected void RefreshProgress(object sender, DirectEventArgs e)
        {
            try
            {
                double progress = 0;
                if (HttpRuntime.Cache.Get("ExceptionMsgSync") != null)

                {
                    X.Msg.Alert(Resources.Common.Error, HttpRuntime.Cache.Get("ExceptionMsgSync").ToString()).Show();
                    deleteFromCash();
                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                }
                if (HttpRuntime.Cache.Get("ErrorMsgSync") != null || HttpRuntime.Cache.Get("LogIdMsgSync") != null)

                {
                    X.Msg.Alert(Resources.Common.Error, HttpRuntime.Cache.Get("ErrorMsgSync").ToString() + "<br>" + Resources.Errors.ErrorLogId + HttpRuntime.Cache.Get("LogIdMsgSync").ToString() + "<br>").Show();

                    deleteFromCash();


                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                }


                if (!Common.isThreadSafe())
                {
                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                    HttpRuntime.Cache.Remove("isThreadSafe");
                    deleteFromCash();
                    Common.errorMessage(null);
                }
                else
                {
                    Common.increasThreadSafeCounter();
                }
                RecordRequest req = new RecordRequest();
                if (HttpRuntime.Cache["syncAC_RecordId"] != null)
                {
                    req.RecordID = HttpRuntime.Cache["syncAC_RecordId"].ToString();
                }
                else
                {
                    // this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                    return;
                }
                RecordResponse <BackgroundJob> resp = _systemService.ChildGetRecord <BackgroundJob>(req);
                if (!resp.Success)
                {
                    Common.errorMessage(resp);

                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);

                    deleteFromCash();

                    return;
                }
                if (resp.result.errorId != null)
                {
                    X.Msg.Alert(Resources.Common.Error, resp.result.errorName).Show();
                    deleteFromCash();
                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                }
                else
                {
                    if (resp.result.taskSize == 0)
                    {
                        progress = 0;
                        this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);

                        deleteFromCash();

                        X.Msg.Alert("", Resources.Common.SyncSucc).Show();
                        this.Progress1.UpdateProgress(float.Parse(progress.ToString()), string.Format(" {0}%", (int)(float.Parse(progress.ToString()) * 100)));
                    }
                    else
                    {
                        progress = (double)resp.result.completed / resp.result.taskSize;
                        string prog    = (float.Parse(progress.ToString()) * 100).ToString();
                        string message = GetGlobalResourceObject("Common", "working").ToString();
                        this.Progress1.UpdateProgress(float.Parse(progress.ToString()), string.Format(message + " {0}%", (int)(float.Parse(progress.ToString()) * 100)));
                        //  this.payListProgressBar.UpdateProgress(float.Parse(progress.ToString()), string.Format(message + " {0}%", (int)(float.Parse(progress.ToString()) * 100)));
                    }


                    if (resp.result.taskSize == resp.result.completed)
                    {
                        this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                        deleteFromCash();
                        //EditGenerateWindow.Close();
                        //Store1.Reload();

                        //payListWidow.Close();
                        X.Msg.Alert("", Resources.Common.operationCompleted).Show();
                        this.Progress1.UpdateProgress(float.Parse(progress.ToString()), string.Format(" {0}%", (int)(float.Parse(progress.ToString()) * 100)));
                    }
                }
            }
            catch (Exception exp)
            {
                this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                X.Msg.Alert(Resources.Common.Error, exp.Message).Show();
                deleteFromCash();
            }
        }
Пример #2
0
        protected void RefreshProgress(object sender, DirectEventArgs e)
        {
            try
            {
                double progress = 0;

                if (
                    HttpRuntime.Cache.Get("ErrorMsgGenEM") != null ||
                    HttpRuntime.Cache.Get("ErrorLogIdGenEM") != null ||
                    HttpRuntime.Cache.Get("ErrorErrorCodeGenEM") != null)
                {
                    X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", "Error_" + HttpRuntime.Cache.Get("ErrorErrorCodeGenEM")) != null ? GetGlobalResourceObject("Errors", "Error_" + HttpRuntime.Cache.Get("ErrorErrorCodeGenEM").ToString()).ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + HttpRuntime.Cache.Get("ErrorLogIdGenEM").ToString() : HttpRuntime.Cache.Get("ErrorMsgGenEM").ToString()).Show();
                    HttpRuntime.Cache.Remove("genEM_RecordId");
                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                    mailWindow.Close();


                    if (HttpRuntime.Cache.Get("ErrorErrorCodeGenEM") != null)
                    {
                        HttpRuntime.Cache.Remove("ErrorErrorCodeGenEM");
                    }
                    if (HttpRuntime.Cache.Get("ErrorLogIdGenEM") != null)
                    {
                        HttpRuntime.Cache.Remove("ErrorLogIdGenEM");
                    }
                    if (HttpRuntime.Cache.Get("ErrorErrorCodeGenEM") != null)
                    {
                        HttpRuntime.Cache.Remove("ErrorErrorCodeGenEM");
                    }

                    return;
                }


                if (!Common.isThreadSafe())
                {
                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                    HttpRuntime.Cache.Remove("isThreadSafe");
                    Common.errorMessage(null);
                }
                else
                {
                    Common.increasThreadSafeCounter();
                }
                RecordRequest req = new RecordRequest();
                if (HttpRuntime.Cache["genEM_RecordId"] != null)
                {
                    req.RecordID = HttpRuntime.Cache["genEM_RecordId"].ToString();
                }
                else
                {
                    return;
                }
                RecordResponse <BackgroundJob> resp = _systemService.ChildGetRecord <BackgroundJob>(req);
                if (!resp.Success)
                {
                    Common.errorMessage(resp);
                    HttpRuntime.Cache.Remove("genEM_RecordId");
                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                    mailWindow.Close();
                    Viewport1.ActiveIndex = 0;

                    return;
                }
                if (resp.result.errorId != null)
                {
                    X.Msg.Alert(Resources.Common.Error, resp.result.errorName).Show();
                    HttpRuntime.Cache.Remove("genEM_RecordId");
                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);


                    mailWindow.Close();
                    return;
                }
                else
                {
                    if (resp.result.taskSize == 0)
                    {
                        progress = 0;
                        this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                        mailWindow.Close();
                    }
                    else
                    {
                        progress = (double)resp.result.completed / resp.result.taskSize;
                        string prog    = (float.Parse(progress.ToString()) * 100).ToString();
                        string message = GetGlobalResourceObject("Common", "working").ToString();

                        this.mailEmployeesProgressBar.UpdateProgress(float.Parse(progress.ToString()), string.Format(message + " {0}%", (int)(float.Parse(progress.ToString()) * 100)));
                    }


                    if (resp.result.taskSize == resp.result.completed)
                    {
                        this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                        HttpRuntime.Cache.Remove("genEM_RecordId");
                        mailWindow.Close();


                        X.Msg.Alert("", Resources.Common.operationCompleted).Show();
                    }
                }
            }
            catch (Exception exp)
            {
                this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                X.Msg.Alert(Resources.Common.Error, exp.Message).Show();
            }
        }
Пример #3
0
        protected void RefreshProgress(object sender, DirectEventArgs e)
        {
            try
            {
                double progress = 0;
                if (HttpRuntime.Cache.Get("ErrorMsgGenAD") != null || HttpRuntime.Cache.Get("ErrorLogIdGenAD") != null)
                {
                    X.Msg.Alert(Resources.Common.Error, HttpRuntime.Cache.Get("ErrorMsgGenAD").ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + HttpRuntime.Cache.Get("ErrorLogIdGenAD").ToString()).Show();


                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                    HttpRuntime.Cache.Remove("genFS_RecordId");
                    HttpRuntime.Cache.Remove("ErrorMsgGenAD");
                    HttpRuntime.Cache.Remove("ErrorLogIdGenAD");
                }

                if (!Common.isThreadSafe())
                {
                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                    HttpRuntime.Cache.Remove("isThreadSafe");
                    Common.errorMessage(null);
                }
                else
                {
                    Common.increasThreadSafeCounter();
                }
                RecordRequest req = new RecordRequest();
                if (HttpRuntime.Cache["genFS_RecordId"] != null)
                {
                    req.RecordID = HttpRuntime.Cache["genFS_RecordId"].ToString();
                }
                else
                {
                    return;
                }
                RecordResponse <BackgroundJob> resp = _systemService.ChildGetRecord <BackgroundJob>(req);
                if (resp.result == null || resp.result.errorId != null)
                {
                    //string[] values;
                    //var infolist = resp.result.infoList.Split(',');
                    //string ErrorMessage;
                    //if (GetGlobalResourceObject("Errors", "Error_" + resp.result.errorId) != null)

                    //    values = GetGlobalResourceObject("Errors", "Error_" + resp.result.errorId).ToString().Split(new string[] { "%s" }, StringSplitOptions.None);
                    //    for (int i = 0; i < infolist.Length; i++)
                    //    {

                    //        values[0] += infolist[i] + "  ";
                    //    }
                    //    if (values.Length == 2)
                    //        ErrorMessage = values[0] + " " + values[1];
                    //    else
                    //        ErrorMessage = values[0];
                    //}
                    //else
                    //    ErrorMessage = GetGlobalResourceObject("Errors", "Error_2").ToString() + resp.ErrorCode;


                    //X.Msg.Alert(Resources.Common.Error, ErrorMessage).Show();
                    if (resp.result.errorId != null)
                    {
                        X.MessageBox.Alert(Resources.Common.Error, resp.result.errorName + "<br>" + Resources.Errors.ErrorLogId + resp.result.errorId + "<br>").Show();
                    }
                    else
                    {
                        Common.errorMessage(resp);
                    }


                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                    HttpRuntime.Cache.Remove("genFS_RecordId");
                    HttpRuntime.Cache.Remove("ErrorMsgGenAD");
                    HttpRuntime.Cache.Remove("ErrorLogIdGenAD");
                }
                else
                {
                    if (resp.result.taskSize == 0)
                    {
                        progress = 0;
                        this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                        X.Msg.Alert("", GetGlobalResourceObject("Common", "GenerateAttendanceDaySucc").ToString()).Show();
                    }
                    else
                    {
                        progress = (double)resp.result.completed / resp.result.taskSize;
                        string prog    = (float.Parse(progress.ToString()) * 100).ToString();
                        string message = GetGlobalResourceObject("Common", "working").ToString();
                        this.Progress1.UpdateProgress(float.Parse(progress.ToString()), string.Format(message + " {0}%", (int)(float.Parse(progress.ToString()) * 100)));
                    }


                    if (resp.result.taskSize == resp.result.completed)
                    {
                        this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                        HttpRuntime.Cache.Remove("genFS_RecordId");
                        X.Msg.Alert("", GetGlobalResourceObject("Common", "GenerateAttendanceDaySucc").ToString()).Show();
                    }
                }
            }
            catch (Exception exp)
            {
                this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                X.Msg.Alert(Resources.Common.Error, exp.Message).Show();
            }
        }