Пример #1
0
        public void CreateSampleDocument2(int Id)
        {
            using (Entities1 db = new Entities1())
            {
                Vw_Complaints cm       = db.Vw_Complaints.Where(x => x.ID == Id).FirstOrDefault();
                Apartment     ap       = db.Apartments.Where(x => x.Name == cm.flat).FirstOrDefault();
                Tower         tw       = db.Towers.Where(x => x.Name == cm.Name).FirstOrDefault();
                string        body     = string.Format("وردنا شكوي تسرب مياه صادر علي شقة رقم ({0}) وبخروج فني الصيانة عن مكان التسرب تبين الاتي:", cm.OtherApartment);
                string        subject  = string.Format("المحترم / ساكن الشقة رقم ({0}) برج رقم                 ({1}) المحترم", ap.ID, tw.ID);
                string        footer   = string.Format("صورة مع التحية شقة رقم ({0})", cm.OtherApartment);
                DocX          document = DocX.Load(@"C:\test\Template.docx");
                Paragraph     p0       = document.InsertParagraph();
                p0.Direction = Novacode.Direction.RightToLeft;
                p0.Append(string.Format("التاريخ {0}", string.Format("{0:d/M/yyyy}", DateTime.Now)));
                p0.Bold();
                Paragraph p1 = document.InsertParagraph();
                p1.Direction = Novacode.Direction.RightToLeft;
                p1.Append(subject);
                p1.Bold();
                Paragraph p2 = document.InsertParagraph();
                p2.Direction = Novacode.Direction.RightToLeft;
                p2.Append("السلام عليكم ورحمة الله وبركاتة");
                p2.Bold();
                Paragraph p3 = document.InsertParagraph();
                p3.Direction = Novacode.Direction.RightToLeft;
                p3.Append(body);
                Paragraph p7 = document.InsertParagraph();
                p7.Direction = Novacode.Direction.RightToLeft;
                p7.Append("............................................................................................................................");
                p7.Append("............................................................................................................................");
                p7.Append("............................................................................................................................");
                p7.Append("............................................................................................................................");
                p7.Append("............................................................................................................................");
                p7.Append("............................................................................................................................");

                Paragraph p4 = document.InsertParagraph();
                p4.Direction = Novacode.Direction.RightToLeft;
                p4.Append("شاكرين حسن تعاونكم");
                p4.Alignment = Alignment.center;
                p4.Bold();
                p4.SpacingAfter(20);
                Paragraph p5 = document.InsertParagraph();
                p5.Append("ادارة مجمع اسكان المعذر");
                p5.Alignment = Alignment.left;
                p5.Direction = Novacode.Direction.RightToLeft;
                p5.Bold();
                Paragraph p6 = document.InsertParagraph();
                p6.Direction = Novacode.Direction.RightToLeft;
                p6.Append(footer);
                document.SaveAs(Server.MapPath("/Docs/WordAlignment.docx"));
                Context.Response.Clear();
                FileInfo file = new FileInfo(Server.MapPath("/Docs/WordAlignment.docx"));
                Context.Response.ContentType = "Application/msword";
                Context.Response.AppendHeader("Content-Disposition", "inline; filename=" + file.Name);
                Context.Response.AppendHeader("Content-Length", file.Length.ToString());
                Context.Response.WriteFile(file.FullName);
                Context.Response.End();
                //System.Diagnostics.Process.Start("WordAlignment.docx");
            }
        }
Пример #2
0
 private void FillComplaintData(int Id)
 {
     using (Entities1 db = new Entities1())
     {
         Vw_Complaints cm = db.Vw_Complaints.Where(x => x.ID == Id).FirstOrDefault();
         FillApartments(cm.flat, cm.Name);
         FillCommonItems(cm.type);
         FillCommonTypes(cm.cat);
         txtSearch.Text          = cm.Id_Numer;
         txtphone.Text           = cm.Phone;
         txtcustomername.Text    = cm.FullName;
         drpownertype.Text       = cm.type;
         drptechniction.Text     = cm.TechName;
         btnclear.NavigateUrl    = "initialLetter.aspx?Id=" + cm.ID;
         btnprint.NavigateUrl    = "PrintWO.aspx?Id=" + cm.ID;
         drpapartmentnumber.Text = cm.flat;
         drptower.Text           = cm.Name;
         drplvl1.Text            = cm.cat;
         drplvl2.Text            = cm.type;
         drplvl3.Text            = cm.Item;
         txtID.Text           = "926/" + cm.ID.ToString("0000000");
         txtCreationDate.Text = cm.CreateDateTime.ToString();
         drpotheap.Text       = cm.OtherApartment;
         if (!string.IsNullOrEmpty(cm.Other))
         {
             txtother.ClientVisible = true; lblothertxt.ClientVisible = true;
         }
         else
         {
             txtother.ClientVisible = false; lblothertxt.ClientVisible = false;;
         }
         if (cm.Status == 2)
         {
             btnsumnit.Visible = false;
             btnedit.Visible   = false;
             btnclose.Visible  = false;
         }
         else if (cm.Status == 3)
         {
             btnsumnit.Visible = false;
             btnedit.Visible   = false;
             btnclose.Visible  = false;
         }
         txtfixdatetime.Text        = cm.AppointmentDateTime.ToString();
         memonotes.Text             = cm.Note;
         txtsubject.Text            = cm.Subject;
         drpownertype.SelectedValue = cm.Customer_Type.ToString();
         if (!string.IsNullOrEmpty(cm.Other))
         {
             txtother.ClientVisible    = true;
             lblothertxt.ClientVisible = true;
             txtother.Text             = cm.Other;
         }
         else
         {
             txtother.ClientVisible    = false;
             lblothertxt.ClientVisible = false;
         }
     }
 }
