શેવાળ: વૈવિધ્યપૂર્ણ યાદી સુધારી રહ્યા છીએ

There are many good examples of updating custom lists via the SDK. Here is yet another.

વ્યાપાર સમસ્યા: InfoPath form has been designed that enables users to enter online purchase requisitions. PO Requisition numbers should be traditional sequence based integer values and calculated automatically.

વ્યાપાર સોલ્યુશન: Create a custom MOSS list containing two columns: "ControlField" and "ControlValue". The value column contains the next purchase requisition number. Note that the generic "control" naming convention provides for future control fields that may be used as needed.

ટેકનિકલ સોલ્યુશન: Create a web service accessed by the InfoPath client. The web service returns back the next purchase requisition number and updates the value of the list.

શીખેલા પાઠ:

  • When adding this web service as a data source to the InfoPath form, I found it necessary to convert it to a udc and store it into a data connection library.
  • I also found it necessary to enable cross domain scripting via central services administration // application management // form server configuration.
  • The first time the form tried to access the web service, it takes a while and on occasion, it would time out. I fiddled with settings in form server configuration to expand the timeout settings and that seemed to help.

આ કોડ:

નો ઉપયોગ પદ્ધતિ;
નો ઉપયોગ System.Web;
નો ઉપયોગ System.Web.Services;
નો ઉપયોગ System.Web.Services.Protocols;
નો ઉપયોગ Microsoft.SharePoint;
નો ઉપયોગ System.Configuration;

[WebService(Namespace = "http://www.conchango.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
જાહેર વર્ગ PoService : System.Web.Services.WebService
{
જાહેર PoService () {

//Uncomment the following line if using designed components
//InitializeComponent();
}

/// <સારાંશ>
/// Obtain the next PO number from the sharepoint po number control list.
/// Increment the PO number in that list.
/// </સારાંશ>
/// <returns></returns>
[WebMethod]
જાહેર સ્ટ્રિંગ GetNextPoNumber()
{
સ્ટ્રિંગ SpPoControlSiteName; // Name of the actual MOSS site that hosts the PO Control list.
સ્ટ્રિંગ SpPoControlListName; // Name of the actual MOSS list containing the Po control.

SpPoControlSiteName = ConfigurationSettings.AppSettings["PoControlListHostingSite"].ToString();
SpPoControlListName = ConfigurationSettings.AppSettings["PoControlList"].ToString();

સ્ટ્રિંગ nextPoReqNumber = "xyzzy";

નો ઉપયોગ (SPSite site = નવું SPSite(SpPoControlSiteName))
{
નો ઉપયોગ (SPWeb web = site.OpenWeb())
{

SPList currentList = web.Lists[SpPoControlListName];

foreach (બોલે controlItem માં currentList.Items)
{

જો (((સ્ટ્રિંગ)controlItem["ControlField"]).બરાબર("NextPoNumber"))
{
nextPoReqNumber = (સ્ટ્રિંગ)controlItem["ControlValue"];

ઈન્ int_nextPoReqNumber;
int_nextPoReqNumber = રૂપાંતર કરવું.ToInt32(nextPoReqNumber);

int_nextPoReqNumber ;

controlItem["ControlValue"] = int_nextPoReqNumber;
controlItem.Update();
}

} // Locating, reading and updating the PO number in the list.


} // using spweb web = site.openweb()
} // using spsite site = new spsite("http://localhost/mizuho")

પાછા nextPoReqNumber;

}
}

વન પર વિચાર્યું "શેવાળ: વૈવિધ્યપૂર્ણ યાદી સુધારી રહ્યા છીએ

  1. KSP wrote:
    મહત્તમ પીડી,
    We have a similar situation what you are mentioning but the problem is i want to use this web servie on a load balance server.Hence,how to handle concurrency requests in this case or how to make the new request wait and only one request should update the list number till then all other requests should be in que.Please let me know how to achieve this.
    અગાઉથી આભાર.

જવાબ છોડો

તમારું ઇમેઇલ સરનામું પ્રકાશિત કરવામાં આવશે નહીં. જરૂરી ક્ષેત્રો ચિહ્નિત થયેલ છે *