Пример #1
0
        protected void Button2_Click(object sender, System.EventArgs e)
        {
            DateTime dated;

            dated = DateTime.Now;

            try
            {
                test = new CCWordApp();
                test.Open(ConfigurationSettings.AppSettings["WordMod"] + "table.dot");

                test.GoToTheTable(1);

                test.GoToDownCell();
                test.InsertText(Riga1Text1.Text);
                test.GoToRightCell();
                test.InsertText(Riga1Text2.Text);
                test.SaveAs(ConfigurationSettings.AppSettings["WordDoc"] + DocName.Text + ".doc");
                // Save in html format
                test.SaveAsHtml(ConfigurationSettings.AppSettings["WordDoc"] + DocName.Text + ".html");
                test.Quit();
            }

            catch (Exception exc)
            {
                StatusMessage.Text    = exc.Message;
                StatusMessage.Visible = true;
                test.Quit();
            }
        }
        private void Button2_Click(object sender, System.EventArgs e)
        {
            try
            {
                test = new CCWordApp();
                //test.Open (ConfigurationSettings.AppSettings["WordMod"] + "normal.dot");
                test.Open();

                test.SetFontName("Arial");
                test.SetFontSize(14);
                test.SetAlignment("Center");
                test.SetFont("Bold");
                test.InsertText(DocName.Text + ".doc");
                test.SetFont("nothing");


                test.SetAlignment("Left");
                test.InsertLineBreak(5);
                test.SetFontSize(8);
                test.InsertText(Text.Text);


                test.SaveAs(ConfigurationSettings.AppSettings["WordDoc"] + DocName.Text + ".doc");
                // Save in html format
                test.SaveAsHtml(ConfigurationSettings.AppSettings["WordDoc"] + DocName.Text + ".html");
                test.Quit();
            }

            catch (Exception exc)
            {
                StatusMessage.Text    = exc.Message;
                StatusMessage.Visible = true;
                test.Quit();
            }
        }
Пример #3
0
        private void Button2_Click(object sender, System.EventArgs e)
        {
            DateTime dated;

            dated = DateTime.Now;

            try
            {
                test = new CCWordApp();
                test.Open(ConfigurationSettings.AppSettings["WordDoc"] + DocName.Text + ".doc");

                test.GoToTheEnd();
                test.SetAlignment("Right");
                test.SetFont("nothing");
                test.InsertText(dated.ToShortDateString());
                test.InsertLineBreak();
                test.InsertText(Text.Text);

                test.Save();
                // Save in html format
                test.SaveAsHtml(ConfigurationSettings.AppSettings["WordDoc"] + DocName.Text + ".html");
                test.Quit();
            }

            catch (Exception exc)
            {
                StatusMessage.Text    = exc.Message;
                StatusMessage.Visible = true;
                test.Quit();
            }
        }
Пример #4
0
        private void Button2_Click(object sender, System.EventArgs e)
        {
            DateTime dated;

            dated = DateTime.Now;

            try
            {
                test = new CCWordApp();
                test.Open(ConfigurationSettings.AppSettings["WordMod"] + "template1.dot");

                test.SetAlignment("Center");
                test.GotoBookMark("Title");
                test.SetFont("Bold");
                test.InsertText(TextTitle.Text);
                test.SetFont("nothing");

                test.GotoBookMark("name");
                test.SetFont("Italic");
                test.InsertText(TextName.Text);
                test.SetFont("nothing");

                test.GotoBookMark("address");
                test.SetAlignment("Right");
                test.InsertText(dated.ToShortDateString());
                test.InsertLineBreak();
                test.InsertText(TextAddress.Text);
                test.SetFont("nothing");

                test.SaveAs(ConfigurationSettings.AppSettings["WordDoc"] + DocName.Text + ".doc");
                // Save in html format
                test.SaveAsHtml(ConfigurationSettings.AppSettings["WordDoc"] + DocName.Text + ".html");
                test.Quit();
            }

            catch (Exception exc)
            {
                StatusMessage.Text    = exc.Message;
                StatusMessage.Visible = true;
                test.Quit();
            }
        }
