protected void ButtonCreateBill_click(object sender, EventArgs e) { var Orderid = Convert.ToInt32(str_ORDERID); var purchasedXeroINfo = purchasedal.GetSupplierNameAndXeroNumber(Orderid); if (purchasedXeroINfo.Count() > 0) { //Xero Connection XeroIntergration xero = new XeroIntergration(); xero.ChangeStatusPurchaseOrderBilled(purchasedXeroINfo); CreateAuditRecord("Purchase Order Billed", "Billed"); messagelable.Text = "Successfully Updated"; } else { messagelable.Text = "Purchse Order was not created successfully"; } }
protected void btnOrderSubmit_Click(object sender, EventArgs e) { String strDelCost = String.Empty; float Total = 0;; float SubTotal = 0; float SplitVolume = 0; String strCreditItems = String.Empty; String strCreatedBy = String.Empty; String ACCOUNT_OWNER_ID_VALUE = ACCOUNT_OWNER_ID.Value;; String ACCOUNT_OWNER_TXT_VALUE = ACCOUNT_OWNER_TXT.Value; String SALESPERSON_ID_VALUE = SALESPERON_ID.Value; String SALESPERSON_TXT_VALUE = SALESPERSON_TXT.Value; String CommishSplit = COMMISH_SPLIT.Value; if (CommishSplit == "1") { SplitVolume = float.Parse(VOLUME_SPLIT_AMOUNT.Value); } else { SplitVolume = 0; } if (!String.IsNullOrEmpty(Session["LoggedUser"] as String)) { strCreatedBy = Session["LoggedUser"].ToString(); } if (!String.IsNullOrEmpty(CusDelCostItems.Value)) { strDelCost = CusDelCostItems.Value.ToString(); } if (!String.IsNullOrEmpty(hdnTotal.Value)) { Total = float.Parse(hdnTotal.Value); } if (!String.IsNullOrEmpty(hdnSubTotal.Value)) { SubTotal = float.Parse(hdnSubTotal.Value); } if (!String.IsNullOrEmpty(OrderItems.Value)) { strCreditItems = OrderItems.Value.ToString(); } if (COMMISH_SPLIT.Value == "1") { SplitVolume = float.Parse(VOLUME_SPLIT_AMOUNT.Value); } else { SplitVolume = 0; } String CreditNoteReason = txtCreditReason.Text; String Notes = OrderNotes.Text; String strConnectionString = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString; creditNoteDAL = new CreditNotesDAL(strConnectionString); ContactDAL cdal = new ContactDAL(strConnectionString); String strGuid = cdal.getXeroGuid_ForContact(Int32.Parse(CONTACTID)); ///Create the XERO Entry first XeroIntergration xero = new XeroIntergration(); Repository res = xero.CreateRepository(); List <DeltoneItem> cr_items = CreateCreaitItems(strCreditItems); XeroApi.Model.CreditNote deltone_CreditNote = xero.CreateCreditNote(res, strGuid, String.Empty, String.Empty, cr_items); //CreditNoteReason= txtCreditReason.Text; CreditNoteReason = TYPEOFCREDIT.Value; //Get Customer delcost items and suppleir delcost items given by OrderID OrderDAL ordal = new OrderDAL(CONNSTRING); String CustomerDelItems = ordal.getCustomerDelItems(Int32.Parse(ORDERID)); String SuppDelItems = ordal.getSupplierDelItems(Int32.Parse(ORDERID)); var creditNoteMainString = ""; if (deltone_CreditNote != null) { //Write to Deltone DB Modified here if (creditNoteDAL.CreateCreditNote(Int32.Parse(COMPNAYID), Int32.Parse(CONTACTID), Total, strDelCost, strCreatedBy, Int32.Parse(ORDERID), "PENDING", CreditNoteReason, Notes, SuppDelItems, CustomerDelItems, SubTotal, SplitVolume, ACCOUNT_OWNER_ID_VALUE, ACCOUNT_OWNER_TXT_VALUE, SALESPERSON_ID_VALUE, SALESPERSON_TXT_VALUE, CommishSplit) > 0) { var connectionstring = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString; var companyName = new CompanyDAL(connectionstring).getCompanyNameByID(COMPNAYID); int CreatedCreditNoteID = creditNoteDAL.FetchLastCreatedCreaditNoteID(strCreatedBy); creditNoteMainString = " CreditNote Id : " + CreatedCreditNoteID + " Created By :" + strCreatedBy + " Notes :" + Notes + " Credit Reason " + CreditNoteReason + " Status: PENDING "; if (!String.IsNullOrEmpty(strCreditItems)) { CreateCreditNoteItems(strCreditItems, CreatedCreditNoteID, creditNoteDAL, strCreatedBy, Convert.ToInt32(COMPNAYID), creditNoteMainString); } // Create entries for the RMAs creditNoteDAL.BuildRMAList(ORDERID, CreatedCreditNoteID.ToString()); //Update the Deltone Table With the Xero Entry creditNoteDAL.UpdateWithXeroEntry(CreatedCreditNoteID, deltone_CreditNote.CreditNoteID.ToString(), deltone_CreditNote.CreditNoteNumber.ToString()); //Add ORder Supplier Notes as Type 'Credit' Dictionary <String, String> di_notes = ordal.getOrderSupplierNotes(Int32.Parse(ORDERID)); //ordal.CreateSupplerNotes(Int32.Parse(ORDERID), deltone_CreditNote.CreditNoteNumber.ToString(), di_notes); creditNoteDAL.CreateSupplerNotes(CreatedCreditNoteID, deltone_CreditNote.CreditNoteNumber.ToString(), di_notes); #region Commission_Calculation CreditNotesDAL cnDal = new CreditNotesDAL(CONNSTRING); float AccountOwnerCommission = 0; float SalespersonCommission = 0; AccountOwnerCommission = float.Parse(ACCOUNT_OWNER_COMMISH.Value); AccountOwnerCommission = -AccountOwnerCommission; if (SALESPERSON_COMMISH.Value != "") { SalespersonCommission = float.Parse(SALESPERSON_COMMISH.Value); SalespersonCommission = -SalespersonCommission; } if (COMMISH_SPLIT.Value == "0") { cnDal.SplitCommission(CreatedCreditNoteID, Int32.Parse(COMPNAYID), Int32.Parse(ACCOUNT_OWNER_ID.Value), AccountOwnerCommission, "PENDING"); } else { cnDal.SplitCommission(CreatedCreditNoteID, Int32.Parse(COMPNAYID), Int32.Parse(ACCOUNT_OWNER_ID.Value), AccountOwnerCommission, "PENDING"); cnDal.SplitCommission(CreatedCreditNoteID, Int32.Parse(COMPNAYID), Int32.Parse(SALESPERON_ID.Value), SalespersonCommission, "PENDING"); } /* * commission = float.Parse(hdnCommision.Value.ToString()); * commission = -commission; * * * * * if (Session["LoggedUserID"] != null) * { * * * cnDal.SplitCommission(CreatedCreditNoteID, Int32.Parse(COMPNAYID), Int32.Parse(Session["LoggedUserID"].ToString()), commission, "PENDING"); * }*/ #endregion Commission_Calculation ///Dialog BOX Stating Success Message and Redirection String Message = "<h2>CREDIT NOTE: " + deltone_CreditNote.CreditNoteNumber + " HAS BEEN CREATED</h2>"; String NavigateUrl = "CreditNotes/AllCreditNotes.aspx"; String PrintURl = String.Empty; string strScript = "<script language='javascript'>$(document).ready(function (){SubmitDialog('" + Message + "','" + NavigateUrl + "','" + PrintURl + "'); });</script>"; ScriptManager.RegisterStartupScript(this, this.GetType(), "PopupCP", strScript, false); //Response.Redirect("CreditNotes/AllCreditNotes.aspx"); } } else { //Couldnt Write in to Xero Message with Dialog BOX String Message = "<h2>ERROR OCCURED CREATING CREDIT NOTE</h2>"; String NavigateUrl = "CreditNotes/AllCreditNotes.aspx"; String PrintURl = String.Empty; string strScript = "<script language='javascript'>$(document).ready(function (){SubmitDialog('" + Message + "','" + NavigateUrl + "','" + PrintURl + "'); });</script>"; ScriptManager.RegisterStartupScript(this, this.GetType(), "PopupCP", strScript, false); } }
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); }