CRUD Processing for DataContext

Source: Internet
Author: User


  Public classUpdatecommitteebll:bllbaseex {/// <summary>        ///Request キー-Committee/// </summary>         Public Const stringRequest_key_committee ="Db_committee_register_committee"; /// <summary>        ///Request キー- participants/// </summary>         Public Const stringRequest_key_attendee ="Db_committee_register_attenndee"; /// <summary>        ///Return to キー-Committee no/// </summary>         Public Const stringResponse_key_committee_no ="Db_committee_register_committee_no"; /// <summary>        ///         /// </summary>        /// <returns></returns>        protected Overridedictionary<string,Object>Perform () {DateTime now=DateTime.Now; Tbaams_committee Committee= Request[request_key_committee] astbaams_committee; List<RESULT_ATTENDEE> ATTENDEE = Request[request_key_attendee] asList<result_attendee>; Tbaams_committee result= ( fromRowinchDatacontext.tbaams_committeewhereRow.committee_no = =Committee.committee_noSelectrow).            FirstOrDefault (); //Members ' Committee            if(Result = =NULL)            {                //Noboribetsu Registration HishinumaCommittee.committee_no =Applicationbllutility.generatecommitteeno (DataContext); Committee. HOLD_INFORM_FLG='0'; Committee. PROGRAM_INFORM_FLG='0'; Committee. DISCUSSION_RESULT_INFORM_FLG='0'; Committee. DEL_FLG='0'; Committee. Ins_userid= This.                STAFFINFO.STFCD; Committee. Ins_ip= This.                Staffinfo.ip; Committee. Ins_date=Now ; Committee. Upd_userid= This.                STAFFINFO.STFCD; Committee. Upd_ip= This.                Staffinfo.ip; Committee. Upd_date=Now ; Datacontext.tbaams_committee.            InsertOnSubmit (Committee); }            Else            {                //Update Hishinuma Manager//Exclusive Hishinuma チェック                if(result.) Upd_ip = =Committee. Upd_ip&& result. Upd_userid = =Committee. Upd_userid&& result. Upd_date = =Committee. upd_date) {result. Hold_date=Committee.                    Hold_date; Result. Hold_place=Committee.                    Hold_place; Result. Start_time=Committee.                    Start_time; Result. End_time=Committee.                    End_time; Result. REMARKS=Committee.                    REMARKS; Result. Upd_userid= This.                    STAFFINFO.STFCD; Result. Upd_ip= This.                    Staffinfo.ip; Result. Upd_date=Now ; }                Else                {                    //Exclusive エラー                    Throw NewException (Messages.ERROR013.Replace ("{0}","Members ' Committee")); }            }            //Participants (Delete-insert)List<tbaars_committee_attendee> Resdel = ( fromDelrowinchDatacontext.tbaars_committee_attendeewhereDelrow.committee_no = =Committee.committee_noSelectdelrow).            ToList (); Datacontext.tbaars_committee_attendee.            Deleteallonsubmit (Resdel); foreach(Result_attendee Insrowinchattendee) {                if(INSROW.ATTENDEE_FLG. Equals ('1') {Tbaars_committee_attendee Insattendee=NewTbaars_committee_attendee (); Insattendee.committee_no=Committee.committee_no; Insattendee.stf_code=Insrow.stf_code; INSATTENDEE.DEL_FLG='0'; Insattendee.ins_userid= This.                    STAFFINFO.STFCD; Insattendee.ins_ip= This.                    Staffinfo.ip; Insattendee.ins_date=Now ; Insattendee.upd_userid= This.                    STAFFINFO.STFCD; Insattendee.upd_ip= This.                    Staffinfo.ip; Insattendee.upd_date=Now ; Datacontext.tbaars_committee_attendee.                InsertOnSubmit (Insattendee); }} Dictionary<string,Object> response =Newdictionary<string,Object>(); Response.            ADD (Response_key_committee_no, committee.committee_no); returnresponse; }        protected Override voidValidate () {Base.            Validate (); Tbaams_committee Committee= Request[request_key_committee] astbaams_committee; List<RESULT_ATTENDEE> ATTENDEE = Request[request_key_attendee] asList<result_attendee>; Messageexception ex=Newmessageexception (); //Reminder Day//must チェック            if(String.IsNullOrEmpty (committee. Hold_date)) {ex. Messages.add (string. Format (messages.error001,"Reminder Day")); }            //Start the field.//must チェック            if(String.IsNullOrEmpty (committee. Hold_place)) {ex. Messages.add (string. Format (messages.error001,"Start the field.")); }            //hours//former チェック            if(!string. IsNullOrEmpty (committee. start_time) &&!string. IsNullOrEmpty (committee. End_time)) {if(!Checkutility.checktimebigandsmall (committee. Start_time. Split (':')[0], committee. Start_time. Split (':')[1], committee. End_time. Split (':')[0], committee. End_time. Split (':')[1]) {ex. Messages.add ("the beginning of time と finally Shimonoseki relationship が is しくありません. "); }            }            //attended by//members attended by occupies 1 でも participants がいるかをチェック            varCHK = ( fromRowinchattendeewhereRow. ATTENDEE_FLG = ='1'&& (row. Role_code = =Role.committee. Value|| Row. Role_code = =Role.chairperson. Value)Selectrow).            ToList (); if(CHK. Count = =0) {ex. Messages.add (string. Format (Messages.ERROR010.Replace ('が','も'),"attended by 1 members of the Committee が")); }            if(ex. Messages.count! =0)            {                Throwex; }        }    }
View Code

CRUD Processing for DataContext

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.