Пример #1
0
        protected void btnImport_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                object   obj      = null;
                string   alertid  = string.Empty;
                FileInfo info     = new FileInfo(fuImport.FileName);
                string   fileName = info.Name + "_" + DateTime.Now.ToString("ddMMyyyyhhmmss") + info.Extension;
                fuImport.SaveAs(ImportFullPath + fileName);
                if (ddlImportType.SelectedValue == "1")
                {
                    obj = _importBAL.P2Import(fileName);
                }
                else if (ddlImportType.SelectedValue == "2")
                {
                    obj = _importBAL.P3Import(fileName);
                }
                else if (ddlImportType.SelectedValue == "3")
                {
                    obj = _importBAL.GLImport(fileName);
                }

                if (obj != null && int.Parse(obj.ToString()) > 0)
                {
                    //alertid = "#successalert";
                    successalert.Visible        = true;
                    ddlImportType.SelectedValue = "0";
                }
                else
                {
                    erroralert.Visible = true;
                    //alertid = "#erroralert";
                }
                //ClientScript.RegisterStartupScript(GetType(), "Javascript", "showhidemessage('" + alertid+"'); ", true);
            }
        }