예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int docID =Convert.ToInt32( Request.QueryString["docID"]);
            Doc dc = new Doc();
            dc.Docload(docID);
            txtTitle.Text = dc.docTitle;
            txtAbstract.Text = dc.docAbstract;
            txtKeyword.Text = dc.docKeywords;
            txtLetters.Text = dc.docLetters.ToString();
            txtAuthorInfo.Text = dc.docAuthor;

        }
        if (DropDownList1.SelectedValue != "11")
        {
            CheckBoxList1.Visible = false;
            RequiredFieldValidator1.Enabled = true;
        }
        else
        {
            CheckBoxList1.Visible = true;
            RequiredFieldValidator1.Enabled = false;
        }
    }
예제 #2
0
    static void Main(string[] args)
    {
        Configuration.Default.Username = "******";
        // Configuration.Default.Debug = true; // Not supported in Csharp
        DocApi docraptor = new DocApi();

        Doc doc = new Doc(
          Name: new String('s', 201), // limit is 200 characters
          Test: true,
          DocumentContent: "<html><body>Hello from C#</body></html>",
          DocumentType: Doc.DocumentTypeEnum.Pdf
        );

        AsyncDoc response = docraptor.CreateAsyncDoc(doc);

        AsyncDocStatus status_response;
        for(int i=0; i<30; i++) {
          status_response = docraptor.GetAsyncDocStatus(response.StatusId);
          if (status_response.Status == "failed") {
        Environment.Exit(0);
          }
          Thread.Sleep(1000);
        }
        Console.WriteLine("Did not receive failed validation within 30 seconds.");
        Environment.Exit(1);
    }
예제 #3
0
    static void Main(string[] args)
    {
        Configuration.Default.Username = "******";
        // Configuration.Default.Debug = true; // Not supported in Csharp
        DocApi docraptor = new DocApi();

        Doc doc = new Doc(
          Name: "csharp-async.pdf",
          Test: true,
          DocumentContent: "<html><body>Hello from C#</body></html>",
          DocumentType: Doc.DocumentTypeEnum.Pdf
        );

        AsyncDoc response = docraptor.CreateAsyncDoc(doc);

        AsyncDocStatus status_response;
        while(true) {
          status_response = docraptor.GetAsyncDocStatus(response.StatusId);
          if (status_response.Status == "completed") {
        break;
          }
          Thread.Sleep(1000);
        }

        docraptor.GetAsyncDoc(status_response.DownloadId);
    }
예제 #4
0
        public void RavenJToken_DeepEquals_Array_Test()
        {
            var original = new {Tokens = new[] {"Token-1", "Token-2", "Token-3"}};
            var modified = new {Tokens = new[] {"Token-1", "Token-3"}};

            // In modified object we deleted one item "Token-2"

            var difference = new List<DocumentsChanges>();
            if (!RavenJToken.DeepEquals(RavenJObject.FromObject(modified), RavenJObject.FromObject(original), difference))
            {
                // OK
                // 1 difference - "Token-2" value removed
            }

            // Expecting one difference - "Token-2" ArrayValueRemoved
            Assert.True(difference.Count == 1 && difference.SingleOrDefault(x => x.Change == DocumentsChanges.ChangeType.ArrayValueRemoved &&
                                                                                 x.FieldOldValue == "Token-2") != null);

            var originalDoc = new Doc {Names = new List<PersonName> {new PersonName {Name = "Tom1"}, new PersonName {Name = "Tom2"}, new PersonName {Name = "Tom3"}}};
            var modifiedDoc = new Doc {Names = new List<PersonName> {new PersonName {Name = "Tom1"}, new PersonName {Name = "Tom3"}}};

            // In modified object we deleted one item "Tom2"

            difference = new List<DocumentsChanges>();
            if (!RavenJToken.DeepEquals(RavenJObject.FromObject(modifiedDoc), RavenJObject.FromObject(originalDoc), difference))
            {
                // SOMETHING WRONG?
                // 3 differences - "Tom1", "Tom2", "Tom3" objects removed
            }

            // Expecting one difference - "Tom2" ArrayValueRemoved
            Assert.True(difference.Count == 1 && difference.SingleOrDefault(x => x.Change == DocumentsChanges.ChangeType.ArrayValueRemoved &&
                                                                                 x.FieldOldValue == "{\r\n  \"Name\": \"Tom2\"\r\n}") != null);
        }
예제 #5
0
        internal GridStream(
      Collection collection, 
      string name, 
      Doc fileInfo, 
      FileAccess access)
        {
            Contract.Requires(fileInfo != null);
              _collection = collection;
              _chunks = _collection.ChunkCollection();
              _fileInfo = new FileInfo(fileInfo, _collection);

              long rem;
              _totalChunks = (int)Math.DivRem(_fileInfo.Length, _fileInfo.ChunkSize, out rem);
              _totalChunks = rem > 0 ? _totalChunks + 1 : _totalChunks;
              _chunks.CreateIndex(new Index { { "files_id", Mongo.Dir.Asc }, { "n", Mongo.Dir.Asc } }, true);
              LoadChunk(0);
              _position = 0L;
              switch (access)
              {
            case FileAccess.Read:
              _canRead = true;
              break;
            case FileAccess.ReadWrite:
              _canRead = true;
              _canWrite = true;
              break;
            case FileAccess.Write:
              _canWrite = true;
              break;
              }
              _canSeek = true;
        }
        protected void Page_Load(object sender, EventArgs e)
        {

            if (Request.QueryString["xID"] == null)
            {
                SessionObject.RedirectMessage = "No entity ID provided in URL.";
                Response.Redirect("~/PortalSelection.aspx", true);
            }
            else
            {
                _addendumID = GetDecryptedEntityId(X_ID);
            }

            Doc doc = new Doc();

			doc = Assessment.RenderAssessmentAddendumToPdf(_addendumID, ConfigHelper.GetImagesUrl());

            byte[] theData = doc.GetData();
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "inline; filename=MyPDF.PDF");
            Response.AddHeader("content-length", theData.Length.ToString());
            Response.BinaryWrite(theData);

            ThinkgateEventSource.Log.ApplicationEvent(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "->" + MethodBase.GetCurrentMethod().Name, "Finished rendering PDF for addendum " + _addendumID, string.Empty);
        }
예제 #7
0
 protected override string InnerSerialization(object obj)
 {
     var doc = new Doc { Document = obj };
     var myXmlNode = JsonConvert.DeserializeXmlNode(JsonConvert.SerializeObject(doc));
     var result = myXmlNode.InnerXml;
     return result;
 }
예제 #8
0
        public void InsertingAndReadingDocumentWithReadOnlyFlagShouldWork()
        {
            using (var store = NewDocumentStore())
            {
                string docId;
                using (var session = store.OpenSession())
                {
                    var doc = new Doc { Name = "Name1" };
                    session.Store(doc);
                    session.Advanced.GetMetadataFor(doc)[Constants.RavenReadOnly] = true;

                    session.SaveChanges();

                    docId = doc.Id;
                }

                using (var session = store.OpenSession())
                {
                    var doc = session.Load<Doc>(docId);

                    Assert.NotNull(doc);
                    Assert.Equal("Name1", doc.Name);
                }
            }
        }
예제 #9
0
    static void Main(string[] args)
    {
        try {
          Configuration.Default.Username = "******"; // this key works for test documents
          DocApi docraptor = new DocApi();

          Doc doc = new Doc(
        Test: true,                                                    // test documents are free but watermarked
        DocumentContent: "<html><body>Hello World</body></html>",      // supply content directly
        // DocumentUrl: "http://docraptor.com/examples/invoice.html",  // or use a url
        Name: "docraptor-csharp.pdf",                                  // help you find a document later
        DocumentType: Doc.DocumentTypeEnum.Pdf                         // pdf or xls or xlsx
        // Javascript: true,                                           // enable JavaScript processing
        // PrinceOptions: new PrinceOptions(
        //   Media: "screen",                                          // use screen styles instead of print styles
        //   Baseurl: "http://hello.com"                               // pretend URL when using document_content
        // )
          );

          byte[] create_response = docraptor.CreateDoc(doc);
          File.WriteAllBytes("/tmp/docraptor-csharp.pdf", create_response);
          Console.WriteLine("Wrote PDF to /tmp/docraptor-csharp.pdf");
        } catch (DocRaptor.Client.ApiException error) {
          Console.WriteLine(error);
        }
    }
예제 #10
0
        static void Main(string[] args)
        {
            System.Console.WriteLine("Enter the name of the output pdf file:");

            var fileName = System.Console.ReadLine();
            fileName = fileName.Replace(".pdf", "");
            fileName = fileName.Replace(".PDF", "");

            Doc theDoc = new Doc();
            theDoc.Rect.Inset(72, 144);
            theDoc.HtmlOptions.AddLinks = true;

            int theID;
            theID = theDoc.AddImageUrl("http://www.yahoo.com/");

            while (true)
            {
                theDoc.FrameRect();
                if (!theDoc.Chainable(theID))
                    break;
                theDoc.Page = theDoc.AddPage();
                theID = theDoc.AddImageToChain(theID);
            }

            for (int i = 1; i <= theDoc.PageCount; i++)
            {
                theDoc.PageNumber = i;
                theDoc.Flatten();
            }

            theDoc.Save(System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), fileName + ".pdf"));
            theDoc.Clear();
        }
