Ejemplo n.º 1
0
        private static void UpdateRMACreditXeroInfo(int rmaId)
        {
            String strConnectionString = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString;
            var    creditEmailHandler  = new CreditNoteRMAHandler(strConnectionString);

            creditEmailHandler.UpdateRMISentToSupplierByRAMID(rmaId);
        }
Ejemplo n.º 2
0
        private void sentRMATOCustomer(string RmaId)
        {
            var ramIdC   = Convert.ToInt32(RmaId);
            var rmaTrack = GetCreditNoteIdFromRAMTracking(ramIdC);


            String     strConnectionString = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString;
            ContactDAL cdal               = new ContactDAL(strConnectionString);
            var        orderDal           = new OrderDAL(strConnectionString);
            var        creditNoteDal      = new CreditNotesDAL(strConnectionString);
            var        ordersendEmail     = new OrderSendEmailDAL(strConnectionString);
            var        creditNoteObj      = creditNoteDal.getCreditNoteObj(rmaTrack.CreditNoteID);
            var        creditEmailHandler = new CreditNoteRMAHandler(strConnectionString);

            if (creditNoteObj.IsAvail)
            {
                if (creditNoteObj.Reason == "CHANGED PRINTER")
                {
                    var contactId = Convert.ToInt32(creditNoteObj.ContactId);
                    var contact   = cdal.GetContactByContactId(contactId);
                    if (!string.IsNullOrEmpty(creditNoteObj.Reason))
                    {
                        var orderID            = Convert.ToInt32(creditNoteObj.OrderId);
                        var xeroOrderDTSnumber = orderDal.getXeroDTSID(orderID);
                        var subject            = "RMA Request for " + creditNoteObj.Reason;

                        var body = "Hi , <br/>  RMA Request  for this order number :"
                                   + xeroOrderDTSnumber;
                        if (!string.IsNullOrEmpty(rmaTrack.SupplierRMANumber))
                        {
                            body = body + "<br/> Supplier RMA number " + rmaTrack.SupplierRMANumber;
                        }
                        if (!string.IsNullOrEmpty(rmaTrack.TrackingNumber))
                        {
                            body = body + " <br/> TrackingNumber  " + rmaTrack.TrackingNumber;
                        }

                        var toEmail = contact.Email;

                        var from     = "*****@*****.**";
                        var fromName = "Deltonesolutions";

                        var res = creditEmailHandler.SendCreditNoteEmail(rmaTrack.CreditNoteID, "", "", from, fromName, toEmail,
                                                                         "", "", subject, body, true, null);

                        if (res)
                        {
                            creditEmailHandler.UpdateRMISentToCustomer(rmaTrack.CreditNoteID);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private string SetCreditNotesHistory(int rmaId, string recentNotes)
        {
            var comNotes = HttpContext.Current.Session["LoggedUser"] + "--<b><font  color=\"red\">" + DateTime.Now.ToString("dd/MM/yyyy HH:mm") + "</font></b>--"
                           + recentNotes;
            var CONNSTRING      = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString;
            var prevoiusNote    = new CreditNoteRMAHandler(CONNSTRING).GetRMANotesById(rmaId);
            var combinecomNotes = comNotes + "<br/><br/>" + prevoiusNote;



            return(combinecomNotes);
        }
        private void SetFaultyElemants(string creditId, string suppName)
        {
            string cs  = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString;
            var    rma = new CreditNoteRMAFaultyGoods();

            rma.CreditNoteId = creditId;
            rma.SupplierName = suppName;
            rma = new CreditNoteRMAHandler(cs).GetRMAFaultyGoods(rma);

            batchnumberfaulty.Value  = rma.BatchNumber;
            modelnumberfaulty.Value  = rma.ModelNumber;
            errormessagefaulty.Value = rma.ErrorMessage;
            faultyNotes.Value        = rma.FaultyNotes;
        }
Ejemplo n.º 5
0
        private static void SendEmailToSupplier(RMAResult filesAndSupp)
        {
            string cs           = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString;
            var    subject      = "RMA Request from Deltone Solutions ";
            String bottomBanner = "<img src=\"cid:bottombanner\" height='105' width='550'>";

            var bodytitle          = "Hi  , <br/> Please fill RMA for all attached orders and send back to Deltone Solutions.";
            var creditEmailHandler = new CreditNoteRMAHandler(cs);
            var typeEmail          = 2; //RMA Request Email
            //    var suppEmails = new OrderSendEmailDAL(cs).GetSupplierEmails(suppName, typeEmail);
            var body = CreateEmailTemplateForSupplier(bottomBanner, bodytitle);

            var filePath  = "C:\\inetpub\\wwwroot\\DeltoneCRM\\Uploads\\RMA\\";
            var from      = "*****@*****.**";
            var fromName  = "Deltonesolutions";
            var sendEmail = new EmailSender();

            if (filesAndSupp.FilesAndSuppNames != null)
            {
                foreach (var item in filesAndSupp.FilesAndSuppNames)
                {
                    var suppEmails = new OrderSendEmailDAL(cs).GetSupplierEmails(item.Key, typeEmail);
                    var fileName   = item.Value + ".csv";
                    foreach (var sEmail in suppEmails)
                    {
                        var fileAtta     = new System.Collections.Generic.List <Attachment>();
                        var fileFullPAth = filePath + fileName;
                        if (File.Exists(fileFullPAth))
                        {
                            System.Net.Mail.Attachment attachment = new System.Net.Mail.Attachment(fileFullPAth);
                            attachment.Name = Path.GetFileName(fileFullPAth);
                            fileAtta.Add(attachment);
                        }
                        sendEmail.SendEmailAlternativeView(from, fromName, sEmail.SupplierEmailAddress,
                                                           "*****@*****.**", "", subject, body, true, fileAtta);
                    }
                }
            }

            if (filesAndSupp.RMAIDS != null)
            {
                if (filesAndSupp.RMAIDS.Count() > 0)
                {
                    foreach (var id in filesAndSupp.RMAIDS)
                    {
                        UpdateRMACreditXeroInfo(id);
                    }
                }
            }
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Xero Model Create Contact Unit Test
            XeroIntergration xero = new XeroIntergration();

            //Create Contact
            //Repository repos = xero.CreateRepository();
            // XeroApi.Model.Contact DeltoneContact ;
            // XeroApi.Model.Item item;


            //DeltoneContact = xero.CreateContact(repos, "DeltoneTestCompan_5", "Shehan", "Peris", "4", "61", "2434684", String.Empty, String.Empty, String.Empty, "4", "61", "123456", "*****@*****.**", "12 Kauri Grove", "Spingwale", "Australia", "3150", "VIC", "26 Tamarisk Avenue", "Glen waverley", "Australia", "3150", "VIC");

            //Response.Write(DeltoneContact.ContactID);//Fetch the Contact ID Created in Xero System .store it in the Dletone Contact Table


            //Fetch the Contact by Guid
            //DeltoneContact = xero.findContact(repos, "7B08CAB7-7157-4EFC-954C-59B3FC43F7C5");
            //Response.Write(DeltoneContact.FirstName);


            //Deltone Test Create Item
            //xero.CreateItem(repos, "DeltoneItem", "DeltoneTestDescription", (Decimal)salesUnitPrice, (Decimal)purchaseunitPrice);

            //Deltone Update Item

            //Update an Invoice
            String strGuid = "adsfhajhsdfkjhajdshf";
            //xero.UpdtateInvoice(repos, strGuid);


            //XeroIntergration xero = new XeroIntergration();
            //Repository repos = xero.CreateRepository();

            String Guid = "4dc4e979-11e5-4994-a6a9-912c102d3a13";// Expected value
            //String companyname = "REGIONAL SERVICES AUSTRALIA PTY LTD";
            String companyname = "AUSJET";
            // string ActualValue = xero.findContactByName(repos, companyname); //Actual Value

            QuoteDAL quote = new QuoteDAL(ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString);
            // var sss = quote.GetAllQuotesByCompany(176); //360

            // var testName = "Janine O'Connell";
            // var ttt= testName.Insert(8, "\\");

            var tttt = new CallNDataHandler();
            //  tttt.TestFileDownload();

            var mmm = new RepDayOffDAL(ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString);

            var obj = new StatsTargetConfig()
            {
                IsReached    = false,
                TargetAmount = 7000,
                TargetDay    = DateTime.Now.AddDays(2),
                TargetTitle  = "Lunch Target"
            };

            //  mmm.InsertIntoTargetConfig(obj, 1);

            // var result = mmm.GetAllTargetItems();

            //mmm.DeleteTargetConfig(2);

            //  mmm.UpdateTargetConfig(5, true);

            var ddd = new CreditNoteRMAHandler(ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString);

            // var nnn= ddd.GetRMANotesById(100);

            //  SendMail();

            SendCreditCardNotificationEmail(0);
        }
Ejemplo n.º 7
0
        private static void UpdateRMANUmber(DeltoneCRM_DAL.CreditNoteRMAHandler.RMAUpdate obj)
        {
            var           CONNSTRING = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString;
            SqlConnection conn       = new SqlConnection();

            conn.ConnectionString = CONNSTRING;



            if (new CreditNoteRMAHandler(CONNSTRING).GetRMAByCreditNoteIdAndSuppName(Convert.ToInt32(obj.CreId), obj.SuppName) == 0)
            {
                new CreditNotesDAL(CONNSTRING).WriteSupplierIntoRMA(obj.CreId, obj.SuppName);
            }

            var        rmaId   = new CreditNoteRMAHandler(CONNSTRING).GetRMAByCreditNoteIdAndSuppName(Convert.ToInt32(obj.CreId), obj.SuppName);
            var        RMAID   = rmaId.ToString();
            String     SqlStmt = @"UPDATE dbo.RMATracking SET SentToSupplier=@SentToSupplier, 
                      SentToSupplierDateTime=@SentToSupplierDateTime, ApprovedRMA=@ApprovedRMA, ApprovedRMADateTime=@ApprovedRMADateTime,
                      CreditInXero=@CreditInXero, CreditInXeroDateTime=@CreditInXeroDateTime, RMAToCustomer=@RMAToCustomer, 
                      RMAToCustomerDateTime=@RMAToCustomerDateTime, AdjustedNoteFromSupplier=@AdjustedNoteFromSupplier, 
                      AdjustedNoteFromSupplierDateTime=@AdjustedNoteFromSupplierDateTime, Status=@Status, SupplierRMANumber=@SupplierRMANumber, 
                TrackingNumber=@TrackingNumber , InHouse=@inHouse WHERE CreditNoteID =@crId AND SupplierName=@suppName";
            SqlCommand cmd     = new SqlCommand(SqlStmt, conn);

            cmd.Parameters.Add("@suppName", SqlDbType.NVarChar).Value = obj.SuppName;
            cmd.Parameters.Add("@crId", SqlDbType.Int).Value          = obj.CreId;
            String STS      = obj.STS;
            String STSWrite = String.Empty;

            //DateTime STSDateTime = new DateTime();
            if (STS == "True")
            {
                STSWrite = "1";
            }
            else
            {
                STSWrite = "0";
            }

            String inHouse      = obj.INHouse;
            String inHouseWrite = String.Empty;

            //DateTime STSDateTime = new DateTime();
            if (inHouse == "True")
            {
                inHouseWrite = "1";
            }
            else
            {
                inHouseWrite = "0";
            }

            cmd.Parameters.AddWithValue("@inHouse", inHouseWrite);

            String ARMA      = obj.ARMA;
            String ARMAWrite = String.Empty;

            if (ARMA == "True")
            {
                ARMAWrite = "1";
            }
            else
            {
                ARMAWrite = "0";
            }

            String CIX      = obj.CIX;
            String CIXWrite = String.Empty;

            if (CIX == "True")
            {
                CIXWrite = "1";
            }
            else
            {
                CIXWrite = "0";
            }

            String RTC      = obj.RTC;
            String RTCWrite = String.Empty;

            if (RTC == "True")
            {
                RTCWrite = "1";
            }
            else
            {
                RTCWrite = "0";
            }

            String ANFS      = obj.ANFS;
            String ANFSWrite = String.Empty;

            if (ANFS == "True")
            {
                ANFSWrite = "1";
            }
            else
            {
                ANFSWrite = "0";
            }

            String NewStatus = String.Empty;

            //if (STS == "True" && ARMA == "True" && CIX == "True" && RTC == "True" && ANFS == "True")
            //{
            //    NewStatus = "COMPLETED";
            //}
            //else
            //{

            //}
            NewStatus = new CreditNotesDAL(CONNSTRING).RMAStatusByCreditIdAndSuppllier(obj.CreId, obj.SuppName);

            if (inHouse == "True")
            {
                NewStatus = "COMPLETED";
            }
            else

            if (CIX == "True")
            {
                NewStatus = "COMPLETED";
            }


            cmd.Parameters.AddWithValue("@SentToSupplier", STSWrite);
            if (STS == "True")
            {
                if (checkIfSTSHasValue(RMAID) == "")
                {
                    cmd.Parameters.AddWithValue("@SentToSupplierDateTime", DateTime.Today);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@SentToSupplierDateTime", DateTime.Parse(checkIfSTSHasValue(RMAID)));
                }
            }
            else
            {
                cmd.Parameters.AddWithValue("@SentToSupplierDateTime", DBNull.Value);
            }

            cmd.Parameters.AddWithValue("@ApprovedRMA", ARMAWrite);

            if (ARMA == "True")
            {
                if (checkIfARMAHasValue(RMAID) == "")
                {
                    cmd.Parameters.AddWithValue("@ApprovedRMADateTime", DateTime.Today);
                    //  sentRMATOCustomer(RMAID);  // sent email to customer once RMA Approved
                }
                else
                {
                    cmd.Parameters.AddWithValue("@ApprovedRMADateTime", DateTime.Parse(checkIfARMAHasValue(RMAID)));
                }
            }
            else
            {
                cmd.Parameters.AddWithValue("@ApprovedRMADateTime", DBNull.Value);
            }


            cmd.Parameters.AddWithValue("@CreditInXero", CIXWrite);

            if (CIX == "True")
            {
                if (checkIfCIXHasValue(RMAID) == "")
                {
                    cmd.Parameters.AddWithValue("@CreditInXeroDateTime", DateTime.Today);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@CreditInXeroDateTime", DateTime.Parse(checkIfCIXHasValue(RMAID)));
                }
            }
            else
            {
                cmd.Parameters.AddWithValue("@CreditInXeroDateTime", DBNull.Value);
            }

            cmd.Parameters.AddWithValue("@RMAToCustomer", RTCWrite);

            if (RTC == "True")
            {
                if (checkIfRTCHasValue(RMAID) == "")
                {
                    cmd.Parameters.AddWithValue("@RMAToCustomerDateTime", DateTime.Today);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@RMAToCustomerDateTime", DateTime.Parse(checkIfRTCHasValue(RMAID)));
                }
            }
            else
            {
                cmd.Parameters.AddWithValue("@RMAToCustomerDateTime", DBNull.Value);
            }

            cmd.Parameters.AddWithValue("@AdjustedNoteFromSupplier", ANFSWrite);

            if (ANFS == "True")
            {
                if (checkIfANFSHasValue(RMAID) == "")
                {
                    cmd.Parameters.AddWithValue("@AdjustedNoteFromSupplierDateTime", DateTime.Today);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@AdjustedNoteFromSupplierDateTime", DateTime.Parse(checkIfANFSHasValue(RMAID)));
                }
            }
            else
            {
                cmd.Parameters.AddWithValue("@AdjustedNoteFromSupplierDateTime", DBNull.Value);
            }
            cmd.Parameters.AddWithValue("@Status", NewStatus);

            cmd.Parameters.AddWithValue("@SupplierRMANumber", obj.SRMAN);

            cmd.Parameters.AddWithValue("@TrackingNumber", obj.TN);
            conn.Open();
            cmd.ExecuteNonQuery();
            conn.Close();
        }