using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Services;
using System.ServiceModel.Description;
using System.Net;
//using Microsoft.Xrm.Sdk;
//using Microsoft.Xrm.Sdk.Client;
using System.Data;
using System.Data.SqlClient;
using Microsoft.Xrm.Sdk.Query;
using System.Configuration;
using Sulekha.Order.CrmSdk;
using System.Linq.Expressions;
using Xrm;
using System.Collections.ObjectModel;
using System.Collections;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Drawing;
using System.Web.UI.WebControls;
//using System.Web;
using System.Web.UI;
//using System.Web.UI.WebControls
namespace Sulekha.Order
{
public partial class acceptpopup : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
dynamictextboxes();
}
protected void dynamictextboxes()
{
//string noofloop = Session["countnum1"].ToString();
string selectedsession = Convert.ToString(Session["stringbuild"]);
string[] seperateditems = selectedsession.Split('#');
int selectedcount = selectedsession.Length;
foreach (string needtoseperate in seperateditems)
{
string commaseperated = needtoseperate;
string skuids = (commaseperated.Split(','))[0];
string guidss = (commaseperated.Split(','))[1];
//Console.Write("these info for :", skuids);
Label lcpn = new Label();
TextBox tcpn = new TextBox();
lcpn.Text = " Courier Parnter Name " +" "+"for"+" "+ skuids; //gui.ToString();
tcpn.ID = "cpn" + guidss;
//Response.Write("This information for the coupoun number : " + skuids);
panel1.Controls.Add(lcpn);
panel1.Controls.Add(tcpn);
panel1.Controls.Add(new LiteralControl("<br/>"));
Label lawb = new Label();
TextBox tawb = new TextBox();
lawb.Text = " Airway Bill No " + " " + "for" +" " +skuids; //gui.ToString();
tawb.ID = "awb" + guidss;
//Response.Write("This information for the coupoun number : " + skuids);
panel1.Controls.Add(lawb);
panel1.Controls.Add(tawb);
panel1.Controls.Add(new LiteralControl("<br/>"));
Label lvno = new Label();
TextBox tvno = new TextBox();
lvno.Text = " Vendor Order Number" + " " + "for" +" " +skuids; //gui.ToString();
tvno.ID = "vno" + guidss;
//Response.Write("This information for the coupoun number : " + skuids);
panel1.Controls.Add(lvno);
panel1.Controls.Add(tvno);
panel1.Controls.Add(new LiteralControl("<br/>"));
}
}
protected void acceptpopupsubmit_Click(object sender, EventArgs e)
{
foreach (Control ctl in panel1.Controls)
{
TextBox txts = ctl as TextBox;
if (txts != null)
{
string txtids = txts.ID;
string tdata = txts.Text;
string rawid = txtids.Substring(5);
Guid orderguids = new Guid();
orderguids = new Guid(rawid);
string prenameoftxt = txtids.Substring(0, 3);
ClientCredentials credentials = new ClientCredentials();
credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
Uri OrganizationUri = new Uri("http://smdev-crm/SulekhaCRM/XRMServices/2011/Organization.svc");
Uri HomeRealmUri = null;
using (Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy serviceProxy = new Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy(OrganizationUri, HomeRealmUri, credentials, null))
{
Microsoft.Xrm.Sdk.IOrganizationService service = (Microsoft.Xrm.Sdk.IOrganizationService)serviceProxy;
ColumnSet colns = new ColumnSet(true);
var orderdetails = service.Retrieve("salesorder", orderguids, colns);
orderdetails["new_venderorderstatus"] = "Shipped";
if (prenameoftxt == "cpn")
{
orderdetails["new_courierpartnername"] = txts.Text;
}
if (prenameoftxt == "awb")
{
orderdetails["new_airwaybillno"] = txts.Text;
}
if (prenameoftxt == "vno")
{
orderdetails["new_venderorderno"] = txts.Text;
}
service.Update(orderdetails);
}
}
}
}
}
}
No comments:
Post a Comment