Пример #5
0
    protected void btnSaveAuthorizeLetter_Click(object sender, EventArgs e)
    {
        try
        {
            string strPath = string.Empty;
            strPath = Server.MapPath("~/MailTemplate" + "/AuthorizeLetter.docx");
            string strPath2 = string.Empty;
            string SaveLoc = Server.MapPath("~/NoticeCopies/" + Session["CBViewNoticeID"].ToString() + "/");
            strPath2 = Server.MapPath("~/NoticeCopies/" + Session["CBViewNoticeID"].ToString() + "/AuthorizeLetter.doc");
            test = new CCWordApp();
            test.Open();
            string str = test.GetContent();
            string NewLine = string.Empty;
            NewLine = txtgenMailText.Text;
            test.InsertText(NewLine);
            if (System.IO.Directory.Exists(SaveLoc) == false)
            {
                // Try to create the directory.
                System.IO.DirectoryInfo di = System.IO.Directory.CreateDirectory(SaveLoc);

            }
            if (System.IO.File.Exists(strPath2))
            {
                System.IO.File.Delete(strPath2);
            }
            test.SaveAs(strPath2);
            int FiletypeID = 1;
            string FilePath = "NoticeCopies/" + Session["CBViewNoticeID"].ToString() + "/AuthorizeLetter.doc";
            int DocumentTypeID = 1;
            int IsEditable = 1;
            DataSet dsData = objdropdownBL.SaveCBDocumnetsForProcess(Convert.ToInt32(Session["CBViewNoticeID"]), FiletypeID, FilePath, Convert.ToInt32(Session[Constants.USER_ID].ToString()), DocumentTypeID, IsEditable);
            test.Quit();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Пример #6
0
    public string AuthroizationLetter(ref string strMailFormat, string CBViewNoticeID, string Agentname)
    {
        DataSet dsDate = objdropdownBL.GetDatetime();
        DateTime ToDayDate = Convert.ToDateTime(dsDate.Tables[0].Rows[0]["Datetime"].ToString());
        test = new CCWordApp();
        string line = string.Empty;
        string strPath = string.Empty;
        string strPath2 = string.Empty;
        //DataSet dsInfo = objdropdownBL.GetPackageDetailsByUIDForAuthLetter();
        strPath = HttpContext.Current.Server.MapPath("~/MailTemplate/AuthorizeLetter.docx");
        strPath2 = HttpContext.Current.Server.MapPath("~/NoticeCopies/" + CBViewNoticeID + "/AuthorizeLetter.doc");
        test.Open(strPath);
        string str = test.GetContent();
        string NewLine = string.Empty;
        line = str;

        if (line.Contains("#CustName#"))
        {
            line = line.Replace("#CustName#", "");
        }
        if (line.Contains("#VoiceFile#"))
        {
            line = line.Replace("#VoiceFile#", "");
        }
        if (line.Contains("#Recorddate#"))
        {
            line = line.Replace("#Recorddate#", "");
        }
        if (line.Contains("#AgentName#"))
        {
            line = line.Replace("#AgentName#", Agentname.ToString());
        }
        if (line.Contains("#TodayDate#"))
        {
            line = line.Replace("#TodayDate#", ToDayDate.ToString("MM/dd/yyyy"));
        }
        if (line.Contains("#CustName#"))
        {
            line = line.Replace("#CustName#", "");
        }
        if (line.Contains("#Phone#"))
        {
            line = line.Replace("#Phone#", "");
        }
        if (line.Contains("#Address#"))
        {
            line = line.Replace("#Address#", "");
        }
        if (line.Contains("#VehiclesCount#"))
        {
            line = line.Replace("#VehiclesCount#", "0");
        }
        if (line.Contains("#Amount#"))
        {
            line = line.Replace("#Amount#", "0.00");
        }
        if (line.Contains("#Payment#"))
        {
            line = line.Replace("#Payment#", "");
        }
        if (line.Contains("xxxxxxxxxxxx1015"))
        {
            line = line.Replace("xxxxxxxxxxxx1015", "");
        }
        if (line.Contains("XX/XX"))
        {
            line = line.Replace("XX/XX", "");
        }
        if (line.Contains("CVX"))
        {
            line = line.Replace("CVX", "");
        }
        if (line.Contains("#CustEmail#"))
        {
            line = line.Replace("#CustEmail#", "");
        }
        //address city, state zip
        test.Quit();
        return line;
    }
Пример #7
0
    protected void lnkbtnAuthorizationLetter_Click(object sender, EventArgs e)
    {
        try
        {
            DataSet dsDate = objdropdownBL.GetDatetime();
            DateTime ToDayDate = Convert.ToDateTime(dsDate.Tables[0].Rows[0]["Datetime"].ToString());
            if ((Session["CBClaimsCustID"] == null) || (Session["CBClaimsCustID"].ToString() == ""))
            {
                //mdepCBAlert.Show();
                //lblCBAlertMsg.Visible = true;
                //lblCBAlertMsg.Text = "User information not available for this notice";
                System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "sample();", true);
                clsMailFormats format = new clsMailFormats();
                string text = string.Empty;
                string strPath2 = string.Empty;
                CCWordApp testNew = new CCWordApp();
                string line = string.Empty;
                string strPath = string.Empty;
                string strPath1 = string.Empty;
                //DataSet dsInfo = objdropdownBL.GetPackageDetailsByUIDForAuthLetter();
                strPath = HttpContext.Current.Server.MapPath("~/MailTemplate/") + "AuthorizeLetter.docx";
                strPath2 = HttpContext.Current.Server.MapPath("~/NoticeCopies/" + Session["CBViewNoticeID"].ToString() + "/") + "AuthorizeLetter.doc";

                testNew.Open(strPath);
                string str = testNew.GetContent();
                string NewLine = string.Empty;
                line = str;

                if (line.Contains("#CustName#"))
                {
                    line = line.Replace("#CustName#", "");
                }
                if (line.Contains("#VoiceFile#"))
                {
                    line = line.Replace("#VoiceFile#", "");
                }
                if (line.Contains("#Recorddate#"))
                {
                    line = line.Replace("#Recorddate#", "");
                }
                if (line.Contains("#AgentName#"))
                {
                    line = line.Replace("#AgentName#", Session[Constants.NAME].ToString());
                }
                if (line.Contains("#TodayDate#"))
                {
                    line = line.Replace("#TodayDate#", ToDayDate.ToString("MM/dd/yyyy"));
                }
                if (line.Contains("#CustName#"))
                {
                    line = line.Replace("#CustName#", "");
                }
                if (line.Contains("#Phone#"))
                {
                    line = line.Replace("#Phone#", "");
                }
                if (line.Contains("#Address#"))
                {
                    line = line.Replace("#Address#", "");
                }
                if (line.Contains("#VehiclesCount#"))
                {
                    line = line.Replace("#VehiclesCount#", "0");
                }
                if (line.Contains("#Amount#"))
                {
                    line = line.Replace("#Amount#", "0.00");
                }
                if (line.Contains("#Payment#"))
                {
                    line = line.Replace("#Payment#", "");
                }
                if (line.Contains("xxxxxxxxxxxx1015"))
                {
                    line = line.Replace("xxxxxxxxxxxx1015", "");
                }
                if (line.Contains("XX/XX"))
                {
                    line = line.Replace("XX/XX", "");
                }
                if (line.Contains("CVX"))
                {
                    line = line.Replace("CVX", "");
                }
                if (line.Contains("#CustEmail#"))
                {
                    line = line.Replace("#CustEmail#", "");
                }
                //address city, state zip
                testNew.Quit();
                txtgenMailText.Text = line;
                mdepAuthorizeLetter.Show();
            }
            else
            {
                Session.Timeout = 180;
                clsMailFormats format = new clsMailFormats();
                string text = string.Empty;
                string strPath2 = string.Empty;
                CCWordApp testNew = new CCWordApp();
                string line = string.Empty;
                string strPath = string.Empty;
                string strPath1 = string.Empty;
                //DataSet dsInfo = objdropdownBL.GetPackageDetailsByUIDForAuthLetter();
                strPath = HttpContext.Current.Server.MapPath("~/MailTemplate/") + "AuthorizeLetter.docx";
                strPath2 = HttpContext.Current.Server.MapPath("~/NoticeCopies/" + Session["CBViewNoticeID"].ToString() + "/") + "AuthorizeLetter.doc";
                if (System.IO.File.Exists(strPath2))
                {
                    testNew.Open(strPath2);
                    string str = testNew.GetContent();
                    string NewLine = string.Empty;
                    line = str;
                    testNew.Quit();
                    txtgenMailText.Text = line;
                }
                else
                {
                    DataSet dsPackageInfo = objdropdownBL.GetPackageDetailsByUIDForAuthLetter(Convert.ToInt32(Session["CBClaimsCustID"].ToString()));
                    if (dsPackageInfo.Tables.Count > 0)
                    {
                        if (dsPackageInfo.Tables[0].Rows.Count > 0)
                        {
                            testNew.Open(strPath);
                            string str = testNew.GetContent();
                            string NewLine = string.Empty;
                            line = str;
                            string recordDate = string.Empty;
                            if (dsPackageInfo.Tables[0].Rows[0]["PayDate"].ToString() != "")
                            {
                                DateTime dtRD = Convert.ToDateTime(dsPackageInfo.Tables[0].Rows[0]["PayDate"].ToString());
                                recordDate = dtRD.ToString("MM/dd/yyyy");
                            }
                            else
                            {
                                recordDate = "";
                            }
                            if (line.Contains("#CustName#"))
                            {
                                line = line.Replace("#CustName#", dsPackageInfo.Tables[0].Rows[0]["Name"].ToString());
                            }
                            if (line.Contains("#VoiceFile#"))
                            {
                                line = line.Replace("#VoiceFile#", dsPackageInfo.Tables[0].Rows[0]["VoiceRecord"].ToString());
                            }
                            if (line.Contains("#Recorddate#"))
                            {
                                line = line.Replace("#Recorddate#", recordDate);
                            }
                            if (line.Contains("#AgentName#"))
                            {
                                line = line.Replace("#AgentName#", Session[Constants.NAME].ToString());
                            }
                            if (line.Contains("#TodayDate#"))
                            {
                                line = line.Replace("#TodayDate#", ToDayDate.ToString("MM/dd/yyyy"));
                            }
                            if (line.Contains("#Phone#"))
                            {
                                line = line.Replace("#Phone#", dsPackageInfo.Tables[0].Rows[0]["phoneNumber"].ToString());
                            }

                            string Address = dsPackageInfo.Tables[0].Rows[0]["Address"].ToString();
                            string City = dsPackageInfo.Tables[0].Rows[0]["City"].ToString();
                            string State = dsPackageInfo.Tables[0].Rows[0]["State_Code"].ToString();
                            string Zip = dsPackageInfo.Tables[0].Rows[0]["Zip"].ToString();
                            string FullAddress = string.Empty;
                            FullAddress = Address;
                            if (FullAddress != "")
                            {
                                FullAddress = FullAddress + " " + City;
                            }
                            else
                            {
                                FullAddress = City;
                            }
                            if (FullAddress != "")
                            {
                                FullAddress = FullAddress + ", " + State;
                            }
                            else
                            {
                                FullAddress = State;
                            }
                            if (FullAddress != "")
                            {
                                FullAddress = FullAddress + " " + Zip;
                            }
                            else
                            {
                                FullAddress = Zip;
                            }
                            if (line.Contains("#Address#"))
                            {
                                line = line.Replace("#Address#", FullAddress);
                            }
                            if (line.Contains("#VehiclesCount#"))
                            {
                                line = line.Replace("#VehiclesCount#", dsPackageInfo.Tables[1].Rows.Count.ToString());
                            }
                            if (line.Contains("#Amount#"))
                            {
                                line = line.Replace("#Amount#", string.Format("{0:0.00}", Convert.ToDouble(dsPackageInfo.Tables[0].Rows[0]["Price"].ToString())));
                            }
                            if (line.Contains("#Payment#"))
                            {
                                line = line.Replace("#Payment#", dsPackageInfo.Tables[0].Rows[0]["cardType"].ToString());
                            }
                            string CardNum = dsPackageInfo.Tables[0].Rows[0]["cardNumber"].ToString();
                            if (CardNum.Length > 0)
                            {
                                CardNum = CardNum.Substring(Convert.ToInt32(CardNum.Length - 4), 4);
                                CardNum = "xxxxxxxxxxxx" + CardNum.ToString();
                            }
                            else
                            {
                                CardNum = "xxxxxxxxxxxxxxxx";
                            }
                            if (line.Contains("xxxxxxxxxxxx1015"))
                            {
                                line = line.Replace("xxxxxxxxxxxx1015", CardNum);
                            }

                            string EXpDate = dsPackageInfo.Tables[0].Rows[0]["cardExpDt"].ToString();
                            string expirtdt = string.Empty;
                            if (EXpDate != "")
                            {
                                string[] EXpDt = EXpDate.Split(new char[] { '/' });
                                expirtdt = EXpDt[0].ToString() + "/" + "20" + EXpDt[1].ToString();
                            }
                            else
                            {
                                expirtdt = EXpDate;
                            }
                            if (line.Contains("XX/XX"))
                            {
                                line = line.Replace("XX/XX", expirtdt);
                            }
                            if (line.Contains("CVX"))
                            {
                                line = line.Replace("CVX", dsPackageInfo.Tables[0].Rows[0]["cardCode"].ToString());
                            }
                            if (line.Contains("#CustEmail#"))
                            {
                                line = line.Replace("#CustEmail#", dsPackageInfo.Tables[0].Rows[0]["UserName"].ToString());
                            }
                            //test.SaveAs(strPath2);
                            testNew.Quit();
                        }
                        else
                        {
                            testNew.Open(strPath);
                            string str = testNew.GetContent();
                            string NewLine = string.Empty;
                            line = str;

                            if (line.Contains("#CustName#"))
                            {
                                line = line.Replace("#CustName#", "");
                            }
                            if (line.Contains("#VoiceFile#"))
                            {
                                line = line.Replace("#VoiceFile#", "");
                            }
                            if (line.Contains("#Recorddate#"))
                            {
                                line = line.Replace("#Recorddate#", "");
                            }
                            if (line.Contains("#AgentName#"))
                            {
                                line = line.Replace("#AgentName#", Session[Constants.NAME].ToString());
                            }
                            if (line.Contains("#TodayDate#"))
                            {
                                line = line.Replace("#TodayDate#", ToDayDate.ToString("MM/dd/yyyy"));
                            }
                            if (line.Contains("#CustName#"))
                            {
                                line = line.Replace("#CustName#", "");
                            }
                            if (line.Contains("#Phone#"))
                            {
                                line = line.Replace("#Phone#", "");
                            }
                            if (line.Contains("#Address#"))
                            {
                                line = line.Replace("#Address#", "");
                            }
                            if (line.Contains("#VehiclesCount#"))
                            {
                                line = line.Replace("#VehiclesCount#", "0");
                            }
                            if (line.Contains("#Amount#"))
                            {
                                line = line.Replace("#Amount#", "0.00");
                            }
                            if (line.Contains("#Payment#"))
                            {
                                line = line.Replace("#Payment#", "");
                            }
                            if (line.Contains("xxxxxxxxxxxx1015"))
                            {
                                line = line.Replace("xxxxxxxxxxxx1015", "");
                            }
                            if (line.Contains("XX/XX"))
                            {
                                line = line.Replace("XX/XX", "");
                            }
                            if (line.Contains("CVX"))
                            {
                                line = line.Replace("CVX", "");
                            }
                            if (line.Contains("#CustEmail#"))
                            {
                                line = line.Replace("#CustEmail#", "");
                            }
                            //address city, state zip
                            testNew.Quit();

                        }
                    }
                    else
                    {
                        testNew.Open(strPath);
                        string str = testNew.GetContent();
                        string NewLine = string.Empty;
                        line = str;

                        if (line.Contains("#CustName#"))
                        {
                            line = line.Replace("#CustName#", "");
                        }
                        if (line.Contains("#VoiceFile#"))
                        {
                            line = line.Replace("#VoiceFile#", "");
                        }
                        if (line.Contains("#Recorddate#"))
                        {
                            line = line.Replace("#Recorddate#", "");
                        }
                        if (line.Contains("#AgentName#"))
                        {
                            line = line.Replace("#AgentName#", Session[Constants.NAME].ToString());
                        }
                        if (line.Contains("#TodayDate#"))
                        {
                            line = line.Replace("#TodayDate#", ToDayDate.ToString("MM/dd/yyyy"));
                        }
                        if (line.Contains("#CustName#"))
                        {
                            line = line.Replace("#CustName#", "");
                        }
                        if (line.Contains("#Phone#"))
                        {
                            line = line.Replace("#Phone#", "");
                        }
                        if (line.Contains("#Address#"))
                        {
                            line = line.Replace("#Address#", "");
                        }
                        if (line.Contains("#VehiclesCount#"))
                        {
                            line = line.Replace("#VehiclesCount#", "0");
                        }
                        if (line.Contains("#Amount#"))
                        {
                            line = line.Replace("#Amount#", "0.00");
                        }
                        if (line.Contains("#Payment#"))
                        {
                            line = line.Replace("#Payment#", "");
                        }
                        if (line.Contains("xxxxxxxxxxxx1015"))
                        {
                            line = line.Replace("xxxxxxxxxxxx1015", "");
                        }
                        if (line.Contains("XX/XX"))
                        {
                            line = line.Replace("XX/XX", "");
                        }
                        if (line.Contains("CVX"))
                        {
                            line = line.Replace("CVX", "");
                        }
                        if (line.Contains("#CustEmail#"))
                        {
                            line = line.Replace("#CustEmail#", "");
                        }
                        //address city, state zip
                        testNew.Quit();
                    }
                    //test = new CCWordApp();

                    //test.Open(strPath1);

                    //test.InsertText(NewLine);

                    //test.SaveAs(strPath2);

                    //test.Quit();
                    txtgenMailText.Text = line;
                }
                mdepAuthorizeLetter.Show();

            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }