מאָך: אַפּדייטינג אַ מנהג רשימה

עס זענען פילע גוט ביישפילן פון אַפּדייטינג מנהג רשימות דורך די סדק. דאָ איז נאָך אן אנדער.

ביזנעס פּראָבלעם: ינפאָפּאַטה פאָרעם האט שוין דיזיינד אַז ינייבאַלז ניצערס צו אַרייַן אָנליין קויפן רעקוויסיטיאָנס. פּאָ רעקוויסיטיאָן נומערן זאָל זייַן טראדיציאנעלן סיקוואַנס באזירט ינטאַדזשער וואַלועס און קאַלקיאַלייטיד אויטאָמאַטיש.

ביזנעס סאַלושאַן: שאַפֿן אַ מנהג מאָך רשימה מיט צוויי שפאלטן: "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.

Lessons Learned:

  • 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;

[וועבסערוויסע(Namespace = "http://www.conchango.com/")]
[וועבסערוויסעבינדינג(ConformsTo = ווסיפּראָפילעס.באַסיקפּראָפילע1_1)]
עפנטלעך קלאַס PoService : System.Web.Services.וועבסערוויסע
{
עפנטלעך PoService () {

//Uncomment the following line if using designed components
//יניטיאַליזעקאָמפּאָנענט();
}

/// <קיצער>
/// Obtain the next PO number from the sharepoint po number control list.
/// Increment the PO number in that list.
/// </קיצער>
/// <returns></returns>
[WebMethod]
עפנטלעך שטריקל GetNextPoNumber()
{
שטריקל ספּפּאָקאָנטראָלסיטענאַמע; // Name of the actual MOSS site that hosts the PO Control list.
שטריקל ספּפּאָקאָנטראָלליסטנאַמע; // Name of the actual MOSS list containing the Po control.

SpPoControlSiteName = ConfigurationSettings.AppSettings["PoControlListHostingSite"].טאָסטרינג();
SpPoControlListName = ConfigurationSettings.AppSettings["PoControlList"].טאָסטרינג();

שטריקל nextPoReqNumber = "xyzzy";

ניצן (ספּסיטע site = נייַ ספּסיטע(ספּפּאָקאָנטראָלסיטענאַמע))
{
ניצן (ספּוועב web = site.OpenWeb())
{

ספּליסט currentList = web.Lists[ספּפּאָקאָנטראָלליסטנאַמע];

פאָרעאַטש (שפּייַען קאָנטראָליטעם אין currentList.Items)
{

צי (((שטריקל)קאָנטראָליטעם["ControlField"]).יקוואַלז("NextPoNumber"))
{
nextPoReqNumber = (שטריקל)קאָנטראָליטעם["ControlValue"];

ינט int_nextPoReqNumber;
int_nextPoReqNumber = גער.טאָינט32(nextPoReqNumber);

int_nextPoReqNumber ;

קאָנטראָליטעם["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.
    דאַנק אין שטייַגן.

לאָזן אַ ענטפער צו KSP wrote: באָטל מאַכן ענטפער

אייער בליצפּאָסט אַדרעס וועט ניט זיין ארויס. Required fields are marked *