Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            if (!string.IsNullOrEmpty(NttDataWA.Utils.InitConfigurationKeys.GetValue("0", NttDataWA.Utils.DBKeys.FE_ENABLE_DRAG_AND_DROP.ToString())) && NttDataWA.Utils.InitConfigurationKeys.GetValue("0", NttDataWA.Utils.DBKeys.FE_ENABLE_DRAG_AND_DROP.ToString()).Equals("1"))
            {
                DragAndDropResult  response = null;
                HttpPostedFile     file     = null;
                HttpFileCollection files    = null;
                HttpRequest        request  = null;
                bool       first            = true;
                CallerPage callerPage;

                try
                {
                    if (context != null && context.Request != null && context.Request.Files != null && context.Request.Files.Count > 0)
                    {
                        request    = context.Request;
                        files      = request.Files;
                        first      = Boolean.Parse(request["First"]);
                        callerPage = (CallerPage)Enum.Parse(typeof(CallerPage), request["CallerPage"]);
                        if (first)
                        {
                            DragAndDropManager.ClearReport();
                        }

                        for (int i = 0; i < files.Count; i++)
                        {
                            file = files[i];

                            switch (callerPage)
                            {
                            case (CallerPage.ADLDOCUMENT):
                                response = AddWorkArea(file, context.Session);
                                break;

                            case (CallerPage.PROJECT):
                                response = AddInProject(file, first);
                                break;

                            case (CallerPage.DOCUMENT):
                            case (CallerPage.ATTACHMENTS):
                                response = AddNewDocument(file, context.Session);
                                break;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    response         = new DragAndDropResult();
                    response.Success = false;
                    if (file != null)
                    {
                        response.FileName      = file.FileName;
                        response.ContentLength = file.ContentLength;
                    }
                    response.Error = ex.Message;

                    MassiveOperationReport.MassiveOperationResultEnum result = MassiveOperationReport.MassiveOperationResultEnum.KO;
                    if (DragAndDropManager.Report == null)
                    {
                        DragAndDropManager.Report = new MassiveOperationReport();
                    }
                    DragAndDropManager.Report.AddReportRow(response.FileName + " " + response.DocNumber, result, response.Error);
                }

                context.Response.Write(JsonConvert.SerializeObject(response));
            }
        }
Example #2
0
 protected void BtnClose_Click(object sender, EventArgs e)
 {
     ScriptManager.RegisterStartupScript(this, this.GetType(), "reallowOp", "reallowOp();", true);
     this.CloseMask();
     DragAndDropManager.ClearReport();
 }