コード例 #1
0
        private void CreateMailActivity()
        {
            {
                ActivityInsert ai = new ActivityInsert();
                string         A  = "";
                string         C  = "";
                string         L  = "";

                switch (CrossWith.Text)
                {
                case "0":
                    A = MailAddressToID.Text;
                    C = "";
                    L = "";
                    break;

                case "1":
                    C = MailAddressToID.Text;
                    A = "";
                    L = "";
                    break;

                case "2":
                    L = MailAddressToID.Text;
                    A = "";
                    C = "";
                    break;
                }

                if (ViewState["fromwelcome"] != null)
                {
                    this.MailSubject.Text = "[WELCOME EMAIL] " + this.MailSubject.Text;
                }

                if (A.Length > 0 || C.Length > 0 || L.Length > 0)
                {
                    ai.InsertActivity("5", "", UC.UserId.ToString(), C, A, L, this.MailSubject.Text, "", UC.LTZ.ToUniversalTime(DateTime.Now), UC, 1);
                }
            }
        }
コード例 #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ArrayList pp = Rowediting1.ProductRows();

            if (pp.Count > 0)
            {
                bool newQuote;

                long billId;
                using (DigiDapter dg = new DigiDapter())
                {
                    dg.Add("OWNERID", this.TextboxSearchOwnerID.Text);
                    if (this.TextboxSearchManagerID.Text.Length > 0)
                    {
                        dg.Add("MANAGERID", this.TextboxSearchManagerID.Text);
                    }
                    if (this.TextboxSearchSignalerID.Text.Length > 0)
                    {
                        dg.Add("SIGNALER", this.TextboxSearchSignalerID.Text);
                    }
                    dg.Add("SUBJECT", this.QSubject.Text);
                    dg.Add("DESCRIPTION", this.QuoteDescription.Text);
                    dg.Add("CURRENCY", Rowediting1.RowEstCurrency);
                    dg.Add("CHANGE", StaticFunctions.FixDecimal(Rowediting1.RowEstChange));
                    DateTime ExpirationDate;
                    try
                    {
                        ExpirationDate = UC.LTZ.ToUniversalTime(Convert.ToDateTime(QValidData.Text));
                    }
                    catch
                    {
                        ExpirationDate = DateTime.Now.AddDays(30);
                    }
                    dg.Add("EXPIRATIONDATE", ExpirationDate);

                    DateTime QuoteDate;
                    try
                    {
                        QuoteDate = UC.LTZ.ToUniversalTime(Convert.ToDateTime(QuoteData.Text));
                    }
                    catch
                    {
                        QuoteDate = DateTime.Now;
                    }
                    dg.Add("QUOTEDATE", QuoteDate);

                    if (ShipDescription.SelectedIndex > 0)
                    {
                        dg.Add("SHIPID", ShipDescription.SelectedValue.Split('|')[0]);
                    }

                    if (ShipData.Text.Length > 0)
                    {
                        dg.Add("SHIPDATE", UC.LTZ.ToUniversalTime(Convert.ToDateTime(ShipData.Text)));
                    }

                    dg.Add("LASTMODIFIEDDATE", DateTime.Now);
                    dg.Add("LASTMODIFIEDBYID", UC.UserId);

                    if (this.QuoteID == -1)
                    {
                        dg.Add("CREATEDBYID", UC.UserId);
                    }

                    dg.Add("ACTIVITYID", this.ActivityID);
                    if (this.QStage.SelectedValue == "-1")
                    {
                        dg.Add("STAGE", ((int)QuoteStage.Negotiation).ToString());
                    }
                    else
                    {
                        dg.Add("STAGE", this.QStage.SelectedValue);
                    }
                    dg.Add("PAYMENTID", this.QPayment.SelectedValue);
                    Object progressive;
                    progressive = DatabaseConnection.SqlScalartoObj("SELECT DISABLED FROM QUOTENUMBERS WHERE TYPE=0");
                    if (progressive != null && !((bool)progressive))
                    {
                        DataRow drprog;

                        drprog = DatabaseConnection.CreateDataset("SELECT * FROM QUOTENUMBERS WHERE TYPE=0").Tables[0].Rows[0];
                        string newprog = string.Empty;

                        if (Convert.ToInt32(drprog["NPROGRESTART"]) > 0)
                        {
                            if (DateTime.Now >= new DateTime(DateTime.Now.Year, Convert.ToInt32(drprog["NPROGRESTART"]), 1) && new DateTime(DateTime.Now.Year, Convert.ToInt32(drprog["NPROGRESTART"]), 1) >= (DateTime)drprog["LASTRESET"])
                            {
                                DatabaseConnection.DoCommand("UPDATE QUOTENUMBERS SET NPROG=NPROGSTART,LASTRESET=GETDATE() WHERE TYPE=0");
                                drprog = DatabaseConnection.CreateDataset("SELECT * FROM QUOTENUMBERS WHERE TYPE=0").Tables[0].Rows[0];
                            }
                        }
                        newprog += (((int)drprog["NPROG"]) + 1).ToString();
                        if ((bool)drprog["CHECKDAY"])
                        {
                            newprog += "-" + DateTime.Now.Day.ToString();
                        }
                        if ((bool)drprog["CHECKMONTH"])
                        {
                            newprog += "-" + DateTime.Now.Month.ToString();
                        }
                        if ((bool)drprog["CHECKYEAR"])
                        {
                            if ((bool)drprog["TWODIGITYEAR"])
                            {
                                newprog += "-" + DateTime.Now.ToString("yyyy");
                            }
                            else
                            {
                                newprog += "-" + DateTime.Now.ToString("yy");
                            }
                        }

                        if ((bool)drprog["CHECKCUSTOMERCODE"])
                        {
                            switch (CrossWith.SelectedIndex)
                            {
                            case 0:
                                newprog += "-" + DatabaseConnection.SqlScalar("SELECT COMPANYCODE FROM BASE_COMPANIES WHERE ID=" + CrossWithID.Text);
                                break;

                            case 1:

                                break;

                            case 2:

                                break;
                            }
                        }

                        this.Qnumber.Text = newprog;
                        DatabaseConnection.DoCommand("UPDATE QUOTENUMBERS SET NPROG=NPROG+1 WHERE TYPE=0");
                    }

                    if (this.Qnumber.Text.Length > 0)
                    {
                        dg.Add("NUMBER", this.Qnumber.Text);
                    }

                    dg.Add("REDUCTION", 0);

                    dg.Add("CROSSTYPE", CrossWith.SelectedValue);
                    dg.Add("CROSSID", CrossWithID.Text);
                    dg.Add("ADDRESS", QAddress.Text);
                    dg.Add("SHIPADDRESS", SAddress.Text);


                    dg.Add("GRANDTOTAL", Convert.ToDecimal(Request["grandtotal"]));
                    dg.Add("SUBTOTAL", Convert.ToDecimal(Request["subtotal"]));
                    dg.Add("TAXTOTAL", Convert.ToDecimal(Request["taxtotal"]));
                    dg.Add("SHIP", (Request["shiptotal"].Length > 0)?Convert.ToDecimal(Request["shiptotal"]):0);
                    dg.Add("SHIPVAT", (Request["shipVat"].Length > 0)?Convert.ToDecimal(Request["shipVat"]):0);

                    dg.Add("GROUPS", "|" + UC.UserGroupId.ToString() + "|");

                    dg.Add("INCLUDEPRODPDF", (chkIncludePDFDoc.Checked)?1:0);
                    dg.Add("LIST", currentPriceList.Text);

                    billId = Convert.ToInt64(dg.Execute("QUOTES", "id=" + this.QuoteID, DigiDapter.Identities.Identity));
                    if (this.QuoteID == -1)
                    {
                        this.QuoteID = Convert.ToInt64(billId);
                    }
                    newQuote = dg.RecordInserted;
                }
                if (!newQuote)
                {
                    DatabaseConnection.DoCommand("DELETE FROM QUOTEROWS WHERE ESTIMATEID=" + this.QuoteID);
                    DatabaseConnection.DoCommand("DELETE FROM QUOTEDOCUMENT WHERE QUOTEID=" + this.QuoteID);
                }
                foreach (PurchaseProduct Pprod in pp)
                {
                    using (DigiDapter dg = new DigiDapter())
                    {
                        dg.Add("ESTIMATEID", this.QuoteID);
                        dg.Add("DESCRIPTION", Pprod.ShortDescription);
                        dg.Add("DESCRIPTION2", Pprod.LongDescription);
                        dg.Add("UPRICE", Pprod.UnitPrice);
                        dg.Add("NEWUPRICE", Pprod.FinalPrice);
                        dg.Add("LISTPRICE", Pprod.ListPrice);
                        dg.Add("CATALOGID", Pprod.id);
                        dg.Add("QTA", Pprod.Qta);
                        dg.Add("REDUCTION", Pprod.Reduction);
                        dg.Add("TAX", Pprod.Vat);
                        dg.Add("COST", Pprod.Cost);
                        dg.Add("PRODUCTCODE", Pprod.ProductCode);
                        dg.Add("REALLISTPRICE", Pprod.RealListPrice);
                        dg.Execute("QUOTEROWS");
                    }
                }
                if (Request["IDDocument"] != null && Request["IDDocument"].ToString().Length > 0)
                {
                    using (DigiDapter dg = new DigiDapter())
                    {
                        dg.Add("QUOTEID", this.QuoteID);
                        dg.Add("DOCUMENTID", Convert.ToInt64(Request["IDDocument"]));
                        dg.Execute("QUOTEDOCUMENT");
                    }
                }

                int otherdocument = 1;
                while (Request["IDDocument_" + otherdocument] != null && Request["IDDocument_" + otherdocument].ToString().Length > 0)
                {
                    using (DigiDapter dg = new DigiDapter())
                    {
                        dg.Add("QUOTEID", this.QuoteID);
                        dg.Add("DOCUMENTID", Convert.ToInt64(Request["IDDocument_" + otherdocument]));
                        dg.Execute("QUOTEDOCUMENT");
                    }
                    otherdocument++;
                }

                ClientScript.RegisterStartupScript(this.GetType(), "OK", "<script>alert('" + string.Format(Root.rm.GetString("Esttxt19"), this.Qnumber.Text) + "');location.href='/erp/quotelist.aspx?m=67&dgb=1&si=69';</script>");
                FillQuote(this.QuoteID);

                if (CheckActivity.Checked && CrossWithID.Text.Length > 0)
                {
                    ActivityInsert ai = new ActivityInsert();
                    string         A  = "";
                    string         C  = "";
                    string         L  = "";

                    switch (CrossWith.SelectedValue)
                    {
                    case "0":
                        A = CrossWithID.Text;
                        C = "";
                        L = "";
                        break;

                    case "1":
                        C = CrossWithID.Text;
                        A = "";
                        L = "";
                        break;

                    case "2":
                        L = CrossWithID.Text;
                        A = "";
                        C = "";
                        break;
                    }
                    if (A.Length > 0 || C.Length > 0 || L.Length > 0)
                    {
                        ai.InsertActivity("7", "", UC.UserId.ToString(), C, A, L, Root.rm.GetString("Esttxt2") + ":" + this.QSubject.Text, this.QuoteDescription.Text, UC.LTZ.ToUniversalTime(DateTime.Now), UC, 1);
                    }
                }
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "OK", "<script>alert('" + Root.rm.GetString("Quotxt29") + "');</script>");
            }
        }
