protected void Page_Load(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(Request.Form["OrderID"]))
            {
                int           OrderID        = Int32.Parse(Request.Form["OrderID"].ToString());
                OrderDAL      dal            = new OrderDAL(strConnSitring);
                CommissionDAL dal_commission = new DeltoneCRM_DAL.CommissionDAL(strConnSitring);
                String        pre_status     = dal.getCurrentOrderStatus(OrderID);

                orderdal = new OrderDAL(strConnSitring);
                String output = orderdal.CancelOrder(OrderID);
                if (Int32.Parse(output) > 0)
                {
                    xero = new XeroIntergration();
                    Repository            repos         = xero.CreateRepository();
                    String                strOrderGuid  = orderdal.getOrderGuid(OrderID);
                    XeroApi.Model.Invoice cancelInvoice = xero.CancelInvoice(OrderID, repos, pre_status, strOrderGuid);
                    if (cancelInvoice != null)
                    {
                    }
                }

                output = dal_commission.RemoveCommissionEntry(OrderID, "ORDER");

                var orderDtsNumber = orderdal.getXeroDTSID(OrderID);
                UpdateInHouseCancelRecord(OrderID, orderDtsNumber);

                Response.Write(orderdal.CancelOrder(OrderID));
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(Request.Form["creditnoteid"]))
            {
                int            OrderID       = Int32.Parse(Request.Form["creditnoteid"].ToString());
                CreditNotesDAL creditdal     = new CreditNotesDAL(strConnSitring);
                CommissionDAL  dal_Commision = new DeltoneCRM_DAL.CommissionDAL(strConnSitring);

                String pre_status        = creditdal.getCurrentCreditNoteStatus(OrderID); //Fetch the PRevious Status
                String strCreditNoteGuid = creditdal.getCreditNote_XeroGuid(OrderID);     //Fetch the credit note Xero Guid

                String Result = String.Empty;

                if (!String.IsNullOrEmpty(strCreditNoteGuid))
                {
                    xero = new XeroIntergration();
                    Repository repos = xero.CreateRepository();
                    XeroApi.Model.CreditNote cancelCreditNote = xero.CancelCreditNote(OrderID, repos, pre_status, strCreditNoteGuid);
                    String connectionstring = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString;
                    //CANCEL THE CREDIT NOTE IN DELTONE SYSTEM
                    Result = (cancelCreditNote != null) ? "SUCCESS" : "ERROR";
                    var previousValues = pre_status;
                    if (Result.Equals("SUCCESS"))
                    {
                        var columnName = "Status";
                        var talbeName  = "CreditNote";
                        var ActionType = "CANCELLED";
                        int primaryKey = OrderID;

                        var orderIdForCreditNote = new CreditNotesDAL(connectionstring).getOrderIDFromCreditID(OrderID);

                        var newvalues = " CreditNote Id " + OrderID + " :Credit Ortder Status changed from " + previousValues + " to CANCELLED";



                        var           loggedInUserId = Convert.ToInt32(Session["LoggedUserID"].ToString());
                        SqlConnection conn           = new SqlConnection();
                        conn.ConnectionString = connectionstring;
                        var strCompanyID = new CreditNotesDAL(connectionstring).getCompanyIDFromCreditID(OrderID);

                        new DeltoneCRM_DAL.CompanyDAL(connectionstring).CreateActionONAuditLog(previousValues, newvalues, loggedInUserId, conn, 0,
                                                                                               columnName, talbeName, ActionType, primaryKey, Convert.ToInt32(strCompanyID));

                        creditdal.CancelCreditNote(OrderID);


                        dal_Commision.RemoveCommissionEntry(OrderID, "CREDITNOTE");
                    }
                }
                else
                {
                    Result = "ERROR";
                }
                Response.Write(Result);
            }
        }