예제 #11
0
    protected void Bt_upload_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            string oldname = FileUpload1.FileName;
            string type = FileUpload1.FileName.Substring(FileUpload1.FileName.LastIndexOf(".") + 1);            //获取上传文件的后缀
            string filename = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + "." + type;

            if (type == "doc")
            {

                if (FileUpload1.FileName != "")
                {
                    //更改上传文件名

                    String path = Server.MapPath("~/upfiles/" + filename);
                    FileUpload1.PostedFile.SaveAs(path);
                }

                string author = Request.Cookies["userID"].Value.ToString();
                string state = "0";

                Hashtable docHt = new Hashtable();
                docHt.Add("docTime", SQLString.GetQuotedString(DateTime.Now.ToString()));
                docHt.Add("docTitle", SQLString.GetQuotedString(Session["docTitle"].ToString()));
                docHt.Add("docTitleEn", SQLString.GetQuotedString(Session["docTitleEn"].ToString()));
                docHt.Add("docAbstract", SQLString.GetQuotedString(Session["docAbstract"].ToString()));
                docHt.Add("docAbstractEn", SQLString.GetQuotedString(Session["docAbstractEn"].ToString()));
                docHt.Add("docKeywords", SQLString.GetQuotedString(Session["docKeywords"].ToString()));
                docHt.Add("docKeywordsEn", SQLString.GetQuotedString(Session["docKeywordsEn"].ToString()));
                docHt.Add("docLetters", SQLString.GetQuotedString(Session["docLetters"].ToString()));
                docHt.Add("docAuthor", SQLString.GetQuotedString(Session["docAuthor"].ToString()));
                docHt.Add("docColumnID", SQLString.GetQuotedString(Session["docColumnID"].ToString()));
                docHt.Add("authorID", SQLString.GetQuotedString(author));
                docHt.Add("docState", SQLString.GetQuotedString(state));

                Doc dc = new Doc();
                dc.Add(docHt);
                int docID = dc.GetID(author);

                Hashtable ht = new Hashtable();
                ht.Add("attachFilename", SQLString.GetQuotedString(oldname));
                ht.Add("attachName", SQLString.GetQuotedString(filename));
                ht.Add("docID", SQLString.GetQuotedString(Convert.ToString(docID)));
                Attach attach = new Attach();
                attach.Add(ht);

                Response.Write("<script language='javascript'>alert('投稿成功,谢谢您对本刊的支持!')</script>");
                Response.Write("<script>window.location='contribution1.aspx';</script>");

            }
            else
            {
                Response.Write("<script language='javascript'>alert('对不起,目前只接受.doc格式文档,请重新上传!')</script>");
            }

        }
    }
예제 #12
0
 public void GridViewBind()
 {
     DataSet ds = new DataSet();
     string author = Request.Cookies["userID"].Value.ToString();
     Doc dc = new Doc();
     ds = dc.LoadRepairdoc(author);
     GridView1.DataSource = ds.Tables[0];
     GridView1.DataBind();
 }
예제 #13
0
 public static Doc ToDoc(this IEnumerable<string> fields)
 {
     var d = new Doc();
       if (fields == null) return d;
       foreach (var item in fields)
       {
     d[item] = 1;
       }
       return d;
 }
예제 #14
0
 private void GridviewBind()
 {
     string title = txtdocTitle.Text;
     string author = txtauthorID.Text;
     string state = "25";
     Doc dc = new Doc();
     DataSet ds = dc.adminload(title, author, state);
     GridView1.DataSource = ds;
     GridView1.DataBind();
 }
예제 #15
0
    protected void printbutton_Click(object sender, EventArgs e)
    {
        string contents = string.Empty;

        MemoryStream ms = new MemoryStream();
        //using (StringWriter sw = new StringWriter()) {
        //    Server.Execute("Documents/report.aspx", sw);
        //    contents = sw.ToString();
        //    sw.Close();
        //}

        try {

            Doc doc = new Doc();
            //int font = doc.EmbedFont(Server.MapPath("Documents/") + "OpenSans-Regular-webfont.ttf", LanguageType.Unicode);
            //font = doc.EmbedFont(Server.MapPath("Documents/") + "OpenSans-Light-webfont.ttf", LanguageType.Unicode);
            doc.HtmlOptions.BrowserWidth = 960;
            doc.HtmlOptions.FontEmbed = true;
            doc.HtmlOptions.FontSubstitute = false;
            doc.HtmlOptions.FontProtection = false;
            int id = 0;
            Random rnd = new Random();
            //id = doc.AddImageUrl("http://" + Request.Url.Host + "/documents/bygg.aspx?rnd=" + rnd.Next(50000));
            id = doc.AddImageUrl("http://localhost:50030/Documents/jour.aspx?rnd=" + rnd.Next(50000));

            while (true) {
                //doc.FrameRect();
                if (!doc.Chainable(id)) {
                    break;
                }
                doc.Page = doc.AddPage();
                id = doc.AddImageToChain(id);
            }

            for (int i = 0; i < doc.PageCount; i++) {
                doc.PageNumber = i;
                doc.Flatten();
            }

            //doc.AddImageHtml(contents);
            //doc.Save(Server.MapPath("htmlimport.pdf"));
            doc.Save(ms);
            //doc.SaveOptions.
            doc.Clear();

                Response.ContentType = "application/pdf";
                Response.AddHeader("Content-Disposition", string.Format("attachment;filename=File-{0}.pdf", 1));
                Response.BinaryWrite(ms.ToArray());
                Response.End();

            //}
        } catch (Exception ex) {
            Response.Write(ex.Message);
        }
    }
예제 #16
0
 public ActionResult ExportPdf()
 {
     StreamReader sr = new StreamReader(@"D:\Code\C#\SmallDragon\SmallDragon\Temp\HtmlPage3.html");
     string html = sr.ReadToEnd();
     Doc doc = new Doc();
     doc.AddImageHtml(html);
     doc.Save(@"C:\Users\GuyFawkes\Desktop\New folder\out.pdf");
     doc.Clear();
     System.Diagnostics.Process.Start(@"C:\Users\GuyFawkes\Desktop\New folder\out.pdf");
     return View("Index");
 }
예제 #17
0
        public void UpdatingAndDeletingDocumentWithReadOnlyFlagShouldThrow()
        {
            using (var store = NewDocumentStore())
            {
                string docId;
                using (var session = store.OpenSession())
                {
                    var doc = new Doc { Name = "Name1" };
                    session.Store(doc);
                    session.Advanced.GetMetadataFor(doc)[Constants.RavenReadOnly] = true;

                    session.SaveChanges();

                    docId = doc.Id;
                }

                using (var session = store.OpenSession())
                {
                    var doc = session.Load<Doc>(docId);

                    var e1 = Assert.Throws<InvalidOperationException>(() => session.Delete(doc));
                    Assert.Equal("Raven.Tests.Issues.RDBQA_1+Doc is marked as read only and cannot be deleted", e1.Message);

                    session.Advanced.Clear();

                    session.Delete(docId);
                    var e2 = Assert.Throws<ErrorResponseException>(() => session.SaveChanges());
                    Assert.Contains("DELETE vetoed on document docs/1 by Raven.Database.Plugins.Builtins.ReadOnlyDeleteTrigger because: You cannot delete document 'docs/1' because it is marked as readonly. Consider changing 'Raven-Read-Only' flag to 'False'.", e2.Message);
                }

                using (var session = store.OpenSession())
                {
                    var doc = session.Load<Doc>(docId);
                    doc.Name = "Name2";

                    session.Store(doc);
                    session.SaveChanges();

                    session.Advanced.Clear();

                    doc = session.Load<Doc>(docId);
                    Assert.Equal("Name1", doc.Name);

                    session.Advanced.Clear();

                    doc.Name = "Name2";
                    session.Store(doc);
                    session.Advanced.GetMetadataFor(doc)[Constants.RavenReadOnly] = true;

                    var e = Assert.Throws<ErrorResponseException>(() => session.SaveChanges());
                    Assert.Contains("PUT vetoed on document docs/1 by Raven.Database.Plugins.Builtins.ReadOnlyPutTrigger because: You cannot update document 'docs/1' when both of them, new and existing one, are marked as readonly. To update this document change 'Raven-Read-Only' flag to 'False' or remove it entirely.", e.Message);
                }
            }
        }
예제 #18
0
        public void Client_should_be_able_to_work_on_old_unique_constraint_document()
        {
            DocumentStore.DatabaseCommands.Put("docs/10", null, RavenJObject.FromObject(new { AlternateIdentifier = "aaa" }), new RavenJObject());
            DocumentStore.DatabaseCommands.Put("UniqueConstraints/Docs/AlternateIdentifier/aaa", null, RavenJObject.FromObject(new { RelatedId = "docs/10" }), new RavenJObject()); // old format

            using (var session = DocumentStore.OpenSession())
            {
                var sample1 = new Doc { AlternateIdentifier = "aaa" };
                Assert.False(session.CheckForUniqueConstraints(sample1).ConstraintsAreFree());
            }
        }
예제 #19
0
 private void GridviewBind()
 {
     int assess = 1;
     string expert = Request.Cookies["userID"].Value.ToString();
     string title = txtdocTitle.Text;
     string author = txtauthorID.Text;
     Doc dc = new Doc();
     DataSet ds = dc.expertload(expert, title, author, assess);
     GridView1.DataSource = ds.Tables[0].DefaultView;
     GridView1.DataBind();
 }
예제 #20
0
        private static void Main(string[] args)
        {
            // install your own licence

            using (Doc doc = new Doc())
            {
                doc.Read("in.pdf"); // in this PDF the image has an embedded ICC profile, and I must remove them

                Console.WriteLine("################################ THROUGH GETINFO ################################");

                // Remove the ICC profiles through Get/SetInfo methods
                foreach (var item in doc.ObjectSoup)
                {
                    if (item != null && doc.GetInfo(item.ID, "/ColorSpace*[0]*:Name").Equals("ICCBased", StringComparison.InvariantCultureIgnoreCase))
                    {
                        int profileId = doc.GetInfoInt(item.ID, "/ColorSpace*[1]:Ref"); // note the [1]: why is it there?
                        if (profileId != 0)
                        {
                            doc.GetInfo(profileId, "Decompress");
                            string profileData = doc.GetInfo(profileId, "Stream");

                            // this outputs the ICC profile raw data, with the profile's name somewhere up top
                            Console.WriteLine(string.Format("ICC profile for object ID {0}: {1}", item.ID, profileData)); 

                            doc.SetInfo(profileId, "Stream", string.Empty);
                            doc.GetInfo(profileId, "Compress");
                        }
                    }
                }

                doc.Save("out-infos.pdf");
                doc.Clear();
                doc.Read("in.pdf");

                Console.WriteLine("################################ THROUGH OBJECTS ################################");

                // Remove ICC profiles through the pixmap objects
                foreach (var item in doc.ObjectSoup)
                {
                    if (doc.GetInfo(item.ID, "Type") == "jpeg") // only work on PixMaps
                    {
                        PixMap pm = (PixMap)item;
                        if (pm.ColorSpaceType == ColorSpaceType.ICCBased)
                        {
                            // pm.ColorSpace.IccProfile is always null so I can't really set it to null or Recolor() it because it would change noting
                            Console.WriteLine(string.Format("ICC profile for object ID {0}: {1}", item.ID, pm.ColorSpace.IccProfile)); // there should already be an ICC profile (ColorSpaceType = ICCBased) so why does ColorSpace.IccProfile creates one ?
                        }
                    }
                }

                doc.Save("out-objects.pdf");
            }
        }
        public void Control()
        {
            var connectionString = ConfigurationManager.ConnectionStrings["LicenseKey"].ConnectionString;
            XSettings.InstallLicense(connectionString);
            var theDoc = new Doc { FontSize = 96 };

            theDoc.AddText("Control");
            Response.ContentType = "application/pdf";
            theDoc.Save(Response.OutputStream);
            theDoc.Clear();
            theDoc.Dispose();
        }
예제 #22
0
    public static bool createPdf(long kid,string klotterno,string email)
    {
        string contents = string.Empty;

        MemoryStream ms = new MemoryStream();

        try {
            int id;
            Doc doc = new Doc();

            doc.MediaBox.String = "A4";
            doc.Rect.String = doc.MediaBox.String;
            //doc.Rect. = doc.CropBox;
            doc.HtmlOptions.BrowserWidth = 980;
            doc.HtmlOptions.FontEmbed = true;
            doc.HtmlOptions.FontSubstitute = false;
            doc.HtmlOptions.FontProtection = false;
            doc.HtmlOptions.ImageQuality = 33;
            Random rnd = new Random();
            id = doc.AddImageUrl("http://" + HttpContext.Current.Request.Url.Host + "/Documents/klotter_pdf.aspx?id=" + kid.ToString() + "&uid="+ email +"&rnd=" + rnd.Next(50000));

            while (true) {
                //doc.FrameRect();
                if (!doc.Chainable(id)) {
                    break;
                }
                doc.Page = doc.AddPage();
                id = doc.AddImageToChain(id);
            }

            for (int i = 0; i < doc.PageCount; i++) {
                doc.PageNumber = i;
                doc.Flatten();
            }

            //doc.AddImageHtml(contents);
            //doc.Save(Server.MapPath("htmlimport.pdf"));
            doc.Save(ms);
            //doc.SaveOptions.
            doc.Clear();

            bool mail = Common.PdfMail(ms, email, "Klotter");
            if (mail) {
                return AmazonHandler.PutPdfKlotter(ms, klotterno, 0);
            }
            return false;

            //}
        } catch (Exception ex) {
            return false;
        }
    }
예제 #23
0
 private void GridviewBind()
 {
     Editor ed = new Editor();
     ed.LoadInfo(Request.Cookies["userID"].Value.ToString());
     string column = ed.editorColumn;
     string title = txtdocTitle.Text;
     string author = txtauthorID.Text;
     string state = "0";
     Doc dc = new Doc();
     DataSet ds = dc.editorload(column, title, author, state);
     GridView1.DataSource = ds;
     GridView1.DataBind();
 }
예제 #24
0
 //5_1_a_s_p_x
 private void GridviewBind()
 {
     string timeF = ddlyearF.SelectedItem.Text + "-" + ddlMonthF.SelectedItem.Text + "-" + "1";
     string timeT = ddlYearT.SelectedItem.Text + "-" + ddlMonthT.SelectedItem.Text + "-" + "1";
     string title = txtdocTitle.Text;
     string column = ddlColumn.SelectedValue;
     string keyword = txtKeywords.Text;
     Doc dc = new Doc();
     DataSet ds = dc.AllDoc(title, column, keyword, timeF, timeT);
     lblCount.Text = Convert.ToString(ds.Tables[0].Rows.Count);
     GridView1.DataSource = ds.Tables[0];
     GridView1.DataBind();
 }
예제 #25
0
파일: Program.cs 프로젝트: NituThakkar/ajay
    static void Main()
    {
        Doc c = new Doc();
        c.Print();

        (c as Printer).Print();
        (c as Screen).Print();
        Printer printer = c;
        Screen screen = c;

        printer.Print();
        screen.Print();
    }
예제 #26
0
 internal FileInfo(Doc doc, Collection collection)
 {
     Id = doc["_id"];
       Filename = doc["filename"] as string;
       ContentType = doc["contentType"] as string;
       Length = Convert.ToInt64(doc["length"]);
       ChunkSize = Convert.ToInt32(doc["chunkSize"]);
       UploadDate = ((DateTime)doc["uploadDate"]);
      // Aliases = (doc["aliases"] as IList).OfType<string>() as IList<string>;
       MetaData = doc["metadata"] as Doc;
       MD5 = doc["md5"] as string;
       _collection = collection;
 }
예제 #27
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string expert = Request.Cookies["userID"].Value.ToString();
         int docID = Convert.ToInt32(Request.QueryString["docID"]);
         Doc dc = new Doc();
         dc.Docload(docID);
         Label1.Text = dc.docTitle;
         DataRow dr = dc.viewassess(expert, docID);
         lblAssessment.Text = dr[0].ToString();
     }
 }
        protected void btnPrintBtn_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            int credentialID = Convert.ToInt32(Request.QueryString["credentialID"]);
            Doc theDoc = new Doc();
            //clear caching?
            theDoc.HtmlOptions.PageCacheEnabled = false;
            theDoc.HtmlOptions.UseNoCache = true;
            theDoc.HtmlOptions.PageCacheClear();
            theDoc.HtmlOptions.PageCachePurge();
            theDoc.HtmlOptions.UseResync = true;
            theDoc.Rect.String = "10 90 600 750";




            string selectedCriteria = Session["selectedCriteria"].ToString();

            string hostURL = (HttpContext.Current.Request.IsSecureConnection ? "https://" : "http://") + HttpContext.Current.Request.Url.Host.ToString();
            string callUrl = ResolveUrl("~/Controls/Credentials/PDF/StudentCountListPdf.aspx?xCriteria=" + selectedCriteria);
            int theID;
            theID = theDoc.AddImageUrl(hostURL + callUrl);
            while (true)
            {

                if (!theDoc.Chainable(theID))
                    break;
                theDoc.Page = theDoc.AddPage();
                theID = theDoc.AddImageToChain(theID);
            }
            for (int i = 1; i <= theDoc.PageCount; i++)
            {
                theDoc.PageNumber = i;

                theDoc.Flatten();
            }
            theDoc = AddHeaderFooter(theDoc);
            byte[] pdf = theDoc.GetData();

            Response.Clear();
            Response.ClearHeaders();    // Add this line
            Response.ClearContent();    // Add this line
            //string filename = lblStudentName.Text.Replace(',', '-') + "EarnedCredentialList";
            Response.AddHeader("Content-Disposition", "attachment; filename=" + "CredentialList" + ".pdf");
            Response.AddHeader("content-length", pdf.Length.ToString());
            Response.ContentType = "application/pdf";
            Response.BinaryWrite(pdf);
            Response.End();
            theDoc.Clear();

        }
예제 #29
0
        public byte[] Convert(string link, string width, string height)
        {
            try
            {
                var theDoc = new Doc();

                theDoc.SetInfo(0, "License", "141-819-141-276-8435-093");
                double pageWidth = System.Convert.ToDouble(width.ToUpper().Replace("PX", ""));
                double pageHeight = System.Convert.ToDouble(height.ToUpper().Replace("PX", "")) * 1.762;
                if (pageHeight>=14400)
                {
                    pageHeight = 14400;
                }
                theDoc.MediaBox.Width = pageWidth;
                theDoc.MediaBox.Height = pageHeight;
                theDoc.Rect.Width = pageWidth;
                theDoc.Rect.Height = pageHeight;
                theDoc.Rect.Inset(5, 5);
                theDoc.HtmlOptions.AddLinks = true;

                theDoc.Page = theDoc.AddPage();
                var theId = theDoc.AddImageUrl(link, false, 0, true);

                while (true)
                {
                    if (!theDoc.Chainable(theId))
                        break;
                    theDoc.Page = theDoc.AddPage();
                    theId = theDoc.AddImageToChain(theId);
                }

                // Link pages together
                theDoc.HtmlOptions.LinkPages();

                for (var i = 1; i <= theDoc.PageCount; i++)
                {
                    theDoc.PageNumber = i;
                    theDoc.Flatten();
                }

                var buffer = theDoc.GetData();
                theDoc.Clear();

                return buffer;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #30
0
    /// <summary>
    /// Add a definition to the output.
    /// Also adds a ref to the def, and
    /// potentially a doc.
    /// </summary>
    /// <param name="def">The def to add.</param>
    /// <param name="symbol">The symbol the def was created from.</param>
    void AddDef(Def def, Doc doc = null)
    {
      var r = Ref.AtDef(def);
      _output.Defs.Add(def);
      _output.Refs.Add(r);

      if (doc != null)
      {
        doc.UnitType = r.DefUnitType;
        doc.Unit = r.DefUnit;
        doc.Path = r.DefPath;
        _output.Docs.Add(doc);
      }
    }
예제 #31
0
        private void save(string flag = "N")
        {
            #region 数据有效性验证
            if (docFLAG.SelectedValue != "M")
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            string strBillno = docSEQNO.Text;
            if (!Doc.getFlag(strBillno, "M", BillType))
            {
                Alert.Show("此单据已被其他人处理,请刷新页面更新单据状态!", "警告提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().ToList();
            if (newDict.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
            //判断是否有空行
            for (int i = 0; i < newDict.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()))
                {
                    goodsData.Add(newDict[i]);
                }
            }

            if (goodsData.Count == 0)//所有Gird行都为空行时
            {
                Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            //验证单据信息
            if (DbHelperOra.Exists("SELECT 1 FROM dat_ck_doc where seqno = '" + docBILLNO.Text + "'") && docBILLNO.Enabled)
            {
                Alert.Show("您输入的单号已存在,请检查!");
                return;
            }
            #endregion

            if (PubFunc.StrIsEmpty(docBILLNO.Text))
            {
                docSEQNO.Text = BillSeqGet();
                //处理单号前缀
                docSEQNO.Text     = "DSC" + docSEQNO.Text.Substring(3, docSEQNO.Text.Length - 3);
                docBILLNO.Text    = docSEQNO.Text;
                docBILLNO.Enabled = false;
            }
            MyTable mtType = new MyTable("DAT_CK_DOC");
            mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
            mtType.ColRow["SEQNO"] = docBILLNO.Text;
            mtType.ColRow.Add("BILLTYPE", "DSC");
            mtType.ColRow.Add("SUBNUM", goodsData.Count);
            mtType.ColRow.Add("XSTYPE", "1");
            mtType.ColRow.Remove("SHRQ");
            decimal            subNum   = 0;//总金额
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_CK_COM");
            //先删除单据信息在插入
            cmdList.Add(mtType.DeleteCommand(""));                                                        //删除单据台头
            cmdList.Add(new CommandInfo("delete dat_ck_com where seqno='" + docBILLNO.Text + "'", null)); //删除单据明细
            for (int i = 0; i < goodsData.Count; i++)
            {
                mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]);

                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow["ROWNO"] = i + 1;
                mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]);
                mtTypeMx.ColRow.Add("XSSL", mtTypeMx.ColRow["BZHL"]);
                mtTypeMx.ColRow.Add("BHSJJ", 0);
                mtTypeMx.ColRow.Add("BHSJE", 0);
                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("PRODUCERNAME");
                subNum = subNum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString());
                cmdList.Add(mtTypeMx.Insert());
            }
            mtType.ColRow.Add("SUBSUM", subNum);
            cmdList.AddRange(mtType.InsertCommand());
            DbHelperOra.ExecuteSqlTran(cmdList);
            if (flag == "N")
            {
                Alert.Show("定数出库信息保存成功!");
            }
            OperLog("定数出库", "修改单据【" + docBILLNO.Text + "】");
            billOpen(docBILLNO.Text);
            btnDel.Enabled = true;
            billLockDoc(true);
            SaveSuccess = true;
        }
예제 #32
0
파일: Program.cs 프로젝트: chcg/getboost
        static void Main(string[] args)
        {
            var doc = new Doc();

            // Changes
            {
                doc = doc[T.H1("Release Notes")];
                foreach (var change in Config.Release)
                {
                    doc = doc[change];
                }
            }

            // headers only library.
            {
                doc = doc
                      [T.H1("Headers Only Libraries")]
                      [T.List[A("boost", Config.Version)]];
                var path     = Path.Combine(Config.BoostDir, "boost");
                var fileList =
                    new Dir(new DirectoryInfo(path), "boost").
                    FileList(f => true);
                Nuspec.Create(
                    "boost",
                    "boost",
                    Config.Version,
                    "boost",
                    new[]
                {
                    new Targets.ItemDefinitionGroup(
                        clCompile:
                        new Targets.ClCompile(
                            additionalIncludeDirectories:
                            new[]
                    {
                        Targets.PathFromThis(
                            Targets.IncludePath)
                    }
                            )
                        )
                },
                    fileList.Select(
                        f =>
                        new Nuspec.File(
                            Path.Combine(Config.BoostDir, f),
                            Path.Combine(Targets.IncludePath, f)
                            )
                        ),
                    new CompilationUnit[0],
                    new Nuspec.Dependency[0],
                    new[] { "headers" }
                    );
            }

            // source libraries.

            /*
             * doc = doc[T.H1("Source Libraries")];
             * var srcLibList = new List<string>();
             * foreach (var directory in Directory
             *  .GetDirectories(Path.Combine(Config.BoostDir, "libs")))
             * {
             *  var src = Path.Combine(directory, "src");
             *  if (Directory.Exists(src))
             *  {
             *      var name = Path.GetFileName(directory);
             *
             *      var libraryConfig = Config
             *          .LibraryList
             *          .Where(l => l.Name == name)
             *          .FirstOrDefault()
             *          ?? new Library(name);
             *
             *      foreach(var libName in MakeSrcLibrary(libraryConfig, src))
             *      {
             *          var fullName = "boost_" + libName + "-src";
             *          srcLibList.Add(libName);
             *          doc = doc[T.List[A(
             *              libName, fullName, Config.Version)]];
             *      }
             *  }
             * }
             * Nuspec.Create(
             *      "boost-src",
             *      "boost-src",
             *      Config.Version,
             *      "boost-src",
             *      Enumerable.Empty<Targets.ItemDefinitionGroup>(),
             *      Enumerable.Empty<Nuspec.File>(),
             *      Enumerable.Empty<CompilationUnit>(),
             *      srcLibList.Select(srcLib => new Nuspec.Dependency(
             *          "boost_" + srcLib + "-src", Config.Version.ToString())),
             *      new[] { "sources" });
             */

            // create dictionaries for binary NuGet packages.
            doc = doc[T.H1("Precompiled Libraries")];

            // compiler -> (library name -> pacakge)
            var compilerDictionary =
                new Dictionary <string, Dictionary <string, CompiledPackage> >();

            // library name -> library.
            var libraryDictionary = new Dictionary <string, CompiledLibrary>();

            ScanCompiledFileSet(compilerDictionary, libraryDictionary);

            // all libraries for specific compiler.
            {
                var list = T.List[T.Text("all libraries")];
                foreach (var compiler in compilerDictionary.Keys.OrderBy(Config.CompilerNumber))
                {
                    var id = "boost-" + compiler;
                    var compilerLibraries = compilerDictionary[compiler];
                    CreateBinaryNuspec(
                        id,
                        compiler,
                        Enumerable.Empty <Targets.ItemDefinitionGroup>(),
                        Enumerable.Empty <Nuspec.File>(),
                        compilerLibraries
                        .Keys
                        .Select(lib => SrcPackage.Dependency(lib, compiler)),
                        Optional <string> .Absent.Value);
                    list = list
                           [T.Text(" ")]
                           [A(
                                compiler,
                                id,
                                SrcPackage.CompilerVersion(Config.CompilerMap[compiler]))];
                }
                doc = doc[list];
            }

            //
            var itemDefinitionGroupList = new[]
            {
                new Targets.ItemDefinitionGroup(
                    link: new Targets.Link(
                        additionalLibraryDirectories:
                        new[]
                {
                    Targets.PathFromThis(Targets.LibNativePath)
                }
                        ))
            };

            // NuGet packages for each library.
            foreach (var library in libraryDictionary)
            {
                var name      = library.Key;
                var libraryId = "boost_" + name;
                var list      = T.List[T.Text(name)];
                foreach (var package in library
                         .Value
                         .PackageDictionary
                         .OrderBy(p => Config.CompilerNumber(p.Key)))
                {
                    var compiler     = package.Key;
                    var packageValue = package.Value;
                    var nuspecId     = libraryId + "-" + compiler;
                    CreateBinaryNuspec(
                        nuspecId,
                        compiler,
                        itemDefinitionGroupList,
                        packageValue.FileList.Select(
                            f =>
                            new Nuspec.File(
                                Path.Combine(Config.BoostDir, f),
                                Targets.LibNativePath)
                            ),
                        SrcPackage.BoostDependency,
                        name.ToOptional());
                    list = list
                           [T.Text(" ")]
                           [A(
                                package.Key,
                                nuspecId,
                                SrcPackage.CompilerVersion(Config.CompilerMap[compiler]))];
                }
                doc = doc[list];
            }

            // release.md
            using (var file = new StreamWriter("RELEASE.md"))
            {
                doc.Write(file);
            }
        }
예제 #33
0
        protected override void billOpen(string strBillno)
        {
            DataTable dtDoc = DbHelperOra.Query(string.Format(strDocSql, strBillno)).Tables[0];

            PubFunc.FormDataSet(FormDoc, dtDoc.Rows[0]);

            PageContext.RegisterStartupScript(GridGoods.GetRejectChangesReference());
            decimal   bzslTotal = 0, feeTotal = 0, dhslTotal = 0;
            DataTable dtBill = DbHelperOra.Query(string.Format(strComSql, strBillno, docDEPTOUT.SelectedValue)).Tables[0];

            Doc.GridRowAdd(GridGoods, dtBill);
            if (dtBill != null && dtBill.Rows.Count > 0)
            {
                foreach (DataRow row in dtBill.Rows)
                {
                    bzslTotal += Convert.ToDecimal(row["BZSL"]);
                    feeTotal  += Convert.ToDecimal(row["HSJE"]);
                    dhslTotal += Convert.ToDecimal(row["DHSL"]);
                }
            }
            //计算合计数量
            JObject summary = new JObject();

            summary.Add("GDNAME", "本页合计");
            summary.Add("BZSL", bzslTotal.ToString());
            summary.Add("HSJE", feeTotal.ToString("F2"));
            summary.Add("DHSL", dhslTotal.ToString());
            GridGoods.SummaryData = summary;
            PubFunc.FormLock(FormDoc, true, "");
            if ((",M,R").IndexOf(docFLAG.SelectedValue) > 0)
            {
                docMEMO.Enabled = true;
            }
            TabStrip1.ActiveTabIndex = 1;
            //增加按钮控制
            if (docFLAG.SelectedValue == "M" || docFLAG.SelectedValue == "R")
            {
                btnDel.Enabled    = true;
                btnSave.Enabled   = true;
                btnAudit.Enabled  = true;
                btnCancel.Enabled = false;
                btnPrt.Enabled    = false;
                btnPrint.Enabled  = false;
                btnDelRow.Enabled = true;
                btnGoods.Enabled  = true;
                docGZM.Enabled    = true;
                btnSubmit.Enabled = true;
            }
            else if (docFLAG.SelectedValue == "N")
            {
                btnDel.Enabled    = false;
                btnSave.Enabled   = false;
                btnAudit.Enabled  = true;
                btnCancel.Enabled = true;
                btnPrt.Enabled    = false;
                btnPrint.Enabled  = false;
                btnDelRow.Enabled = false;
                btnGoods.Enabled  = false;
                btnSubmit.Enabled = false;
                docGZM.Enabled    = false;
            }
            else
            {
                btnDel.Enabled    = false;
                btnSave.Enabled   = false;
                btnAudit.Enabled  = false;
                btnCancel.Enabled = false;
                btnPrt.Enabled    = true;
                btnPrint.Enabled  = true;
                btnDelRow.Enabled = false;
                btnGoods.Enabled  = false;
                btnSubmit.Enabled = false;
                docGZM.Enabled    = false;
            }
        }
예제 #34
0
 public static Doc Print(VarPatternSyntax node)
 {
     return(Doc.Concat(Token.Print(node.VarKeyword, " "), Node.Print(node.Designation)));
 }
예제 #35
0
        static void Main(string[] args)
        {
            var doc = new Doc();

            // Changes
            {
                doc = doc[T.H1("Release Notes")];
                foreach (var change in Config.Release)
                {
                    doc = doc[change];
                }
            }

            // headers only library.
            {
                doc = doc
                      [T.H1("Headers Only Libraries")]
                      [T.List[A("boost", Config.Version)]];
                var path     = Path.Combine(Config.BoostDir, "boost");
                var fileList =
                    new Dir(new DirectoryInfo(path), "boost").
                    FileList(f => true);
                Nuspec.Create(
                    "boost",
                    "boost",
                    Config.Version,
                    "boost",
                    new[]
                {
                    new Targets.ItemDefinitionGroup(
                        clCompile:
                        new Targets.ClCompile(
                            additionalIncludeDirectories:
                            new[]
                    {
                        Targets.PathFromThis(
                            Targets.IncludePath)
                    }
                            )
                        )
                },
                    fileList.Select(
                        f =>
                        new Nuspec.File(
                            Path.Combine(Config.BoostDir, f),
                            Path.Combine(Targets.IncludePath, f)
                            )
                        ),
                    new CompilationUnit[0],
                    new Nuspec.Dependency[0],
                    new[] { "headers" }
                    );
            }

            // source libraries.
            doc = doc[T.H1("Source Libraries")];
            foreach (var directory in Directory
                     .GetDirectories(Path.Combine(Config.BoostDir, "libs")))
            {
                var src = Path.Combine(directory, "src");
                if (Directory.Exists(src))
                {
                    var name = Path.GetFileName(directory);

                    var libraryConfig = Config
                                        .LibraryList
                                        .Where(l => l.Name == name)
                                        .FirstOrDefault()
                                        ?? new Library(name);

                    foreach (var libName in MakeLibrary(libraryConfig, src))
                    {
                        doc = doc[T.List[A(
                                             libName, "boost_" + libName, Config.Version)]];
                    }
                }
            }

            // create dictionaries for binary NuGet packages.
            doc = doc[T.H1("Precompiled Libraries")];

            // compiler -> (library name -> pacakge)
            var compilerDictionary =
                new Dictionary <string, Dictionary <string, CompiledPackage> >();

            // library name -> library.
            var libraryDictionary = new Dictionary <string, CompiledLibrary>();

            foreach (var platform in Config.PlatformList)
            {
                ScanCompiledFileSet(
                    compilerDictionary, libraryDictionary, platform);
            }

            // all libraries for specific compiler.
            {
                var list = T.List[T.Text("all libraries")];
                foreach (var compiler in compilerDictionary.Keys)
                {
                    var id = "boost-" + compiler;
                    var compilerLibraries = compilerDictionary[compiler];
                    CreateBinaryNuspec(
                        id,
                        compiler,
                        Enumerable.Empty <Targets.ItemDefinitionGroup>(),
                        Enumerable.Empty <Nuspec.File>(),
                        compilerLibraries
                        .Keys
                        .Select(lib => Package.Dependency(lib, compiler)),
                        Optional <string> .Absent.Value,
                        compilerLibraries
                        .Values
                        .SelectMany(package => package.PlatformList)
                        .Distinct());
                    list = list
                           [T.Text(" ")]
                           [A(
                                compiler,
                                id,
                                Package.CompilerVersion(Config.CompilerMap[compiler]))];
                }
                doc = doc[list];
            }

            //
            var itemDefinitionGroupList =
                Config.
                PlatformList.
                Select(
                    p =>
                    new Targets.ItemDefinitionGroup(
                        condition: "'$(Platform)'=='" + p.Name + "'",
                        link:
                        new Targets.Link(
                            additionalLibraryDirectories:
                            new[]
            {
                Targets.PathFromThis(
                    Path.Combine(
                        Targets.LibNativePath,
                        p.Directory)
                    )
            }
                            )
                        )
                    );

            // NuGet packages for each library.
            foreach (var library in libraryDictionary)
            {
                var name      = library.Key;
                var libraryId = "boost_" + name;
                var list      = T.List[T.Text(name)];
                foreach (var package in library.Value.PackageDictionary)
                {
                    var compiler     = package.Key;
                    var packageValue = package.Value;
                    var nuspecId     = libraryId + "-" + compiler;
                    CreateBinaryNuspec(
                        nuspecId,
                        compiler,
                        itemDefinitionGroupList,
                        packageValue.FileList.Select(
                            f =>
                            new Nuspec.File(
                                Path.Combine(Config.BoostDir, f),
                                Path.Combine(Targets.LibNativePath, f)
                                )
                            ),
                        Package.BoostDependency,
                        name.ToOptional(),
                        packageValue.PlatformList);
                    list = list
                           [T.Text(" ")]
                           [A(
                                package.Key,
                                nuspecId,
                                Package.CompilerVersion(Config.CompilerMap[compiler]))];
                }
                doc = doc[list];
            }

            // codeplex.txt
            using (var file = new StreamWriter("codeplex.txt"))
            {
                doc.Write(file);
            }
        }
예제 #36
0
 public void Dispose() => Doc.Dispose();
예제 #37
0
 private static ValidState validateIValidatable(Doc self, ObjectGraph graph, IValidatable validatable, ValidState state, string scope)
 => !graph.Visited(validatable) ? validatable.Validate(state, scope) : state;
예제 #38
0
 public static int CRUDUpsert(MySQLDataStoreBase store, MySqlConnection cnn, MySqlTransaction trans, Doc doc, FieldFilterFunc filter)
 {
     try
     {
         return(crudUpsert(store, cnn, trans, doc, filter));
     }
     catch (Exception error)
     {
         throw new MySqlDataAccessException(
                   StringConsts.CRUD_STATEMENT_EXECUTION_ERROR.Args("upsert", error.ToMessageWithType(), error),
                   error,
                   KeyViolationKind.Unspecified,
                   KeyViolationName(error));
     }
 }
예제 #39
0
 public static Doc Print(NullableTypeSyntax node)
 {
     return(Doc.Concat(Node.Print(node.ElementType), Token.Print(node.QuestionToken)));
 }
예제 #40
0
 public static int CRUDDelete(MySQLDataStoreBase store, MySqlConnection cnn, MySqlTransaction trans, Doc doc, IDataStoreKey key)
 {
     try
     {
         return(crudDelete(store, cnn, trans, doc, key));
     }
     catch (Exception error)
     {
         throw new MySqlDataAccessException(StringConsts.CRUD_STATEMENT_EXECUTION_ERROR.Args("delete", error.ToMessageWithType(), error), error);
     }
 }
예제 #41
0
파일: Main.g.cs 프로젝트: to11mtm/OddJob
 public Main scripts(Doc x)
 {
     holes.Add(TemplateHole.NewElt("scripts", x)); return(this);
 }
예제 #42
0
파일: Main.g.cs 프로젝트: to11mtm/OddJob
 public Main Body(Doc x)
 {
     holes.Add(TemplateHole.NewElt("body", x)); return(this);
 }
예제 #43
0
 public static Task <Content> Page(Context <object> ctx, object endpoint, string title, Doc body) =>
 Content.Page(
     new Template.Main()
     .Title(title)
     .MenuBar(MenuBar(ctx, endpoint))
     .Body(body)
     .Doc()
     );
예제 #44
0
 public DataTable GetGoods(int pageNum, int pageSize, NameValueCollection nvc, ref int total, ref string errMsg)
 {
     hfdSearch.Text = Doc.filterSql(trbSearch.Text);
     return(GetDataTable(pageNum, pageSize, GetSql(), ref total));
 }
예제 #45
0
        protected void btExport_Click(object sender, EventArgs e)
        {
            if (TabStrip1.ActiveTabIndex == 0)
            {
                if (GridGoods.Rows.Count < 1)
                {
                    Alert.Show("没有数据,无法导出!");
                    return;
                }
                Response.ClearContent();
                Response.AddHeader("content-disposition", "attachment; filename=科室排行.xls");
                Response.ContentType = "application/excel";

                Response.ContentEncoding = System.Text.Encoding.UTF8;

                Response.Write(Doc.GetGridTableHtml(GridGoods));

                Response.End();
                btnExp.Enabled = true;
            }
            if (TabStrip1.ActiveTabIndex == 1)
            {
                if (GridList.Rows.Count < 1)
                {
                    Alert.Show("没有数据,无法导出!", MessageBoxIcon.Warning);
                    return;
                }
                string    strSql        = @"SELECT MM.DEPTNAME 科室名称,' '||MM.GDSEQ 商品编码,MM.GDNAME 商品名称,MM.DHSL 申请数量,
                           NVL(NN.PSSL, 0) 配送数量,
                           ROUND(NVL(PSSL, 0) / NVL(MM.DHSL, 0), 4) 满足率
                      FROM (SELECT DEPTID,
                                   DEPTNAME,
                                   GDSEQ,
                                   GDNAME,
                                   NVL(SUM(DHSL) / COUNT(X.DEPTID), 0) DHSL        
                              FROM (SELECT A.DEPTID,
                                           F_GETDEPTNAME(A.DEPTID) DEPTNAME,
                                           B.GDSEQ,
                                           DG.GDNAME,
                                           (SELECT SUM(DSC.DHSL)
                                              FROM DAT_SL_COM DSC, DAT_SL_DOC DSD, DOC_GOODS DG
                                             WHERE DSC.SEQNO = DSD.SEQNO(+)
                                               AND DSC.GDSEQ = DG.GDSEQ
                                               AND DSD.DEPTID = A.DEPTID
                                               AND DSC.GDSEQ = B.GDSEQ
                                               AND DG.FLAG IN ('Y', 'T')
                                               AND DSD.FLAG <> 'R'
                                               AND DG.ISGZ LIKE (NVL('{0}', '%'))
                                               AND DSD.DEPTID LIKE NVL('{1}', '%')
                                               AND DSD.XSRQ BETWEEN
                                                   TO_DATE('{2}', 'YYYY-MM-DD') AND
                                                   TO_DATE('{3}', 'YYYY-MM-DD')
                                               AND  (DG.GDSEQ LIKE '%{4}%' OR DG.GDNAME LIKE '%{4}%' OR
                                                  DG.ZJM LIKE '%{4}%')) DHSL
                
                                      FROM DAT_SL_DOC A, DAT_SL_COM B, SYS_DEPT SD, DOC_GOODS DG
                                     WHERE XSRQ BETWEEN TO_DATE('{2}', 'YYYY-MM_DD') AND
                                           TO_DATE('{3}', 'YYYY-MM_DD')
                                       AND A.DEPTID = SD.CODE(+)
                                       AND B.GDSEQ = DG.GDSEQ
                                       AND SD.TYPE <> '1'
                                       AND A.SEQNO = B.SEQNO(+)
                                       AND B.GDSEQ = DG.GDSEQ(+)
                                       AND DG.FLAG IN ('Y', 'T')
                                       AND DG.ISGZ LIKE (NVL('{0}', '%'))
                                       AND A.DEPTID LIKE NVL('{1}', '%')
                                       AND  (DG.GDSEQ LIKE '%{4}%' OR DG.GDNAME LIKE '%{4}%' OR
                                     DG.ZJM LIKE '%{4}%')
                                     GROUP BY A.DEPTID, A.FLAG, A.SEQNO, B.GDSEQ, DG.GDNAME) X
                             GROUP BY DEPTID, DEPTNAME, GDSEQ, GDNAME
                             ORDER BY DEPTID DESC) MM,
                           (((SELECT NVL(SUM(CK_COM.DHSL), 0) PSSL, DOC.DEPTID, CK_COM.GDSEQ
                                FROM DAT_SL_DOC DOC,
                                     DAT_CK_DOC CK,
                                     DAT_CK_COM CK_COM,
                                     DOC_GOODS  DG
                               WHERE CK.FLAG = 'Y'
                                 AND DOC.STR2 = CK.SEQNO
                                 AND CK_COM.GDSEQ = DG.GDSEQ
                                 AND DG.FLAG IN ('Y', 'T')
                                 AND CK_COM.SEQNO = CK.SEQNO
                                 AND DG.ISGZ LIKE (NVL('{0}', '%'))
                                 AND DOC.STR2 IS NOT NULL
                                 AND DOC.DEPTID LIKE NVL('{1}', '%')
                                 AND CK.FLAG = 'Y'
                                 AND DOC.FLAG IN ('Y', 'B')
                                 AND DOC.XSRQ BETWEEN TO_DATE('{2}', 'YYYY-MM-DD') AND
                                     TO_DATE('{3}', 'YYYY-MM-DD')
                                 AND  (DG.GDSEQ LIKE '%{4}%' OR DG.GDNAME LIKE '%{4}%' OR
                                     DG.ZJM LIKE '%{4}%')
                               GROUP BY DOC.DEPTID, CK_COM.GDSEQ) UNION ALL
                            (SELECT NVL(SUM(NOSTOCK.SLSL), 0) PSSL, SLDOC.DEPTID, SLCOM.GDSEQ
                                FROM DAT_SL_DOC       SLDOC,
                                     DAT_NOSTOCK_LIST NOSTOCK,
                                     DAT_CK_COM       SLCOM,
                                     DOC_GOODS        DG
                               WHERE NOSTOCK.BILLNO_SL = SLDOC.BILLNO
                                 AND SLCOM.GDSEQ = DG.GDSEQ
                                 AND DG.FLAG IN ('Y', 'T')
                                 AND SLCOM.SEQNO = NOSTOCK.BILLNO_CK
                                 AND DG.ISGZ LIKE (NVL('{0}', '%'))
                                 AND NOSTOCK.BILLNO_CK IS NOT NULL
                                 AND SLDOC.DEPTID LIKE NVL('{1}', '%')
                                 AND SLDOC.XSRQ BETWEEN TO_DATE('{2}', 'YYYY-MM-DD') AND
                                     TO_DATE('{3}', 'YYYY-MM-DD')
                                 AND (DG.GDSEQ LIKE '%{4}%' OR DG.GDNAME LIKE '%{4}%' OR
                                     DG.ZJM LIKE '%{4}%')
                               GROUP BY SLDOC.DEPTID, SLCOM.GDSEQ))) NN
                     WHERE MM.DEPTID = NN.DEPTID(+)
                       AND MM.GDSEQ = NN.GDSEQ(+) ";
                int       total         = 0;
                string    sortField     = GridList.SortField;
                string    sortDirection = GridList.SortDirection;
                string    tempsql       = string.Format(strSql, lstISGZ.SelectedValue, ddlDEPTID.SelectedValue, lisDATE1.Text, lisDATE2.Text, lisGDSEQ.Text.Trim()) + String.Format(" ORDER BY {0} {1}", sortField, sortDirection);
                DataTable dtData        = DbHelperOra.QueryForTable(tempsql);
                if (dtData.Rows.Count < 1)
                {
                    Alert.Show("无需要导出的数据信息!", MessageBoxIcon.Warning);
                    return;
                }
                ExcelHelper.ExportByWeb(dtData, "科室申领分析", "科室申领分析" + DateTime.Now.ToShortDateString() + ".xls");
            }
        }
