public static void ProcessUpload(HttpRequest request)
        {
            string upload_id = request.Headers["UploadId"];
            string upload_by = request.Headers["UploadBy"];

            if (string.IsNullOrEmpty(upload_id) || string.IsNullOrEmpty(upload_by))
            {
                return;                 // error???
            }
            int id_incident;

            int.TryParse(upload_id, out id_incident);

            string name = GetFileName(id_incident, upload_by);

            string folder = Path.Combine(request.PhysicalApplicationPath, FOLDER_NAME);

            Directory.CreateDirectory(folder);

            request.SaveAs(Path.Combine(folder, name), false);

            bool complete = false;

            BllProxyLog.UpdateAudio(id_incident, upload_by == SOURCE_CALLCENTER ? 1 : 2, ref complete);

            if (!complete)
            {
                return;
            }

            ProcessStartInfo psi = new ProcessStartInfo();

            psi.UseShellExecute = false;
            psi.CreateNoWindow  = true;

            psi.WorkingDirectory = folder;
            psi.FileName         = System.Configuration.ConfigurationManager.AppSettings["path.GStreamer"];

            psi.Arguments = string.Format
                                ("-v adder name=mux ! lamemp3enc ! filesink location={0}.mp3 {{ filesrc location={1}{0}.mp3 ! queue ! decodebin ! audioconvert ! audioresample ! queue ! mux. }} {{ filesrc location={2}{0}.mp3 ! queue ! decodebin ! audioconvert ! audioresample ! queue ! mux. }}"
                                , id_incident
                                , SOURCE_CALLCENTER
                                , SOURCE_FACILITY
                                );

            Process process = Process.Start(psi);

            process.WaitForExit();

            if (process.ExitCode == 0)
            {
                BllProxyLog.UpdateAudio(id_incident, 3, ref complete);
            }
        }
Exemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            string field       = context.Request.QueryString["field"];
            int    incident_id = int.Parse(context.Request.QueryString["incident_id"]);
            object dataImage   = BllProxyLog.GetImage(incident_id, field);

            byte[] content = dataImage as byte[];
            if (content != null)
            {
                context.Response.BinaryWrite(content);
            }
        }
Exemplo n.º 3
0
        private void Start(Int32 groupId)
        {
            //Int32 skillID = 0;
            //if (!string.IsNullOrEmpty(ddlSkill.SelectedValue))
            //{
            //    skillID = Convert.ToInt32(ddlSkill.SelectedValue);
            //}
            //Int32 langID = 0;
            //if (!string.IsNullOrEmpty(ddlLanguage.SelectedValue))
            //{
            //    langID = Convert.ToInt32(ddlLanguage.SelectedValue);
            //}


            Int32 skillID = 0;

            Int32.TryParse(Session["skillID"] as string, out skillID);
            Int32 langID = 0;

            Int32.TryParse(Session["langID"] as string, out langID);
            Int32.TryParse(Session["groupId"] as string, out groupId);

            UcControlArgs args = new UcControlArgs();

            if (skillID == 0 || langID == 0 || groupId == 0)
            {
                args.Message = "Skill, Language and Group must be defined";
                args.Cancel  = true;

                handleError(args);
                return;
            }

            Int32 incidentId = BllProxyIncident.InsertIncident(groupId, skillID, langID, this.FacilityId, 0, 0);

            if (incidentId != 0)
            {
                string screenUserHelp     = null;
                string consName           = null;
                string deviceMake         = null;
                string deviceModel        = null;
                int    deviceValue        = 0;
                string deviceType         = null;
                string kioskID            = null;
                string kioskName          = null;
                string kioskLocation      = null;
                string transactValue      = null;
                bool   transactCompletion = false;
                byte[] inspectorBin       = null;
                byte[] driverLicense      = null;
                byte[] idCard             = null;

                try
                {
                    kioskID       = Session["kioskID"] as string;
                    kioskName     = Session["kioskName"] as string;
                    kioskLocation = Session["kioskLocation"] as string;

                    screenUserHelp = ConfigurationManager.AppSettings["screenUserHelp"];
                    consName       = Session["kioskUser"] as string;
                    if (string.IsNullOrEmpty(consName))
                    {
                        consName = ConfigurationManager.AppSettings["consumerName"];
                    }
                    deviceMake         = ConfigurationManager.AppSettings["deviceMake"];
                    deviceModel        = ConfigurationManager.AppSettings["deviceModel"];
                    deviceValue        = Int32.Parse(ConfigurationManager.AppSettings["deviceValue"]);
                    deviceType         = ConfigurationManager.AppSettings["deviceType"];
                    transactValue      = ConfigurationManager.AppSettings["transactValue"];
                    transactCompletion = Boolean.Parse(ConfigurationManager.AppSettings["transactCompletion"]);

                    string imagePath = null;

                    imagePath = ConfigurationManager.AppSettings["idCard"];
                    if (!string.IsNullOrEmpty(imagePath))
                    {
                        idCard = ReadDataFromFile(imagePath);
                    }
                    imagePath = ConfigurationManager.AppSettings["inspectorBin"];
                    if (!string.IsNullOrEmpty(imagePath))
                    {
                        inspectorBin = ReadDataFromFile(imagePath);
                    }
                    imagePath = ConfigurationManager.AppSettings["driverLicense"];
                    if (!string.IsNullOrEmpty(imagePath))
                    {
                        driverLicense = ReadDataFromFile(imagePath);
                    }
                }
                catch
                {
                    args.Message = "Get data from Kiosk is failed.";
                    args.Cancel  = true;
                }

                BllProxyLog.InsertLog(incidentId,
                                      consName,
                                      deviceMake,
                                      deviceModel,
                                      deviceValue,
                                      deviceType,
                                      kioskID,
                                      kioskName,
                                      kioskLocation,
                                      idCard,
                                      inspectorBin,
                                      driverLicense,
                                      transactValue,
                                      transactCompletion,
                                      screenUserHelp,
                                      "");

                if (args.Cancel)
                {
                    handleError(args);
                }
                else
                {
                    args.Id = incidentId;
                    goNext(args);
                }
            }
            else
            {
                args.Message = "Cannot create incident!";
                args.Cancel  = true;

                handleError(args);
            }
        }