コード例 #3
0
ファイル: Appointment.ascx.cs プロジェクト: eagle2014/Tustena
        private string SaveAppointment(string userId, string appointmentId, string secondUserId)
        {
            string sqlNewId = String.Empty;
            string visitId  = String.Empty;

            using (DigiDapter dg = new DigiDapter())
            {
                dg.Add("UID", userId);
                dg.Add("UIDINS", UC.UserId);
                dg.Add("CREATEDBYID", UC.UserId);
                dg.Add("STARTDATE", UC.LTZ.ToUniversalTime(Convert.ToDateTime(TxtStartDate.Text + " " + TxtStartHour.Text, UC.myDTFI)));
                dg.Add("ENDDATE", (TxtEndDate.Text.Length > 0) ?
                       UC.LTZ.ToUniversalTime(Convert.ToDateTime(TxtEndDate.Text + " " + TxtEndHour.Text, UC.myDTFI))
                                        : UC.LTZ.ToUniversalTime(Convert.ToDateTime(TxtStartDate.Text + " " + TxtEndHour.Text, UC.myDTFI)));
                dg.Add("CONTACT", TxtContact.Text);
                dg.Add("COMPANY", TxtCompany.Text);
                if (TxtCompanyID.Text.Length > 0)
                {
                    dg.Add("COMPANYID", TxtCompanyID.Text);
                }
                if (TxtContactID.Text.Length > 0)
                {
                    dg.Add("CONTACTID", TxtContactID.Text);
                }


                dg.Add("NOTE", F_note.Text);
                if (CheckSite.Checked)
                {
                    dg.Add("PLACE", 1);
                    dg.Add("ROOM", Room.Text);
                }
                else
                {
                    dg.Add("PLACE", 0);
                    dg.Add("ADDRESS", Address.Text);
                    dg.Add("CITY", City.Text);
                    dg.Add("PROVINCE", Province.Text);
                    dg.Add("CAP", CAP.Text);
                }

                if (TxtAccomplistID.Text.Length > 0)
                {
                    if (userId == TxtAccomplistID.Text)
                    {
                        dg.Add("SECONDUID", DDDLser.SelectedItem.Value);
                    }
                    else
                    {
                        dg.Add("SECONDUID", TxtAccomplistID.Text);
                    }
                }

                if (userId == UC.UserId.ToString())
                {
                    dg.Add("CONFIRMATION", 1);
                }

                dg.Add("PHONE", Phone.Text);
                if (appointmentId != secondUserId)
                {
                    dg.Add("SENCONDIDOWNER", secondUserId);
                }
                visitId = appointmentId;
                object newId;
                if (appointmentId == secondUserId)
                {
                    newId = dg.Execute("BASE_CALENDAR", "ID=" + appointmentId, DigiDapter.Identities.Identity);
                }
                else
                {
                    newId = dg.Execute("BASE_CALENDAR", "UID = " + userId + " AND SENCONDIDOWNER=" + secondUserId, DigiDapter.Identities.Identity);
                }


                if (dg.RecordInserted)
                {
                    sqlNewId = newId.ToString();
                    visitId  = sqlNewId;
                }
                else
                {
                    visitId = appointmentId;
                }
            }


            if (CheckNotify.Visible)
            {
                StringBuilder body = new StringBuilder();
                body.Append("<table  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"99%\" style=\"font-family:verdana;font-size:10px;border:1px solid black;\"align=\"center\">");
                body.Append("<tr><td width=\"50%\" VAlign=\"TOP\">");
                body.Append("<table border=\"0\" cellpadding=\"2\" cellspacing=\"5\" width=\"100%\" style=\"font-family:verdana;font-size:10px;\" align=\"center\">");
                body.Append("<tr><td style=\"border-bottom: 1px solid black;\" colspan=\"2\">");
                body.Append(DDDLser.SelectedItem.Text);
                body.Append("</td></tr><tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt4"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(TxtStartDate.Text);
                body.Append("</td></tr><tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt5"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(TxtStartHour.Text);
                body.Append("</td></tr><tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt6"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(TxtEndDate.Text);
                body.Append("</td></tr><tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt8"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(TxtContact.Text);
                body.Append("</td></tr><tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt9"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(TxtCompany.Text);
                body.Append("</td></tr><tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt64"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(Phone.Text);
                body.Append("</td></tr></table></td><td width=\"50%\" VAlign=\"TOP\">");
                body.Append("<table id=\"tblStanza\" border=\"0\" cellpadding=\"2\" cellspacing=\"5\" width=\"100%\" style=\"font-family:verdana;font-size:10px;\" align=\"center\">");
                body.Append("<tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt11"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(Room.Text);
                body.Append("</td></tr><tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt12"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(Address.Text);
                body.Append("</td></tr><tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt13"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(City.Text);
                body.Append("</td></tr><tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt14"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(Province.Text);
                body.Append("</td></tr><tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt15"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(CAP.Text);
                body.Append("</td></tr></table></td></tr><tr><td colspan=\"2\">");
                body.Append(Root.rm.GetString("Evnttxt16"));
                body.Append("</td></tr><tr><td colspan=\"2\">");
                body.Append(F_note.Text);
                body.Append("</td></tr></table>");
                G.Message(int.Parse(userId), Root.rm.GetString("Evnttxt1"), TxtStartDate.Text + "&nbsp;" + TxtStartHour.Text + "-" + TxtEndDate.Text + "<br>" + TxtContact.Text + "<br>" + F_note.Text, body.ToString());
            }


            if (CheckReminder.Checked)
            {
                if (TxtCompanyID.Text.Length > 0 || TxtContactID.Text.Length > 0)
                {
                    string subject     = Root.rm.GetString("Evnttxt1");
                    string description = F_note.Text + "\r\n\r\n" + Root.rm.GetString("Evnttxt5") + " " + TxtStartHour.Text + " " + Root.rm.GetString("Evnttxt6") + " " + TxtEndDate.Text;

                    ActivityInsert ai = new ActivityInsert();

                    if (this.ContactID.Substring(0, 1) == "C")
                    {
                        ai.InsertActivity("6", visitId, userId, TxtContactID.Text, TxtCompanyID.Text, "", subject, description, UC.LTZ.ToUniversalTime(Convert.ToDateTime(TxtStartDate.Text + " " + TxtStartHour.Text, UC.myDTFI)), UC);
                    }
                    else
                    {
                        ai.InsertActivity("6", visitId, userId, "", "", TxtContactID.Text, subject, description, UC.LTZ.ToUniversalTime(Convert.ToDateTime(TxtStartDate.Text + " " + TxtStartHour.Text, UC.myDTFI)), UC);
                    }
                }
            }

            return(visitId);
        }
コード例 #4
0
ファイル: webmail.aspx.cs プロジェクト: eagle2014/Tustena
        private void dgmessages_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "CreateActivity":
                ActivityInsert ai          = new ActivityInsert();
                string         mailbody    = HttpUtility.HtmlDecode(Pop3Utils.trimhtml(((Label)e.Item.FindControl("mailbody")).Text));
                string         mailsubject = HttpUtility.HtmlDecode(Pop3Utils.trimhtml(((Label)e.Item.FindControl("mailsubject")).Text));

                TextBox         MailAddressToID = (TextBox)e.Item.FindControl("MailAddressToID");
                RadioButtonList CrossWith       = (RadioButtonList)e.Item.FindControl("CrossWith");

                if (MailAddressToID.Text.Length > 0)
                {
                    string A = String.Empty;
                    string C = String.Empty;
                    string L = String.Empty;

                    switch (CrossWith.SelectedValue)
                    {
                    case "0":
                        A = MailAddressToID.Text;
                        C = String.Empty;
                        L = String.Empty;
                        break;

                    case "1":
                        C = MailAddressToID.Text;
                        A = String.Empty;
                        L = String.Empty;
                        break;

                    case "2":
                        L = MailAddressToID.Text;
                        A = String.Empty;
                        C = String.Empty;
                        break;
                    }
                    if (A.Length > 0 || C.Length > 0 || L.Length > 0)
                    {
                        CheckBox SaveEml = (CheckBox)e.Item.FindControl("SaveEml");
                        long     docid   = 0;
                        if (SaveEml.Checked)
                        {
                            DataRow dtpop3 = DatabaseConnection.CreateDataset("SELECT MAILSERVER,MAILUSER,MAILPASSWORD FROM ACCOUNT WHERE UID=" + UC.UserId).Tables[0].Rows[0];
                            string  pop3   = dtpop3[0].ToString();
                            bool    secure = false;
                            if (pop3.StartsWith("!"))
                            {
                                pop3   = pop3.Substring(1);
                                secure = true;
                            }
                            using (Pop3Client email = new Pop3Client(dtpop3[1].ToString(), dtpop3[2].ToString(), pop3, secure))
                            {
                                email.OpenInbox();
                                email.AttachmentsPath = Path.Combine(ConfigSettings.DataStoragePath, String.Format("webmail{1}{0}{1}", UC.UserId, Path.DirectorySeparatorChar));
                                email.NextEmail(Convert.ToInt64(((Label)e.Item.FindControl("MailMsgId")).Text));
                                string eml = email.Original;

                                Guid g = Guid.NewGuid();
                                using (DigiDapter dg = new DigiDapter())
                                {
                                    dg.Add("Guid", g);
                                    dg.Add("OwnerID", UC.UserId);
                                    dg.Add("IsReview", 0);

                                    dg.Add("ReviewNumber", 0);
                                    dg.Add("HaveRevision", false);
                                    dg.Add("CreatedDate", DateTime.UtcNow);
                                    dg.Add("CreatedByID", UC.UserId);

                                    dg.Add("Filename", email.Subject + ".eml");
                                    dg.Add("size", eml.Length);

                                    dg.Add("Description", email.Subject);
                                    dg.Add("LastModifiedDate", DateTime.UtcNow);
                                    dg.Add("LastModifiedByID", UC.UserId);

                                    dg.Add("TYPE", 0);

                                    dg.Add("Groups", "|" + UC.UserGroupId.ToString() + "|");
                                    object NewID = dg.Execute("FILEMANAGER", DigiDapter.Identities.Identity);
                                    docid = Convert.ToInt64(NewID);
                                }
                                string PathTemplate;
                                PathTemplate = ConfigSettings.DataStoragePath;
                                string NameOfFile = PathTemplate + Path.DirectorySeparatorChar + g.ToString() + ".eml";

                                FileStream   newfile = new FileStream(NameOfFile, FileMode.Create);
                                BinaryWriter wrtfile = new BinaryWriter(newfile);

                                try
                                {
                                    wrtfile.Write(eml);
                                }
                                finally
                                {
                                    wrtfile.Close();
                                    newfile.Close();
                                    email.CloseConnection();
                                }
                            }
                        }

                        ai.InsertActivity("5", "", UC.UserId.ToString(), C, A, L, mailsubject, mailbody, DateTime.UtcNow, UC, 1, false, docid, 0, 0);
                        ClientScript.RegisterStartupScript(this.GetType(), "accretae", "<script>alert('" + Root.rm.GetString("WebMLtxt6") + "');</script>");
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "accretae", "<script>alert('" + Root.rm.GetString("WebMLtxt7").Replace("'", "\'") + "');</script>");
                    }
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "accretae", "<script>alert('" + Root.rm.GetString("WebMLtxt7").Replace("'", "\'") + "');</script>");
                }

                break;
            }
        }
コード例 #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ArrayList pp = Rowediting1.ProductRows();

            if (pp.Count > 0)
            {
                bool newQuote;

                long billId;
                using (DigiDapter dg = new DigiDapter())
                {
                    dg.Add("OWNERID", this.TextboxSearchOwnerID.Text);
                    if (this.TextboxSearchManagerID.Text.Length > 0)
                    {
                        dg.Add("MANAGERID", this.TextboxSearchManagerID.Text);
                    }
                    if (this.TextboxSearchSignalerID.Text.Length > 0)
                    {
                        dg.Add("SIGNALER", this.TextboxSearchSignalerID.Text);
                    }
                    dg.Add("SUBJECT", this.QSubject.Text);
                    dg.Add("DESCRIPTION", this.QuoteDescription.Text);
                    dg.Add("CURRENCY", Rowediting1.RowEstCurrency);
                    dg.Add("CHANGE", StaticFunctions.FixDecimal(Rowediting1.RowEstChange));
                    DateTime ExpirationDate;
                    try
                    {
                        ExpirationDate = UC.LTZ.ToUniversalTime(Convert.ToDateTime(QValidData.Text));
                    }
                    catch
                    {
                        ExpirationDate = DateTime.Now.AddDays(30);
                    }
                    dg.Add("EXPIRATIONDATE", ExpirationDate);

                    DateTime QuoteDate;
                    try
                    {
                        QuoteDate = UC.LTZ.ToUniversalTime(Convert.ToDateTime(QuoteData.Text));
                    }
                    catch
                    {
                        QuoteDate = DateTime.Now;
                    }
                    dg.Add("QUOTEDATE", QuoteDate);

                    if (ShipDescription.SelectedIndex > 0)
                    {
                        dg.Add("SHIPID", ShipDescription.SelectedValue.Split('|')[0]);
                    }

                    if (ShipData.Text.Length > 0)
                    {
                        dg.Add("SHIPDATE", UC.LTZ.ToUniversalTime(Convert.ToDateTime(ShipData.Text)));
                    }

                    dg.Add("LASTMODIFIEDDATE", DateTime.Now);
                    dg.Add("LASTMODIFIEDBYID", UC.UserId);

                    if (this.QuoteID == -1)
                    {
                        dg.Add("CREATEDBYID", UC.UserId);
                    }

                    dg.Add("ACTIVITYID", this.ActivityID);
                    if (this.QStage.SelectedValue == "-1")
                    {
                        dg.Add("STAGE", ((int)QuoteStage.Negotiation).ToString());
                    }
                    else
                    {
                        dg.Add("STAGE", this.QStage.SelectedValue);
                    }
                    dg.Add("PAYMENTID", this.QPayment.SelectedValue);
                    if (this.Qnumber.Text.Length > 0)
                    {
                        dg.Add("NUMBER", this.Qnumber.Text);
                    }

                    dg.Add("REDUCTION", 0);

                    dg.Add("CROSSTYPE", CrossWith.SelectedValue);
                    dg.Add("CROSSID", CrossWithID.Text);
                    dg.Add("ADDRESS", QAddress.Text);
                    dg.Add("SHIPADDRESS", SAddress.Text);


                    dg.Add("GRANDTOTAL", Convert.ToDecimal(Request["grandtotal"]));
                    dg.Add("SUBTOTAL", Convert.ToDecimal(Request["subtotal"]));
                    dg.Add("TAXTOTAL", Convert.ToDecimal(Request["taxtotal"]));
                    dg.Add("SHIP", (Request["shiptotal"].Length > 0)?Convert.ToDecimal(Request["shiptotal"]):0);
                    dg.Add("SHIPVAT", (Request["shipVat"].Length > 0)?Convert.ToDecimal(Request["shipVat"]):0);

                    dg.Add("GROUPS", "|" + UC.UserGroupId.ToString() + "|");

                    dg.Add("INCLUDEPRODPDF", (chkIncludePDFDoc.Checked)?1:0);

                    billId = Convert.ToInt64(dg.Execute("ORDERS", "ID=" + this.QuoteID, DigiDapter.Identities.Identity));
                    if (this.QuoteID == -1)
                    {
                        this.QuoteID = Convert.ToInt64(billId);
                    }
                    newQuote = dg.RecordInserted;
                }

                if (InvoiceNumber.Text.Length > 0)
                {
                    using (DigiDapter dg = new DigiDapter())
                    {
                        dg.Add("ORDERID", this.QuoteID);
                        DateTime invoiceDate;
                        try
                        {
                            invoiceDate = UC.LTZ.ToUniversalTime(Convert.ToDateTime(InvoiceDate.Text));
                        }
                        catch
                        {
                            try
                            {
                                invoiceDate = UC.LTZ.ToUniversalTime(Convert.ToDateTime(QuoteData.Text));
                            }
                            catch
                            {
                                invoiceDate = DateTime.Now;
                            }
                        }
                        dg.Add("INVOICEDATE", invoiceDate);
                        dg.Add("INVOICENUMBER", InvoiceNumber.Text);
                        if (InvoiceExpirationDate.Text.Length > 0)
                        {
                            dg.Add("EXPIRATIONDATE", UC.LTZ.ToUniversalTime(Convert.ToDateTime(InvoiceExpirationDate.Text)));
                        }
                        if (InvoicePaymentDate.Text.Length > 0)
                        {
                            dg.Add("PAYMENTDATE", UC.LTZ.ToUniversalTime(Convert.ToDateTime(InvoicePaymentDate.Text)));
                        }
                        dg.Add("PAID", InvoicePaid.Checked);
                        dg.Execute("INVOICES", "ID=" + InvoiceId.Text);
                    }
                }

                if (!newQuote)
                {
                    DatabaseConnection.DoCommand("DELETE FROM ORDERROWS WHERE ORDERID=" + this.QuoteID);
                    DatabaseConnection.DoCommand("DELETE FROM ORDERDOCUMENT WHERE ORDERID=" + this.QuoteID);
                }
                foreach (PurchaseProduct Pprod in pp)
                {
                    using (DigiDapter dg = new DigiDapter())
                    {
                        dg.Add("ORDERID", this.QuoteID);
                        dg.Add("DESCRIPTION", Pprod.ShortDescription);
                        dg.Add("DESCRIPTION2", Pprod.LongDescription);
                        dg.Add("UPRICE", Pprod.UnitPrice);
                        dg.Add("NEWUPRICE", Pprod.FinalPrice);
                        dg.Add("LISTPRICE", Pprod.ListPrice);
                        dg.Add("CATALOGID", Pprod.id);
                        dg.Add("QTA", Pprod.Qta);
                        dg.Add("REDUCTION", Pprod.Reduction);
                        dg.Add("TAX", Pprod.Vat);
                        dg.Add("COST", Pprod.Cost);
                        dg.Add("REALLISTPRICE", Pprod.RealListPrice);
                        dg.Execute("ORDERROWS");
                    }
                }
                if (Request["IDDocument"] != null && Request["IDDocument"].ToString().Length > 0)
                {
                    using (DigiDapter dg = new DigiDapter())
                    {
                        dg.Add("QUOTEID", this.QuoteID);
                        dg.Add("DOCUMENTID", Convert.ToInt64(Request["IDDocument"]));
                        dg.Execute("ORDERDOCUMENT");
                    }
                }

                int otherdocument = 1;
                while (Request["IDDocument_" + otherdocument] != null && Request["IDDocument_" + otherdocument].ToString().Length > 0)
                {
                    using (DigiDapter dg = new DigiDapter())
                    {
                        dg.Add("QUOTEID", this.QuoteID);
                        dg.Add("DOCUMENTID", Convert.ToInt64(Request["IDDocument_" + otherdocument]));
                        dg.Execute("ORDERDOCUMENT");
                    }
                    otherdocument++;
                }

                ClientScript.RegisterStartupScript(this.GetType(), "OK", "<script>alert('" + string.Format(Root.rm.GetString("Ordtxt11"), this.Qnumber.Text) + "');location.href='/erp/orderlist.aspx?m=67&dgb=1&si=69';</script>");
                FillQuote(this.QuoteID);

                if (CheckActivity.Checked && CrossWithID.Text.Length > 0)
                {
                    ActivityInsert ai = new ActivityInsert();
                    string         A  = "";
                    string         C  = "";
                    string         L  = "";

                    switch (CrossWith.SelectedValue)
                    {
                    case "0":
                        A = CrossWithID.Text;
                        C = "";
                        L = "";
                        break;

                    case "1":
                        C = CrossWithID.Text;
                        A = "";
                        L = "";
                        break;

                    case "2":
                        L = CrossWithID.Text;
                        A = "";
                        C = "";
                        break;
                    }
                    if (A.Length > 0 || C.Length > 0 || L.Length > 0)
                    {
                        ai.InsertActivity("7", "", UC.UserId.ToString(), C, A, L, Root.rm.GetString("Ordtxt12") + ":" + this.QSubject.Text, this.QuoteDescription.Text, UC.LTZ.ToUniversalTime(DateTime.Now), UC, 1);
                    }
                }
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "OK", "<script>alert('" + Root.rm.GetString("Quotxt29") + "');</script>");
            }
        }
コード例 #6
0
        private string ModifyDataSet(string uteUID, string id, string newId)
        {
            string sqlNewId = String.Empty;
            string visitId  = String.Empty;

            using (DigiDapter dg = new DigiDapter())
            {
                dg.Add("UID", uteUID);
                dg.Add("UIDINS", UC.UserId.ToString());
                dg.Add("CREATEDBYID", UC.UserId.ToString());
                dg.Add("STARTDATE", UC.LTZ.ToUniversalTime(Convert.ToDateTime(F_StartDate.Text + " " + F_StartHour.Text, UC.myDTFI)));
                dg.Add("ENDDATE", (F_EndDate.Text.Length > 0) ?
                       UC.LTZ.ToUniversalTime(Convert.ToDateTime(F_EndDate.Text + " " + F_EndHour.Text, UC.myDTFI))
                                        : UC.LTZ.ToUniversalTime(Convert.ToDateTime(F_StartDate.Text + " " + F_EndHour.Text, UC.myDTFI)));
                dg.Add("CONTACT", F_Title.Text);
                dg.Add("COMPANY", F_Title2.Text);
                if (CompanyId.Text.Length > 0)
                {
                    dg.Add("COMPANYID", CompanyId.Text);
                }
                if (F_ContactID.Text.Length > 0)
                {
                    dg.Add("CONTACTID", F_ContactID.Text);
                }


                dg.Add("NOTE", F_note.Text);
                if (CheckSite.Checked)
                {
                    dg.Add("PLACE", 1);
                    dg.Add("ROOM", Room.Text);
                }
                else
                {
                    dg.Add("PLACE", 0);
                    dg.Add("ADDRESS", Address.Text);
                    dg.Add("CITY", City.Text);
                    dg.Add("PROVINCE", Province.Text);
                    dg.Add("CAP", CAP.Text);
                }
                if (id == "-1")
                {
                    if (CheckRecurrent.Checked)
                    {
                        dg.Add("RECURRID", NewRecurrence());
                    }
                }
                if (IdCompanion.Text.Length > 0)
                {
                    if (uteUID == IdCompanion.Text)
                    {
                        dg.Add("SECONDUID", UserApp.SelectedItem.Value);
                    }
                    else
                    {
                        dg.Add("SECONDUID", IdCompanion.Text);
                    }
                }

                if (uteUID == UC.UserId.ToString())
                {
                    dg.Add("CONFIRMATION", 1);
                }

                dg.Add("PHONE", Phone.Text);
                if (id != newId)
                {
                    dg.Add("SENCONDIDOWNER", newId);
                }
                visitId = id;
                object newId2;
                if (id == newId)
                {
                    newId2 = dg.Execute("BASE_CALENDAR", "ID=" + id, DigiDapter.Identities.Identity);
                }
                else
                {
                    newId2 = dg.Execute("BASE_CALENDAR", "UID = " + uteUID + " AND SENCONDIDOWNER=" + newId, DigiDapter.Identities.Identity);
                }


                if (dg.RecordInserted)
                {
                    sqlNewId = newId2.ToString();
                    visitId  = sqlNewId;
                }
                else
                {
                    visitId = id;
                }
            }



            if (CheckNotify.Visible)
            {
                StringBuilder body = new StringBuilder();
                body.Append("<table  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"99%\" style=\"font-family:verdana;font-size:10px;border:1px solid black;\"align=\"center\">");
                body.Append("<tr><td width=\"50%\" VAlign=\"TOP\">");
                body.Append("<table border=\"0\" cellpadding=\"2\" cellspacing=\"5\" width=\"100%\" style=\"font-family:verdana;font-size:10px;\" align=\"center\">");
                body.Append("<tr><td style=\"border-bottom: 1px solid black;\" colspan=\"2\">");
                body.Append(UserApp.SelectedItem.Text);
                body.Append("</td></tr><tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt4"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(F_StartDate.Text);
                body.Append("</td></tr><tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt5"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(F_StartHour.Text);
                body.Append("</td></tr><tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt6"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(F_EndHour.Text);
                body.Append("</td></tr><tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt8"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(F_Title.Text);
                body.Append("</td></tr><tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt9"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(F_Title2.Text);
                body.Append("</td></tr><tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt64"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(Phone.Text);
                body.Append("</td></tr></table></td><td width=\"50%\" VAlign=\"TOP\">");
                body.Append("<table id=\"tblStanza\" border=\"0\" cellpadding=\"2\" cellspacing=\"5\" width=\"100%\" style=\"font-family:verdana;font-size:10px;\" align=\"center\">");
                body.Append("<tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt11"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(Room.Text);
                body.Append("</td></tr><tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt12"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(Address.Text);
                body.Append("</td></tr><tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt13"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(City.Text);
                body.Append("</td></tr><tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt14"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(Province.Text);
                body.Append("</td></tr><tr><td width=\"40%\" style=\"border-bottom: 1px solid black;\">");
                body.Append(Root.rm.GetString("Evnttxt15"));
                body.Append("</td><td style=\"border-bottom: 1px solid black;\">");
                body.Append(CAP.Text);
                body.Append("</td></tr></table></td></tr><tr><td colspan=\"2\">");
                body.Append(Root.rm.GetString("Evnttxt16"));
                body.Append("</td></tr><tr><td colspan=\"2\">");
                body.Append(F_note.Text);
                body.Append("</td></tr></table>");
                Message(int.Parse(uteUID), Root.rm.GetString("Evnttxt1"), F_StartDate.Text + "&nbsp;" + F_StartHour.Text + "-" + F_EndHour.Text + "<br>" + F_Title.Text + "<br>" + F_note.Text, body.ToString());
            }


            if (CheckReminder.Checked)
            {
                if (CompanyId.Text.Length > 0 || F_ContactID.Text.Length > 0)
                {
                    string subject     = Root.rm.GetString("Evnttxt1");
                    string description = F_note.Text + "\r\n\r\n";

                    ActivityInsert ai = new ActivityInsert();
                    Session["Reminder_RemNote"] = Reminder_RemNote.Text;
                    ai.InsertActivity("6", visitId, uteUID, F_ContactID.Text, CompanyId.Text, "", subject, description, UC.LTZ.ToUniversalTime(Convert.ToDateTime(F_StartDate.Text + " " + F_StartHour.Text, UC.myDTFI)), UC, 0, int.Parse(((DropDownList)Page.FindControl("DropDownListPreAlarm")).SelectedValue));
                }
            }

            return(visitId);
        }
コード例 #7
0
        protected void SubmitBtn_Click(object sender, EventArgs e)
        {
            SmtpEmailer emailer = new SmtpEmailer();

            emailer.From       = MailAddressFrom.Text;
            emailer.Subject    = MailObject.Text;
            emailer.SendAsHtml = true;

            if (MailAddressTo.Text.Length > 0)
            {
                if (MailAddressTo.Text.IndexOf(';') > 1)
                {
                    string[] MailAddress = MailAddressTo.Text.Split(';');
                    foreach (string to in MailAddress)
                    {
                        emailer.To.Add(to);
                    }
                }
                else
                {
                    emailer.To.Add(MailAddressTo.Text);
                }
            }

            if (MailAddressCc.Text.Length > 0)
            {
                if (MailAddressCc.Text.IndexOf(';') > 1)
                {
                    string[] MailCc = MailAddressCc.Text.Split(';');
                    foreach (string to in MailCc)
                    {
                        emailer.CC.Add(to);
                    }
                }
                else
                {
                    emailer.To.Add(MailAddressCc.Text);
                }
            }

            if (MailAddressCcn.Text.Length > 0)
            {
                if (MailAddressCcn.Text.IndexOf(';') > 1)
                {
                    string[] MailCcn = MailAddressCcn.Text.Split(';');
                    foreach (string to in MailCcn)
                    {
                        emailer.BCC.Add(to);
                    }
                }
                else
                {
                    emailer.To.Add(MailAddressCcn.Text);
                }
            }



            emailer.Body = MailMessage.Text.Replace("\r", "").Replace("\n", "<br>");
            string filetodelete = "";

            if (this.IDDocument.Text.Length > 0)
            {
                DataTable dtAttach;
                dtAttach = DatabaseConnection.CreateDataset(String.Format("SELECT GUID,FILENAME FROM FILEMANAGER WHERE ID={0}", int.Parse(IDDocument.Text))).Tables[0];
                if (dtAttach.Rows.Count > 0)
                {
                    try
                    {
                        string dirPath;
                        string filePath;
                        dirPath  = ConfigSettings.DataStoragePath + Path.DirectorySeparatorChar + dtAttach.Rows[0]["guid"].ToString();
                        filePath = ConfigSettings.DataStoragePath + Path.DirectorySeparatorChar + dtAttach.Rows[0]["filename"].ToString();
                        FileFunctions.CheckDir(ConfigSettings.DataStoragePath, true);
                        if (File.Exists(dirPath + Path.GetExtension(dtAttach.Rows[0]["filename"].ToString())))
                        {
                            File.Copy(dirPath + Path.GetExtension(dtAttach.Rows[0]["filename"].ToString()), filePath);
                        }
                        else
                        {
                            File.Copy(dirPath, filePath);
                        }

                        SmtpAttachment att = new SmtpAttachment();
                        att.FileName    = filePath;
                        att.ContentType = "application/octet-stream";
                        att.Location    = AttachmentLocation.Attachment;
                        emailer.Attachments.Add(att);
                        filetodelete = filePath;
                    }
                    catch {}
                }
            }

            switch (ConfigSettings.SpoolFormat)
            {
            case "mssmtp":
                emailer.SendIISSMTPMessage(ConfigSettings.MailSpoolPath);
                break;

            case "xmail":
                emailer.SendXMailMessage(ConfigSettings.MailSpoolPath);
                break;

            default:
                emailer.Host = ConfigSettings.SMTPServer;
                emailer.AuthenticationMode = AuthenticationType.Plain;
                if (ConfigSettings.SMTPAuthRequired)
                {
                    emailer.User     = ConfigSettings.SMTPUser;
                    emailer.Password = ConfigSettings.SMTPPassword;
                }
                emailer.SendMessageAsync();
                break;
            }

            if (filetodelete.Length > 0)
            {
                File.Delete(filetodelete);
            }


            if (CreateActivity.Checked && MailAddressToID.Text.Length > 0)
            {
                ActivityInsert ai = new ActivityInsert();
                string         A  = "";
                string         C  = "";
                string         L  = "";

                switch (CrossWith.SelectedValue)
                {
                case "0":
                    A = MailAddressToID.Text;
                    C = "";
                    L = "";
                    break;

                case "1":
                    C = MailAddressToID.Text;
                    A = "";
                    L = "";
                    break;

                case "2":
                    L = MailAddressToID.Text;
                    A = "";
                    C = "";
                    break;
                }
                if (A.Length > 0 || C.Length > 0 || L.Length > 0)
                {
                    ai.InsertActivity("5", "", UC.UserId.ToString(), C, A, L, this.MailObject.Text, this.MailMessage.Text, UC.LTZ.ToUniversalTime(DateTime.Now), UC, 1);
                }
            }
            if (Session["fromtopbar"] != null)
            {
                Session.Remove("fromtopbar");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + Root.rm.GetString("Mailtxt19") + "');self.close();</script>");
            }
            else if (Session["fromquick"] != null)
            {
                Session.Remove("fromquick");
                OnSendMail(true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + Root.rm.GetString("Mailtxt19") + "');location.href='/mailinglist/webmail/webmail.aspx?m=46&dgb=1&si=63';</script>");
            }
        }
コード例 #8
0
        private void InsertQuickActivity(int type, int contactID, int leadId, int companyID, string subject, bool inOut)
        {
            ActivityInsert ai = new ActivityInsert();

            ai.InsertActivity(type.ToString(), string.Empty, UC.UserId.ToString(), (contactID == 0)?string.Empty:contactID.ToString(), (companyID == 0)?string.Empty:companyID.ToString(), (leadId == 0)?string.Empty:leadId.ToString(), subject, string.Empty, UC.LTZ.ToUniversalTime(DateTime.Now), UC, 0, inOut, 0, 0, 0);
        }