예제 #46
0
파일: Main.g.cs 프로젝트: to11mtm/OddJob
 public Instance(WebSharper.UI.Templating.Runtime.Server.CompletedHoles v, Doc d) : base(v, d)
 {
 }
 public static Doc Print(MemberBindingExpressionSyntax node)
 {
     return(Doc.Concat(Token.Print(node.OperatorToken), Node.Print(node.Name)));
 }
예제 #48
0
        private static int crudDelete(MySQLDataStoreBase store, MySqlConnection cnn, MySqlTransaction trans, Doc doc, IDataStoreKey key)
        {
            var    target    = store.TargetName;
            string tableName = getTableName(doc.Schema, target);

            using (var cmd = cnn.CreateCommand())
            {
                var pk = key ?? doc.GetDataStoreKey(target);

                if (pk == null)
                {
                    throw new MySqlDataAccessException(StringConsts.KEY_UNAVAILABLE_ERROR);
                }

                var where = GeneratorUtils.KeyToWhere(pk, cmd.Parameters);

                cmd.Transaction = trans;
                if (!string.IsNullOrEmpty(where))
                {
                    cmd.CommandText = string.Format("DELETE T1 FROM `{0}` T1 WHERE {1}", tableName, where);
                }
                else
                {
                    cmd.CommandText = string.Format("DELETE T1 FROM `{0}` T1", tableName);
                }

                ConvertParameters(store, cmd.Parameters);

                try
                {
                    var affected = cmd.ExecuteNonQuery();
                    GeneratorUtils.LogCommand(store, "delete-ok", cmd, null);
                    return(affected);
                }
                catch (Exception error)
                {
                    GeneratorUtils.LogCommand(store, "delete-error", cmd, error);
                    throw;
                }
            }//using command
        }
 public static String GetHtmlFriendlySource(this SourceFragment sourceFragment) => Doc.GetHtmlFriendlySource(sourceFragment.Source);
예제 #50
0
        private static int crudUpsert(MySQLDataStoreBase store, MySqlConnection cnn, MySqlTransaction trans, Doc doc, FieldFilterFunc filter)
        {
            var target  = store.TargetName;
            var cnames  = new StringBuilder();
            var values  = new StringBuilder();
            var upserts = new StringBuilder();
            var vparams = new List <MySqlParameter>();
            var vpidx   = 0;

            foreach (var fld in doc.Schema.FieldDefs)
            {
                var fattr = fld[target];
                if (fattr == null)
                {
                    continue;
                }

                if (fattr.StoreFlag != StoreFlag.LoadAndStore && fattr.StoreFlag != StoreFlag.OnlyStore)
                {
                    continue;
                }


                if (filter != null)//20160210 Dkh+SPol
                {
                    if (!filter(doc, null, fld))
                    {
                        continue;
                    }
                }

                var fname = fld.GetBackendNameForTarget(target);

                var fvalue = getFieldValue(doc, fld.Order, store);


                cnames.AppendFormat(" `{0}`,", fname);

                if (fvalue != null)
                {
                    var pname = string.Format("?VAL{0}", vpidx);

                    values.AppendFormat(" {0},", pname);

                    if (!fattr.Key)
                    {
                        upserts.AppendFormat(" `{0}` = {1},", fname, pname);
                    }

                    var par = new MySqlParameter();
                    par.ParameterName = pname;
                    par.Value         = fvalue;
                    vparams.Add(par);

                    vpidx++;
                }
                else
                {
                    values.Append(" NULL,");
                    upserts.AppendFormat(" `{0}` = NULL,", fname);
                }
            }//foreach

            if (cnames.Length > 0 && upserts.Length > 0)
            {
                cnames.Remove(cnames.Length - 1, 1);   // remove ","
                upserts.Remove(upserts.Length - 1, 1); // remove ","
                values.Remove(values.Length - 1, 1);   // remove ","
            }
            else
            {
                return(0);//nothing to do
            }
            string tableName = getTableName(doc.Schema, target);

            using (var cmd = cnn.CreateCommand())
            {
                var sql =
                    @"INSERT INTO `{0}` ({1}) VALUES ({2}) ON DUPLICATE KEY UPDATE {3}".Args(tableName, cnames, values, upserts);

                cmd.Transaction = trans;
                cmd.CommandText = sql;
                cmd.Parameters.AddRange(vparams.ToArray());
                ConvertParameters(store, cmd.Parameters);

                try
                {
                    var affected = cmd.ExecuteNonQuery();
                    GeneratorUtils.LogCommand(store, "upsert-ok", cmd, null);
                    return(affected);
                }
                catch (Exception error)
                {
                    GeneratorUtils.LogCommand(store, "upsert-error", cmd, error);
                    throw;
                }
            }//using command
        }
예제 #51
0
        private static int crudUpdate(MySQLDataStoreBase store, MySqlConnection cnn, MySqlTransaction trans, Doc doc, IDataStoreKey key, FieldFilterFunc filter)
        {
            var target  = store.TargetName;
            var values  = new StringBuilder();
            var vparams = new List <MySqlParameter>();
            var vpidx   = 0;

            foreach (var fld in doc.Schema.FieldDefs)
            {
                var fattr = fld[target];
                if (fattr == null)
                {
                    continue;
                }

                var fname = fld.GetBackendNameForTarget(target);

                //20141008 DKh Skip update of key fields
                //20160124 DKh add update of keys if IDataStoreKey is present
                if (fattr.Key && !GeneratorUtils.HasFieldInNamedKey(fname, key))
                {
                    continue;
                }

                if (fattr.StoreFlag != StoreFlag.LoadAndStore && fattr.StoreFlag != StoreFlag.OnlyStore)
                {
                    continue;
                }

                if (filter != null)//20160210 Dkh+SPol
                {
                    if (!filter(doc, key, fld))
                    {
                        continue;
                    }
                }


                var fvalue = getFieldValue(doc, fld.Order, store);


                if (fvalue != null)
                {
                    var pname = string.Format("?VAL{0}", vpidx);

                    values.AppendFormat(" `{0}` = {1},", fname, pname);

                    var par = new MySqlParameter();
                    par.ParameterName = pname;
                    par.Value         = fvalue;
                    vparams.Add(par);

                    vpidx++;
                }
                else
                {
                    values.AppendFormat(" `{0}` = NULL,", fname);
                }
            }//foreach

            if (values.Length > 0)
            {
                values.Remove(values.Length - 1, 1);// remove ","
            }
            else
            {
                return(0);//nothing to do
            }
            string tableName = getTableName(doc.Schema, target);

            using (var cmd = cnn.CreateCommand())
            {
                var sql = string.Empty;

                var pk = key ?? doc.GetDataStoreKey(target);

                if (pk == null)
                {
                    throw new MySqlDataAccessException(StringConsts.KEY_UNAVAILABLE_ERROR);
                }

                var where = GeneratorUtils.KeyToWhere(pk, cmd.Parameters);

                if (!string.IsNullOrEmpty(where))
                {
                    sql = "UPDATE `{0}` T1  SET {1} WHERE {2}".Args(tableName, values, where);
                }
                else
                {
                    throw new MySqlDataAccessException(StringConsts.BROAD_UPDATE_ERROR);//20141008 DKh BROAD update
                }
                cmd.Transaction = trans;
                cmd.CommandText = sql;
                cmd.Parameters.AddRange(vparams.ToArray());
                ConvertParameters(store, cmd.Parameters);

                try
                {
                    var affected = cmd.ExecuteNonQuery();
                    GeneratorUtils.LogCommand(store, "update-ok", cmd, null);
                    return(affected);
                }
                catch (Exception error)
                {
                    GeneratorUtils.LogCommand(store, "update-error", cmd, error);
                    throw;
                }
            }//using command
        }
예제 #52
0
        public ActionResult DocInLinks(int toDocLangId, int?toParId, int?docLangId, string linkIdsString, string subTitle, string toDocNumber, string toParOriginal)
        {
            SearchBox sb = new SearchBox(Language.Id);

            sb.DocInLinks               = new DocLinksFilter();
            sb.DocInLinks.ToDocLangId   = toDocLangId;
            sb.DocInLinks.ToParId       = toParId;
            sb.DocInLinks.LinkIdsString = linkIdsString;
            sb.DocInLinks.SubTitle      = subTitle;
            if (!String.IsNullOrEmpty(sb.DocInLinks.LinkIdsString))
            {
                // populating pars from DB
                sb.DocInLinks.PopulateLinksToPars();
            }

            if (!sb.ShowFreeDocuments.HasValue)
            {
                sb.ShowFreeDocuments = this.UserData.ShowFreeDocuments;
            }

            // still no pars?
            if (sb.DocInLinks.ToPars == null || sb.DocInLinks.ToPars.Count == 0)
            {
                if (String.IsNullOrEmpty(subTitle))
                {
                    if (sb.DocInLinks.ToParId.HasValue)
                    {
                        // getting title if not present (common in the GET variant of the method)
                        subTitle = DocLinksFilter.GetParNumByParId(sb.DocInLinks.ToParId.Value);
                    }
                }

                if (!String.IsNullOrEmpty(subTitle))
                {
                    // populating fictive artN toPar
                    var curToParsCollection = new List <string>();
                    var curToPar            = String.Empty;
                    if (subTitle.Contains(".") && subTitle.Contains(" "))
                    {
                        curToPar = subTitle.Split(' ')[1];
                    }
                    else
                    {
                        curToPar = "art" + subTitle[subTitle.Length - 1];
                    }

                    curToParsCollection.Add(curToPar);

                    sb.DocInLinks.ToPars = curToParsCollection;
                }
            }

            // populating docNumber if not present
            if (String.IsNullOrEmpty(toDocNumber))
            {
                toDocNumber = Doc.GetDocumentNumberByDocLangId(toDocLangId);
            }

            string[] title = Doc.GetDocLinksTitle(toDocLangId, toParId);
            if (!String.IsNullOrEmpty(subTitle))
            {
                title[1] = subTitle;
            }

            sb.DocInLinks.Title = String.Format("{0}{1}", title[0], (String.IsNullOrEmpty(title[1]) ? "" : "/" + title[1])) + " - " + Resources.UI_IncomingLinks;

            sb.DocInLinks.ToDocNumber = toDocNumber;
            // sb.DocInLinks.ToParOriginal = toParOriginal;

            return(Search(sb));
        }
예제 #53
0
 protected void trbSearch_TriggerClick(object sender, EventArgs e)
 {
     hfdSearch.Text = Doc.filterSql(trbSearch.Text);
     DataSearch();
 }
예제 #54
0
        /// <summary>
        /// Get Commitments
        /// </summary>
        /// <param name="doc">document</param>
        /// <param name="maxQty">Qty invoiced/matched</param>
        /// <param name="C_InvoiceLine_ID">invoice line</param>
        /// <returns>commitments (order lines)</returns>
        protected static DocLine[] GetCommitments(Doc doc, Decimal maxQty, int C_InvoiceLine_ID)
        {
            int precision = -1;
            //
            List <DocLine> list = new List <DocLine>();
            String         sql  = "SELECT * FROM C_OrderLine ol "
                                  + "WHERE EXISTS "
                                  + "(SELECT * FROM C_InvoiceLine il "
                                  + "WHERE il.C_OrderLine_ID=ol.C_OrderLine_ID"
                                  + " AND il.C_InvoiceLine_ID=" + C_InvoiceLine_ID + ")"
                                  + " OR EXISTS "
                                  + "(SELECT * FROM M_MatchPO po "
                                  + "WHERE po.C_OrderLine_ID=ol.C_OrderLine_ID"
                                  + " AND po.C_InvoiceLine_ID=" + C_InvoiceLine_ID + ")";
            IDataReader idr = null;

            try
            {
                idr = DataBase.DB.ExecuteReader(sql, null, null);
                while (idr.Read())
                {
                    if (Env.Signum(maxQty) == 0)
                    {
                        continue;
                    }
                    MOrderLine line    = new MOrderLine(doc.GetCtx(), idr, null);
                    DocLine    docLine = new DocLine(line, doc);
                    //	Currency
                    if (precision == -1)
                    {
                        doc.SetC_Currency_ID(docLine.GetC_Currency_ID());
                        precision = MCurrency.GetStdPrecision(doc.GetCtx(), docLine.GetC_Currency_ID());
                    }
                    //	Qty
                    Decimal Qty = Math.Max(line.GetQtyOrdered(), maxQty);
                    docLine.SetQty(Qty, false);
                    //
                    Decimal PriceActual = line.GetPriceActual();
                    Decimal PriceCost   = line.GetPriceCost();
                    Decimal?LineNetAmt  = null;
                    if (Env.Signum(PriceCost) != 0)
                    {
                        LineNetAmt = Decimal.Multiply(Qty, PriceCost);
                    }
                    else if (Qty.Equals(maxQty))
                    {
                        LineNetAmt = line.GetLineNetAmt();
                    }
                    else
                    {
                        LineNetAmt = Decimal.Multiply(Qty, PriceActual);
                    }
                    maxQty = Decimal.Subtract(maxQty, Qty);

                    docLine.SetAmount(LineNetAmt);      //	DR
                    Decimal PriceList = line.GetPriceList();
                    int     C_Tax_ID  = docLine.GetC_Tax_ID();
                    //	Correct included Tax
                    if (C_Tax_ID != 0 && line.GetParent().IsTaxIncluded())
                    {
                        MTax tax = MTax.Get(doc.GetCtx(), C_Tax_ID);
                        if (!tax.IsZeroTax())
                        {
                            Decimal LineNetAmtTax = tax.CalculateTax(LineNetAmt.Value, true, precision);
                            _log.Fine("LineNetAmt=" + LineNetAmt + " - Tax=" + LineNetAmtTax);
                            LineNetAmt = Decimal.Subtract(LineNetAmt.Value, LineNetAmtTax);
                            Decimal PriceListTax = tax.CalculateTax(PriceList, true, precision);
                            PriceList = Decimal.Subtract(PriceList, PriceListTax);
                        }
                    }   //	correct included Tax

                    docLine.SetAmount(LineNetAmt, PriceList, Qty);
                    list.Add(docLine);
                }
                idr.Close();
            }
            catch (Exception e)
            {
                if (idr != null)
                {
                    idr.Close();
                    idr = null;
                }
                _log.Log(Level.SEVERE, sql, e);
            }


            //	Return Array
            DocLine[] dl = new DocLine[list.Count];
            dl = list.ToArray();
            return(dl);
        }
예제 #55
0
        public List <ApplicationPlaceholderObject> BeamToNative(Beam speckleBeam, StructuralType structuralType = StructuralType.Beam)
        {
            if (speckleBeam.baseLine == null)
            {
                throw new Speckle.Core.Logging.SpeckleException("Only line based Beams are currently supported.");
            }

            DB.FamilySymbol familySymbol = GetElementType <FamilySymbol>(speckleBeam);
            var             baseLine     = CurveToNative(speckleBeam.baseLine).get_Item(0);

            DB.Level          level     = null;
            DB.FamilyInstance revitBeam = null;

            //comes from revit or schema builder, has these props
            var speckleRevitBeam = speckleBeam as RevitBeam;

            if (speckleRevitBeam != null)
            {
                level = GetLevelByName(speckleRevitBeam.level.name);
            }

            if (level == null)
            {
                level = LevelToNative(LevelFromCurve(baseLine));
            }

            //try update existing
            var docObj = GetExistingElementByApplicationId(speckleBeam.applicationId);

            if (docObj != null)
            {
                try
                {
                    var revitType = Doc.GetElement(docObj.GetTypeId()) as ElementType;

                    // if family changed, tough luck. delete and let us create a new one.
                    if (familySymbol.FamilyName != revitType.FamilyName)
                    {
                        Doc.Delete(docObj.Id);
                    }
                    else
                    {
                        revitBeam = (DB.FamilyInstance)docObj;
                        (revitBeam.Location as LocationCurve).Curve = baseLine;

                        // check for a type change
                        if (!string.IsNullOrEmpty(familySymbol.FamilyName) && familySymbol.FamilyName != revitType.Name)
                        {
                            revitBeam.ChangeTypeId(familySymbol.Id);
                        }
                    }
                }
                catch
                {
                    //something went wrong, re-create it
                }
            }

            //create family instance
            if (revitBeam == null)
            {
                revitBeam = Doc.Create.NewFamilyInstance(baseLine, familySymbol, level, structuralType);
                StructuralFramingUtils.DisallowJoinAtEnd(revitBeam, 0);
                StructuralFramingUtils.DisallowJoinAtEnd(revitBeam, 1);
            }

            //reference level, only for beams
            TrySetParam(revitBeam, BuiltInParameter.INSTANCE_REFERENCE_LEVEL_PARAM, level);

            if (speckleRevitBeam != null)
            {
                SetInstanceParameters(revitBeam, speckleRevitBeam);
            }

            // TODO: get sub families, it's a family!
            var placeholders = new List <ApplicationPlaceholderObject>()
            {
                new ApplicationPlaceholderObject {
                    applicationId = speckleBeam.applicationId, ApplicationGeneratedId = revitBeam.UniqueId, NativeObject = revitBeam
                }
            };

            // TODO: nested elements.

            return(placeholders);
        }
예제 #56
0
 public Instance(CompletedHoles v, Doc d) : base(v, d)
 {
 }
예제 #57
0
        protected void docGZM_TextChanged(object sender, EventArgs e)
        {
            //扫码出库
            //if (docGZM.Text.Length < Doc.LENCODE()) return;
            if (docDEPTID.SelectedValue.Length < 1)
            {
                Alert.Show("【申领科室】未维护", "提示信息", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();

            for (int i = 0; i < newDict.Count; i++)
            {
                if (newDict[i]["STR2"].ToString() == docGZM.Text.Trim())
                {
                    Alert.Show("扫描条码已增加到单据中!", "提示信息", MessageBoxIcon.Warning);
                    docGZM.Text = "";
                    docGZM.Focus();
                    return;
                }
            }
            string dept = Doc.ONECODE_GZ(docGZM.Text.Trim(), "DEPTCUR");

            if (docDEPTOUT.SelectedValue.Length > 0)
            {
                if (docDEPTOUT.SelectedValue != dept)
                {
                    Alert.Show("条码【" + docGZM.Text.Trim() + "】不属于库房【" + docDEPTOUT.SelectedText + "】", "提示信息", MessageBoxIcon.Warning);
                    docGZM.Text = "";
                    docGZM.Focus();
                    return;
                }
            }
            else
            {
                docDEPTOUT.SelectedValue = dept;
                if (docDEPTOUT.Text.Length < 1)
                {
                    Alert.Show("扫描条码的库房不存在或条码已被使用!");
                    docDEPTOUT.SelectedValue = "";
                    docGZM.Text = "";
                    docGZM.Focus();
                    return;
                }
            }
            docDEPTOUT.Enabled = false;
            string gdseq = Doc.ONECODE_GZ(docGZM.Text.Trim(), "GDSEQ");
            //增加商品
            //信息赋值
            DataTable dt = DbHelperOra.Query("SELECT A.* FROM DAT_GZ_EXT A WHERE (A.ONECODE = '" + docGZM.Text.Trim() + "' OR A.STR1 = '" + docGZM.Text.Trim() + "') AND FLAG IN('Y','R')").Tables[0];

            if (dt.Rows.Count < 1)
            {
                Alert.Show("扫描条码未入库或已被使用!", "提示信息", MessageBoxIcon.Warning);
                docGZM.Text = "";
                docGZM.Focus();
                return;
            }
            DataTable dt_goods = Doc.GetGoods_His(gdseq, "", docDEPTID.SelectedValue);

            if (dt_goods != null && dt_goods.Rows.Count > 0)
            {
                dt_goods.Columns.Add("BZSL", Type.GetType("System.Int32"));
                dt_goods.Columns.Add("HSJE", Type.GetType("System.Double"));
                dt_goods.Columns.Add("STR2", Type.GetType("System.String"));
                DataRow dr_goods = dt_goods.Rows[0];
                dr_goods["BZSL"]  = "1";
                dr_goods["BZHL"]  = "1";
                dr_goods["STR2"]  = docGZM.Text.Trim();
                dr_goods["HSJE"]  = dr_goods["HSJJ"];
                dr_goods["PH"]    = dt.Rows[0]["PH"];
                dr_goods["YXQZ"]  = dt.Rows[0]["YXQZ"];
                dr_goods["RQ_SC"] = dt.Rows[0]["RQ_SC"];
                LoadGridRow(dr_goods, false);
                docDEPTID.Enabled = false;
            }
            else
            {
                Alert.Show(string.Format("{0}尚未配置商品【{1}】!!!", docDEPTID.SelectedText, gdseq), MessageBoxIcon.Warning);
            }
            docGZM.Text = "";
            docGZM.Focus();
        }
예제 #58
0
        public static List <SpeckleObject> ToSpeckle(this LineLoad myLineLoad)
        {
            var myLoad = new Structural1DLoadLine();

            myLoad.Name = myLineLoad.Name;

            var points = myLineLoad.GetCurve().Tessellate();

            myLoad.Value = new List <double>();

            foreach (var p in points)
            {
                myLoad.Value.Add(p.X / Scale);
                myLoad.Value.Add(p.Y / Scale);
                myLoad.Value.Add(p.Z / Scale);
            }

            var forces = new StructuralVectorSix(new double[6]);

            forces.Value[0] = (myLineLoad.ForceVector1.X + myLineLoad.ForceVector2.X) / 2;
            forces.Value[1] = (myLineLoad.ForceVector1.Y + myLineLoad.ForceVector2.Y) / 2;
            forces.Value[2] = (myLineLoad.ForceVector1.Z + myLineLoad.ForceVector2.Z) / 2;
            forces.Value[3] = (myLineLoad.MomentVector1.X + myLineLoad.MomentVector2.X) / 2;
            forces.Value[4] = (myLineLoad.MomentVector1.Y + myLineLoad.MomentVector2.Y) / 2;
            forces.Value[5] = (myLineLoad.MomentVector1.Z + myLineLoad.MomentVector2.Z) / 2;

            if (myLineLoad.OrientTo == LoadOrientTo.HostLocalCoordinateSystem)
            {
                var hostTransform = myLineLoad.HostElement.GetLocalCoordinateSystem();

                var b0 = hostTransform.get_Basis(0);
                var b1 = hostTransform.get_Basis(1);
                var b2 = hostTransform.get_Basis(2);

                var fx = forces.Value[0] * b0.X + forces.Value[1] * b1.X + forces.Value[2] * b2.X;
                var fy = forces.Value[0] * b0.Y + forces.Value[1] * b1.Y + forces.Value[2] * b2.Y;
                var fz = forces.Value[0] * b0.Z + forces.Value[1] * b1.Z + forces.Value[2] * b2.Z;
                var mx = forces.Value[3] * b0.X + forces.Value[4] * b1.X + forces.Value[5] * b2.X;
                var my = forces.Value[3] * b0.Y + forces.Value[4] * b1.Y + forces.Value[5] * b2.Y;
                var mz = forces.Value[3] * b0.Z + forces.Value[4] * b1.Z + forces.Value[5] * b2.Z;

                forces = new StructuralVectorSix(new double[] { fx, fy, fz, mx, my, mz });
            }
            else if (myLineLoad.OrientTo == LoadOrientTo.WorkPlane)
            {
                var workPlane = ((SketchPlane)Doc.GetElement(myLineLoad.WorkPlaneId)).GetPlane();

                var b0 = workPlane.XVec;
                var b1 = workPlane.YVec;
                var b2 = workPlane.Normal;

                var fx = forces.Value[0] * b0.X + forces.Value[1] * b1.X + forces.Value[2] * b2.X;
                var fy = forces.Value[0] * b0.Y + forces.Value[1] * b1.Y + forces.Value[2] * b2.Y;
                var fz = forces.Value[0] * b0.Z + forces.Value[1] * b1.Z + forces.Value[2] * b2.Z;
                var mx = forces.Value[3] * b0.X + forces.Value[4] * b1.X + forces.Value[5] * b2.X;
                var my = forces.Value[3] * b0.Y + forces.Value[4] * b1.Y + forces.Value[5] * b2.Y;
                var mz = forces.Value[3] * b0.Z + forces.Value[4] * b1.Z + forces.Value[5] * b2.Z;

                forces = new StructuralVectorSix(new double[] { fx, fy, fz, mx, my, mz });
            }

            myLoad.Loading = forces;

            var myLoadCase = new StructuralLoadCase();

            myLoadCase.Name          = myLineLoad.LoadCaseName;
            myLoadCase.ApplicationId = myLineLoad.LoadCase.UniqueId;
            switch (myLineLoad.LoadCategoryName)
            {
            case "Dead Loads":
                myLoadCase.CaseType = StructuralLoadCaseType.Dead;
                break;

            case "Live Loads":
                myLoadCase.CaseType = StructuralLoadCaseType.Live;
                break;

            case "Seismic Loads":
                myLoadCase.CaseType = StructuralLoadCaseType.Earthquake;
                break;

            case "Snow Loads":
                myLoadCase.CaseType = StructuralLoadCaseType.Snow;
                break;

            case "Wind Loads":
                myLoadCase.CaseType = StructuralLoadCaseType.Wind;
                break;

            default:
                myLoadCase.CaseType = StructuralLoadCaseType.Generic;
                break;
            }

            myLoad.LoadCaseRef   = myLoadCase.ApplicationId;
            myLoad.ApplicationId = myLineLoad.UniqueId;

            return(new List <SpeckleObject>()
            {
                myLoad, myLoadCase
            });
        }
예제 #59
0
파일: Main.g.cs 프로젝트: to11mtm/OddJob
 public Main MenuBar(Doc x)
 {
     holes.Add(TemplateHole.NewElt("menubar", x)); return(this);
 }
예제 #60
0
        private void CreateSeasonFolders(ShowItem si, int snum, [NotNull] List <string> folders)
        {
            foreach (string folderExists in folders)
            {
                string folder = folderExists;

                // generate new filename info
                // ReSharper disable once RedundantAssignment
                bool          goAgain      = false;
                DirectoryInfo di           = null;
                bool          firstAttempt = true;
                do
                {
                    goAgain = false;
                    if (!string.IsNullOrEmpty(folder))
                    {
                        try
                        {
                            di = new DirectoryInfo(folder);
                        }
                        catch
                        {
                            break;
                        }
                    }

                    if (di != null && di.Exists)
                    {
                        continue;
                    }

                    string sn          = si.ShowName;
                    string text        = snum + " of " + si.MaxSeason();
                    string theFolder   = folder;
                    string otherFolder = null;

                    FaResult whatToDo = GetDefaultAction();

                    if (TVSettings.Instance.AutoCreateFolders && firstAttempt)
                    {
                        whatToDo     = FaResult.kfaCreate;
                        firstAttempt = false;
                    }

                    if (whatToDo == FaResult.kfaNotSet)
                    {
                        // no command line guidance, so ask the user
                        MissingFolderAction mfa = new MissingFolderAction(sn, text, theFolder);
                        mfa.ShowDialog();
                        whatToDo    = mfa.Result;
                        otherFolder = mfa.FolderName;
                    }

                    switch (whatToDo)
                    {
                    case FaResult.kfaRetry:
                        goAgain = true;
                        break;

                    case FaResult.kfaDifferentFolder:
                        folder  = otherFolder;
                        goAgain = UpdateDirectory(si, snum, folder);
                        break;

                    case FaResult.kfaNotSet:
                        break;

                    case FaResult.kfaCancel:
                        throw new TVRenameOperationInterruptedException();
                        break;

                    case FaResult.kfaCreate:
                        TryCreateDirectory(folder, sn, text);
                        goAgain = true;
                        break;

                    case FaResult.kfaIgnoreOnce:
                        break;

                    case FaResult.kfaIgnoreAlways:
                        si.IgnoreSeasons.Add(snum);
                        Doc.SetDirty();
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                } while (goAgain);
            } // for each folder
        }