Beispiel #3
0
        public void FindByName()
        {
            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

            Assert.AreEqual(Guid, ActualValue);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            contactdal = new ContactDAL(CONNSTRING);
            xero       = new XeroIntergration();

            int    CompID          = Int32.Parse(Request.Form["CompID"].ToString());
            String FirstName       = Request.Form["NewFirstName"].ToString();
            String LastName        = Request.Form["NewLastName"].ToString();
            String DefaultAreaCode = Request.Form["NewDefaultAreaCode"].ToString();
            String DefaultNumber   = Request.Form["NewDefaultNumber"].ToString();
            String MobileNumber    = Request.Form["NewMobileNumber"].ToString();
            String EmailAddy       = Request.Form["NewEmailAddy"].ToString();
            String ShipLine1       = Request.Form["NewShipLine1"].ToString();
            String ShipLine2       = Request.Form["NewShipLine2"].ToString();
            String ShipCity        = Request.Form["NewShipCity"].ToString();
            String ShipState       = Request.Form["NewShipState"].ToString();
            String ShipPostcode    = Request.Form["NewShipPostcode"].ToString();
            String BillLine1       = Request.Form["NewBillLine1"].ToString();
            String BillLine2       = Request.Form["NewBillLine2"].ToString();
            String BillCity        = Request.Form["NewBillCity"].ToString();
            String BillState       = Request.Form["NewBillState"].ToString();
            String BillPostcode    = Request.Form["NewBillPostcode"].ToString();
            String PrimaryContact  = Request.Form["PrimaryContact"].ToString();


            String finalPrimaryContact = "";

            if (PrimaryContact == "true")
            {
                finalPrimaryContact = "Y";
            }
            else
            {
                finalPrimaryContact = "N";
            }

            DeltoneCRMDAL dal = new DeltoneCRMDAL();
            // Response.Write(dal.AddNewContact(CompID, FirstName, LastName, DefaultAreaCode, DefaultNumber, MobileNumber, EmailAddy, ShipLine1, ShipLine2, ShipCity, ShipState, ShipPostcode, BillLine1, BillLine2, BillCity, BillState, BillPostcode, finalPrimaryContact));
            var    loggedInUserId = Convert.ToInt32(Session["LoggedUserID"].ToString());
            String str            = dal.AddNewContact(CompID, FirstName, LastName, DefaultAreaCode, DefaultNumber, MobileNumber, EmailAddy, ShipLine1, ShipLine2,
                                                      ShipCity, ShipState, ShipPostcode, BillLine1, BillLine2, BillCity, BillState, BillPostcode, finalPrimaryContact, loggedInUserId);

            if (!String.IsNullOrEmpty(str))
            {
                String[] arr            = str.Split(':');
                String   contactID      = arr[1].ToString();
                String   companyname    = arr[2].ToString();
                String   companywebsite = arr[3].ToString();

                String strDefaultCountryCode = "+61";       //Should have entries in AddContactUI
                String strDefaultCountry     = "Australia"; //Should have entries in AddContactUI

                //Create the Repository

                Repository            res        = xero.CreateRepository();
                XeroApi.Model.Contact delContact = xero.CreateContact(res, companyname, FirstName, LastName, DefaultAreaCode, strDefaultCountryCode, DefaultNumber, String.Empty, String.Empty, String.Empty, String.Empty, strDefaultCountryCode, MobileNumber, EmailAddy, ShipLine1, ShipCity, strDefaultCountry, ShipPostcode, ShipState, BillLine1, BillCity, strDefaultCountry, BillPostcode, BillState);
                if (delContact != null)
                {
                    //Update the ContactGuid in the DataBase Table
                    contactdal.UpdateWithXeroDetails(CompID, delContact.ContactID.ToString());
                }
                else
                {
                }

                Response.Write(str);
            }
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            xero = new XeroIntergration();
            ContactDAL contactdal = new ContactDAL(strConnString);
            CompanyDAL companydal = new CompanyDAL(strConnString);

            int    ContactID       = Int32.Parse(Request.Form["ContactID"].ToString());
            String FirstName       = Request.Form["NewFirstName"].ToString();
            String LastName        = Request.Form["NewLastName"].ToString();
            String DefaultAreaCode = Request.Form["NewDefaultAreaCode"].ToString();
            String DefaultNumber   = Request.Form["NewDefaultNumber"].ToString();
            String MobileNumber    = Request.Form["NewMobileNumber"].ToString();
            String EmailAddy       = Request.Form["NewEmailAddy"].ToString();
            String ShipLine1       = Request.Form["NewShipLine1"].ToString();
            String ShipLine2       = Request.Form["NewShipLine2"].ToString();
            String ShipCity        = Request.Form["NewShipCity"].ToString();
            String ShipState       = Request.Form["NewShipState"].ToString();
            String ShipPostcode    = Request.Form["NewShipPostcode"].ToString();
            String BillLine1       = Request.Form["NewBillLine1"].ToString();
            String BillLine2       = Request.Form["NewBillLine2"].ToString();
            String BillCity        = Request.Form["NewBillCity"].ToString();
            String BillState       = Request.Form["NewBillState"].ToString();
            String BillPostcode    = Request.Form["NewBillPostcode"].ToString();
            String PrimaryContact  = Request.Form["PrimaryContact"].ToString();
            String ActINact        = Request.Form["ActInact"].ToString();

            string finalActInact = "";

            if (ActINact == "false")
            {
                finalActInact = "N";
            }
            else
            {
                finalActInact = "Y";
            }

            String finalPrimaryContact = "";

            if (PrimaryContact == "true")
            {
                finalPrimaryContact = "Y";
            }
            else
            {
                finalPrimaryContact = "N";
            }

            var    userId = Convert.ToInt32(Session["LoggedUserID"].ToString());
            String str    = contactdal.UpdateContact(ContactID, FirstName, LastName, DefaultAreaCode,
                                                     DefaultNumber, MobileNumber, EmailAddy, ShipLine1, ShipLine2, ShipCity, ShipState,
                                                     ShipPostcode, BillLine1, BillLine2, BillCity, BillState, BillPostcode, finalPrimaryContact, finalActInact, userId);

            if (Int32.Parse(str) > 0)
            {
                //Ge the XeroGuid and Update the Details in Xero
                String contactGuid = contactdal.getXeroGuid_ForContact(ContactID);
                if (!String.IsNullOrEmpty(contactGuid) && !(DBNull.Value.Equals(contactGuid)))
                {
                    //Fetch the CompanyName for the Contact
                    String strCompanyName        = companydal.GetCompanybyContactID(ContactID);
                    String strDefaultCountryCode = "+61";       //Should have entries in AddContactUI
                    String strDefaultCountry     = "Australia"; //Should have entries in AddContactUI


                    Repository            res        = xero.CreateRepository();//Create the Repository
                    XeroApi.Model.Contact delContact = xero.UpdateContact(res, contactGuid, strCompanyName, FirstName, LastName, DefaultAreaCode, strDefaultCountryCode, DefaultNumber, String.Empty, String.Empty, String.Empty, String.Empty, strDefaultCountryCode, MobileNumber, EmailAddy, ShipLine1, ShipCity, strDefaultCountry, ShipPostcode, ShipState, BillLine1, BillCity, strDefaultCountry, ShipPostcode, BillState);
                    if (delContact != null)
                    {
                    }

                    // Repository res = xero.CreateRepository();
                    // XeroApi.Model.Contact delContact = xero.CreateContact(res, strCompanyName, FirstName, LastName, DefaultAreaCode, strDefaultCountryCode, DefaultNumber, String.Empty, String.Empty, String.Empty, String.Empty, strDefaultCountryCode, MobileNumber, EmailAddy, ShipLine1, ShipCity, strDefaultCountry, ShipPostcode, ShipState, BillLine1, BillCity, strDefaultCountry, BillPostcode, BillState);
                    //if (delContact != null)
                    // {
                    //Update the ContactGuid in the DataBase Table
                    //    contactdal.UpdateWithXeroDetails(23538, delContact.ContactID.ToString());
                    // }
                }
                else
                {
                    //Entry hasn't been created in the Xero System .Create the Entry and Update the Tables
                }
            }


            Response.Write(str);
        }