Пример #3
0
        public void CreateSampleDocument(int Id)
        {
            using (Entities1 db = new Entities1())
            {
                Vw_Complaints cm       = db.Vw_Complaints.Where(x => x.ID == Id).FirstOrDefault();
                Apartment     ap       = db.Apartments.Where(x => x.Name == cm.flat).FirstOrDefault();
                Tower         tw       = db.Towers.Where(x => x.Name == cm.Name).FirstOrDefault();
                string        body     = string.Format("نشعركم بوجود تسرب مياة صادر من شقتكم علي جاركم شقة رقم ({0}) نامل اصلاح التسرب في اسرع وقت ممكن او الاتصال علي قسم الصيانة تلفون رقم (4620591) ليتمكن فني الصيانة من الكشف عن مصدر التسرب واصلاحة ووقف الضرر علي جاركم والحفاظ علي سلامة المبني. ", cm.OtherApartment);
                string        subject  = string.Format("المحترم / ساكن الشقة رقم ({0}) برج رقم                 ({1}) المحترم", ap.ID, tw.ID);
                string        footer   = string.Format("صورة مع التحية شقة رقم ({0})", cm.OtherApartment);
                DocX          document = DocX.Load(Server.MapPath("/Template.docx"));
                Paragraph     p0       = document.InsertParagraph();
                p0.Direction = Novacode.Direction.RightToLeft;
                p0.Append(string.Format("التاريخ {0}", string.Format("{0:d/M/yyyy}", DateTime.Now)));
                p0.Bold();
                Paragraph p1 = document.InsertParagraph();
                p1.Direction = Novacode.Direction.RightToLeft;
                p1.Append(subject);
                p1.Bold();
                Paragraph p2 = document.InsertParagraph();
                p2.Direction = Novacode.Direction.RightToLeft;
                p2.Append("السلام عليكم ورحمة الله وبركاتة");
                p2.Bold();
                Paragraph p3 = document.InsertParagraph();
                p3.Direction = Novacode.Direction.RightToLeft;
                p3.Append(body);

                Paragraph p4 = document.InsertParagraph();
                p4.Direction = Novacode.Direction.RightToLeft;
                p4.Append("شاكرين حسن تعاونكم");
                p4.Alignment = Alignment.center;
                p4.Bold();
                p4.SpacingAfter(20);
                Paragraph p5 = document.InsertParagraph();
                p5.Append("ادارة مجمع اسكان المعذر");
                p5.Alignment = Alignment.left;
                p5.Direction = Novacode.Direction.RightToLeft;
                p5.Bold();
                Paragraph p6 = document.InsertParagraph();
                p6.Direction = Novacode.Direction.RightToLeft;
                p6.Append(footer);
                document.SaveAs(Server.MapPath("/Docs/" + cm.flat.Trim() + "." + Convert.ToDateTime(cm.CreateDateTime).ToString("yyyyyMMdd") + ".docx"));
                Context.Response.Clear();
                FileInfo file = new FileInfo(Server.MapPath("/Docs/" + cm.flat.Trim() + "." + Convert.ToDateTime(cm.CreateDateTime).ToString("yyyyyMMdd") + ".docx"));
                Context.Response.ContentType = "Application/msword";
                Context.Response.AppendHeader("Content-Disposition", "inline; filename=" + file.Name);
                Context.Response.AppendHeader("Content-Length", file.Length.ToString());
                Context.Response.WriteFile(file.FullName);
                Context.Response.End();
            }
        }
        private void FillComplaintData(int Id)
        {
            using (Entities1 db = new Entities1())
            {
                Vw_Complaints cm = db.Vw_Complaints.Where(x => x.ID == Id).FirstOrDefault();



                //lvl2.Text = cm.type;
                ApID.Text    = cm.OtherApartment;
                otherap.Text = cm.flat;
                other2.Text  = cm.flat;
                //TowerId.Text = cm.Name;
                //lvl1.Text = cm.cat;
                //lvl3.Text = cm.Item;
                //visittime.Text = cm.AppointmentDateTime.ToString();
                //memo.Text = cm.Note;
                //subject.Text = cm.Subject;
            }
            //drpownertype.SelectedIndex = Convert.ToInt16(cm.OwnershipType);
        }
Пример #5
0
        private void FillComplaintData(int Id)
        {
            using (Entities1 db = new Entities1())
            {
                Vw_Complaints cm = db.Vw_Complaints.Where(x => x.ID == Id).FirstOrDefault();


                Idnumer.Text      = cm.Id_Numer;
                phone.Text        = cm.Phone;
                name.Text         = cm.FullName;
                lvl2.Text         = cm.type;
                ApID.Text         = cm.flat;
                TowerId.Text      = cm.Name;
                lvl1.Text         = cm.cat;
                lvl3.Text         = cm.Item;
                visittime.Text    = cm.AppointmentDateTime.ToString();
                memo.Text         = cm.Note;
                subject.Text      = cm.Subject;
                customertype.Text = cm.Customer_Type.ToString();
            }
            //drpownertype.SelectedIndex = Convert.ToInt16(cm.OwnershipType);
        }