public HttpResponseMessage SaveUpdateBookingItemMasterNdetails(object[] data) { SalBookingMaster itemMaster = JsonConvert.DeserializeObject <SalBookingMaster>(data[0].ToString()); List <SalBookingDetail> itemDetails = JsonConvert.DeserializeObject <List <SalBookingDetail> >(data[1].ToString()); int menuID = Convert.ToInt16(data[2]); SalBookingMaster obj = new SalBookingMaster(); string result = ""; try { if (ModelState.IsValid && itemMaster != null && itemMaster.EmployeeID.ToString() != "" && itemDetails.Count > 0 && menuID != null) { result = objPIService.SaveUpdateBookingItemMasterNdetails(itemMaster, itemDetails, menuID); } else { result = ""; } } catch (Exception e) { e.ToString(); result = ""; } return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public string SaveUpdateLC(SalLCMaster LCInfo, List <SalLCDetail> LCDetailList, ArrayList fileNames, vmCmnParameters objcmnParam) { GenericFactory_SalLCMaster = new SalLCMaster_EF(); GenericFactory_SalLCDetail = new SalLCDetail_EF(); GenericFactory_CmnDocument = new CmnDocument_EF(); GenericFactory_EF_SalPIMaster = new SalPIMaster_EF(); GenericFactory_EF_SalBookingMaster = new SalBookingMaster_EF(); string result = ""; string newLCRefNo = ""; long FirstDigit = 0, OtherDigits = 0, nextDetailId = 0, NextId = 0; #region Amendment Block if (LCInfo.LCID > 0) { using (TransactionScope transaction = new TransactionScope()) { try { NextId = Convert.ToInt64(GenericFactory_SalLCMaster.getMaxID("SalLCMaster")); nextDetailId = Convert.ToInt64(GenericFactory_SalLCDetail.getMaxID("SalLCDetail")); FirstDigit = Convert.ToInt64(nextDetailId.ToString().Substring(0, 1)); OtherDigits = Convert.ToInt64(nextDetailId.ToString().Substring(1, Convert.ToInt32(nextDetailId.ToString().Length) - 1)); //******------------------start create LC Amendment No No------------------****** string[] amendmendNo = LCInfo.LCReferenceNo.ToString().Split(new string[] { "-AMD-" }, StringSplitOptions.None); //itemMaster.PINO.ToString().Contains("Revise").ToString(); int amendNo = 0; if (amendmendNo.Length > 1) { amendNo = Convert.ToInt16(amendmendNo[amendmendNo.Length - 1]) + 1; newLCRefNo = amendmendNo[0] + "-AMD-" + amendNo.ToString(); } else if (amendmendNo.Length == 1) { newLCRefNo = LCInfo.LCReferenceNo.ToString() + "-AMD-1".ToString(); amendNo = 1; } //******------------------end create LC Amendment No------------------****** //******------------------Update LC master and Detail------------------****** Int64 lLCID = LCInfo.LCID; IEnumerable <SalLCMaster> objSalLCMaster = GenericFactory_SalLCMaster.FindBy(m => m.LCID == lLCID).ToList(); SalLCMaster lstSalLCMaster = new SalLCMaster(); foreach (SalLCMaster lc in objSalLCMaster) { lc.IsActive = false; lstSalLCMaster = lc; } GenericFactory_SalLCMaster.Update(lstSalLCMaster); GenericFactory_SalLCMaster.Save(); IEnumerable <SalLCDetail> objSalLCDetail = GenericFactory_SalLCDetail.FindBy(m => m.LCID == lLCID).ToList(); SalLCDetail lstSalLCDetail = new SalLCDetail(); foreach (SalLCDetail lcd in objSalLCDetail) { lcd.IsActive = false; lstSalLCDetail = lcd; } GenericFactory_SalLCDetail.Update(lstSalLCDetail); GenericFactory_SalLCDetail.Save(); //******------------------End Update LC master and Detail ------------------****** //******------------------Start PI Table Update ------------------****** foreach (SalLCDetail sdtl in LCDetailList) { SalPIMaster objSalPIMaster = GenericFactory_EF_SalPIMaster.FindBy(m => m.PIID == sdtl.PIID).FirstOrDefault(); objSalPIMaster.IsLcCompleted = true; GenericFactory_EF_SalPIMaster.Update(objSalPIMaster); GenericFactory_EF_SalPIMaster.Save(); } //******------------------ End PI Table Update ------------------****** LCInfo.LCID = NextId; LCInfo.LCReferenceNo = newLCRefNo; LCInfo.AmendmentDate = LCInfo.LCDate; LCInfo.AmendmentNo = amendNo.ToString(); LCInfo.CreateOn = DateTime.Now; LCInfo.IsMasterLC = false; LCInfo.IsActive = true; LCInfo.IsHDOCompleted = false; List <SalLCDetail> lstLCDetail = new List <SalLCDetail>(); foreach (SalLCDetail sdtl in LCDetailList) { SalLCDetail objLCDetail = new SalLCDetail(); objLCDetail.LCDetailID = Convert.ToInt64(FirstDigit + "" + OtherDigits); objLCDetail.LCID = NextId; objLCDetail.PIID = sdtl.PIID; objLCDetail.PINo = sdtl.PINo; objLCDetail.CustomCode = LCInfo.LCReferenceNo; objLCDetail.LCReferenceNo = LCInfo.LCReferenceNo; objLCDetail.AmendmentNo = LCInfo.AmendmentNo; objLCDetail.AmendmentDate = LCInfo.AmendmentDate; objLCDetail.CompanyID = LCInfo.CompanyID; objLCDetail.IsHDOCompleted = false; objLCDetail.CreateBy = LCInfo.CreateBy; objLCDetail.CreateOn = DateTime.Now; objLCDetail.CreatePc = HostService.GetIP(); objLCDetail.IsActive = true; objLCDetail.IsDeleted = false; objLCDetail.DBID = 1; objLCDetail.StatusBy = 1; objLCDetail.StatusID = 1; lstLCDetail.Add(objLCDetail); OtherDigits++; } GenericFactory_SalLCMaster.Insert(LCInfo); GenericFactory_SalLCMaster.Save(); GenericFactory_SalLCMaster.updateMaxID("SalLCMaster", Convert.ToInt64(NextId)); GenericFactory_SalLCDetail.InsertList(lstLCDetail); GenericFactory_SalLCDetail.Save(); GenericFactory_SalLCDetail.updateMaxID("SalLCDetail", Convert.ToInt64(FirstDigit + "" + (OtherDigits - 1))); //**********----------------------Start File Upload----------------------********** int DocumentID = Convert.ToInt16(GenericFactory_CmnDocument.getMaxID("CmnDocument")); List <CmnDocument> lstCmnDocument = new List <CmnDocument>(); for (int i = 1; i <= fileNames.Count; i++) { CmnDocument objCmnDocument = new CmnDocument(); objCmnDocument.DocumentID = DocumentID; objCmnDocument.DocumentPahtID = 1; //objCmnDocument.DocumentName = fileNames[i].ToString(); string extension = System.IO.Path.GetExtension(fileNames[i - 1].ToString()); objCmnDocument.DocumentName = newLCRefNo + "_Doc_" + i + extension; objCmnDocument.TransactionID = LCInfo.LCID; objCmnDocument.TransactionTypeID = 1; objCmnDocument.CompanyID = LCInfo.CompanyID; objCmnDocument.CreateBy = LCInfo.CreateBy; objCmnDocument.CreateOn = DateTime.Now; objCmnDocument.CreatePc = HostService.GetIP(); objCmnDocument.IsDeleted = false; objCmnDocument.IsDeleted = false; lstCmnDocument.Add(objCmnDocument); DocumentID++; } GenericFactory_CmnDocument.InsertList(lstCmnDocument); GenericFactory_CmnDocument.Save(); GenericFactory_CmnDocument.updateMaxID("CmnDocument", Convert.ToInt64(DocumentID - 1)); //**********----------------------File upload completed----------------------********** transaction.Complete(); result = newLCRefNo; } catch (Exception e) { e.ToString(); result = ""; } } } #endregion Amendment Block #region New LC Block else { using (TransactionScope transaction = new TransactionScope()) { //////////////////////////////////////////Primary Key and Custom Code Strat////////////////////////////////// ////start new maxId //int NextId = Convert.ToInt16(GenericFactory_SalLCMaster.getMaxID("SalLCMaster")); //int nextDetailId = Convert.ToInt16(GenericFactory_SalLCDetail.getMaxID("SalLCDetail")); ////end new maxId //...........START new maxId........// NextId = Convert.ToInt64(GenericFactory_SalLCMaster.getMaxID("SalLCMaster")); nextDetailId = Convert.ToInt64(GenericFactory_SalLCDetail.getMaxID("SalLCDetail")); FirstDigit = Convert.ToInt64(nextDetailId.ToString().Substring(0, 1)); OtherDigits = Convert.ToInt64(nextDetailId.ToString().Substring(1, nextDetailId.ToString().Length - 1)); //..........END new maxId.........// //// start for custom code //string customCode = ""; //CmnCustomCode objCustomCode = GFactory_EF_CmnCustomCode.FindBy(m => m.MenuID == 25 && m.CompanyID == LCInfo.CompanyID).FirstOrDefault(); //int customCodeID = Convert.ToInt16(objCustomCode.RecordID); //if (customCodeID > 0) //{ // customCode = GenericFactory_SalLCMaster.getCustomCode(customCodeID, DateTime.Now, LCInfo.CompanyID, 1, 1); //} //else //{ // customCode = NextId.ToString(); //} //// end for custom code //......... START for custom code........... // string customCode = ""; string CustomNo = customCode = GenericFactory_SalLCMaster.getCustomCode(objcmnParam.menuId, LCInfo.LCDate ?? DateTime.Now, LCInfo.CompanyID, 1, 1);// // 1 for user id and 1 for db id --- work later if (CustomNo != null) { customCode = CustomNo; } else { customCode = NextId.ToString(); } //.........END for custom code............ // //////////////////////////////////////////Primary Key and Custom Code End////////////////////////////////// try { LCInfo.LCID = NextId; LCInfo.CreateOn = DateTime.Now; if (LCInfo.MasterLCNO != "") { LCInfo.IsMasterLC = true; } else { LCInfo.IsMasterLC = false; } LCInfo.IsActive = true; LCInfo.LCReferenceNo = customCode; LCInfo.AmendmentNo = "0"; LCInfo.IsHDOCompleted = false; string ImagePath = string.Empty; //if (string.IsNullOrEmpty(ImagePath) && !string.IsNullOrEmpty(LCInfo.ImageNames)) //{ // //ImagePath=utils //} List <SalLCDetail> lstSalLCDetail = new List <SalLCDetail>(); foreach (SalLCDetail sdtl in LCDetailList) { SalLCDetail objSalLCDetail = new SalLCDetail(); //objSalLCDetail.LCDetailID = nextDetailId; objSalLCDetail.LCDetailID = Convert.ToInt64(FirstDigit + "" + OtherDigits); objSalLCDetail.LCID = NextId; objSalLCDetail.PIID = sdtl.PIID; objSalLCDetail.PINo = sdtl.PINo; objSalLCDetail.CustomCode = LCInfo.LCReferenceNo; objSalLCDetail.LCReferenceNo = LCInfo.LCReferenceNo; objSalLCDetail.IsHDOCompleted = false; objSalLCDetail.CompanyID = LCInfo.CompanyID; objSalLCDetail.CreateBy = LCInfo.CreateBy; objSalLCDetail.CreateOn = DateTime.Now; objSalLCDetail.CreatePc = HostService.GetIP(); objSalLCDetail.IsActive = true; objSalLCDetail.IsDeleted = false; objSalLCDetail.DBID = 1; objSalLCDetail.StatusBy = 1; objSalLCDetail.StatusID = 1; lstSalLCDetail.Add(objSalLCDetail); OtherDigits++; } //foreach (SalLCDetail sdtl in LCDetailList) //{ // SalPIMaster objSalPIMaster = GenericFactory_EF_SalPIMaster.FindBy(m => m.PIID == sdtl.PIID).FirstOrDefault(); // objSalPIMaster.IsLcCompleted = true; // GenericFactory_EF_SalPIMaster.Update(objSalPIMaster); // GenericFactory_EF_SalPIMaster.Save(); //} /////////////////////// Start PI Table Update ///////////////////////////// foreach (SalLCDetail sdtl in LCDetailList) { SalPIMaster objSalPIMaster = GenericFactory_EF_SalPIMaster.FindBy(m => m.PIID == sdtl.PIID).FirstOrDefault(); objSalPIMaster.IsLcCompleted = true; GenericFactory_EF_SalPIMaster.Update(objSalPIMaster); GenericFactory_EF_SalPIMaster.Save(); } /////////////////////// End PI Table Update ///////////////////////////// /////////////////////// Start Booking Table Update ///////////////////////////// foreach (SalLCDetail sdtl in LCDetailList) { SalPIMaster objSalPIMaster = GenericFactory_EF_SalPIMaster.FindBy(m => m.PIID == sdtl.PIID).FirstOrDefault(); SalBookingMaster objBookingMaster = GenericFactory_EF_SalBookingMaster.FindBy(m => m.BookingID == objSalPIMaster.BookingID).FirstOrDefault(); objBookingMaster.IsLCCompleted = true; GenericFactory_EF_SalBookingMaster.Update(objBookingMaster); GenericFactory_EF_SalBookingMaster.Save(); } /////////////////////// End Booking Table Update ///////////////////////////// GenericFactory_SalLCMaster.Insert(LCInfo); GenericFactory_SalLCMaster.Save(); GenericFactory_SalLCMaster.updateMaxID("SalLCMaster", Convert.ToInt64(NextId)); GenericFactory_SalLCMaster.updateCustomCode(25, DateTime.Now, LCInfo.CompanyID, 1, 1); GenericFactory_SalLCDetail.InsertList(lstSalLCDetail); GenericFactory_SalLCDetail.Save(); //GenericFactory_SalLCDetail.updateMaxID("SalLCDetail", Convert.ToInt64(nextDetailId - 1)); GenericFactory_SalLCDetail.updateMaxID("SalLCDetail", Convert.ToInt64(FirstDigit + "" + (OtherDigits - 1))); ////////////////////////////////////////Start File Upload////////////////////////////// int DocumentID = Convert.ToInt16(GenericFactory_CmnDocument.getMaxID("CmnDocument")); List <CmnDocument> lstCmnDocument = new List <CmnDocument>(); for (int i = 1; i <= fileNames.Count; i++) { CmnDocument objCmnDocument = new CmnDocument(); objCmnDocument.DocumentID = DocumentID; objCmnDocument.DocumentPahtID = 1; //objCmnDocument.DocumentName = fileNames[i].ToString(); string extension = System.IO.Path.GetExtension(fileNames[i - 1].ToString()); objCmnDocument.DocumentName = customCode + "_Doc_" + i + extension; objCmnDocument.TransactionID = LCInfo.LCID; objCmnDocument.TransactionTypeID = 1; objCmnDocument.CompanyID = LCInfo.CompanyID; objCmnDocument.CreateBy = LCInfo.CreateBy; objCmnDocument.CreateOn = DateTime.Now; objCmnDocument.CreatePc = HostService.GetIP(); objCmnDocument.IsDeleted = false; objCmnDocument.IsDeleted = false; lstCmnDocument.Add(objCmnDocument); DocumentID++; } GenericFactory_CmnDocument.InsertList(lstCmnDocument); GenericFactory_CmnDocument.Save(); GenericFactory_CmnDocument.updateMaxID("CmnDocument", Convert.ToInt64(DocumentID - 1)); ///////////////////////////////////////////////File upload completed///////////////////////////////////////////// transaction.Complete(); result = customCode; } catch (Exception e) { e.ToString(); result = ""; } } } #endregion New LC Block return(result); }
public string SaveUpdateBookingItemMasterNdetails(SalBookingMaster itemMaster, List <SalBookingDetail> itemDetails, int menuID) { string result = string.Empty; using (var transaction = new TransactionScope()) { //*********************************************Start Initialize Variable***************************************** long MasterId = 0, DetailId = 0, FirstDigit = 0, OtherDigits = 0; //***************************************End Initialize Variable************************************************* GenericFactory_EF_SalBookingMaster = new SalBookingMaster_EF(); GenericFactory_EF_SalBookingDetail = new SalBookingDetail_EF(); //****************************End Initialize Generic Repository Based on table*********************************** //**********************************Start Create Related Table Instance to Save********************************** var MasterItem = new SalBookingMaster(); var DetailItem = new List <SalBookingDetail>(); var DetailItems = new List <SalBookingDetail>(); //************************************End Create Related Table Instance to Save********************************** //*************************************Start Create Model Instance to get Data*********************************** SalBookingDetail item = new SalBookingDetail(); SalBookingMaster items = new SalBookingMaster(); SalBookingDetail itemdel = new SalBookingDetail(); //***************************************End Create Model Instance to get Data*********************************** var SDetail = itemDetails.Where(x => x.BookingDetailID == 0).ToList(); var UDetail = itemDetails.Where(x => x.BookingDetailID != 0).ToList(); //**************************************************Start Main Operation************************************************ if (itemDetails.Count > 0) { try { if (itemMaster.BookingID == 0) { //***************************************************Start Save Operation************************************************ //**********************************************Start Generate itemMaster & itemDetails ID**************************************** MasterId = Convert.ToInt16(GenericFactory_EF_SalBookingMaster.getMaxID("SalBookingMaster")); DetailId = Convert.ToInt64(GenericFactory_EF_SalBookingDetail.getMaxID("SalBookingDetail")); FirstDigit = Convert.ToInt64(DetailId.ToString().Substring(0, 1)); OtherDigits = Convert.ToInt64(DetailId.ToString().Substring(1, DetailId.ToString().Length - 1)); //***********************************************End Generate itemMaster & itemDetails ID***************************************** string customCode = ""; string CustomNo = customCode = GenericFactory_EF_SalBookingMaster.getCustomCode(menuID, itemMaster.BookingDate, itemMaster.CompanyID, 1, 1); // 1 for user id and 1 for db id if (CustomNo != null && CustomNo != "") { customCode = CustomNo; } else { customCode = MasterId.ToString(); } string bookingNo = customCode; MasterItem = new SalBookingMaster { BookingID = (int)MasterId, BookingNo = customCode, TransactionTypeID = itemMaster.TransactionTypeID, BuyerID = itemMaster.BuyerID, BuyerRefID = itemMaster.BuyerRefID, Description = itemMaster.Description, BookingDate = itemMaster.BookingDate, IsPICompleted = false, IsLCCompleted = false, IsHDOCompleted = false, CompanyID = itemMaster.CompanyID, CreateOn = DateTime.Now, CreateBy = itemMaster.CreateBy, CreatePc = HostService.GetIP(), EmployeeID = itemMaster.CreateBy ?? 0 }; for (int i = 0; i < itemDetails.Count; i++) { item = itemDetails[i]; var Detailitem = new SalBookingDetail { BookingDetailID = Convert.ToInt32(FirstDigit + "" + OtherDigits), BookingID = (int)MasterId, ItemID = item.ItemID, CompanyID = itemMaster.CompanyID, Quantity = item.Quantity, DeliveryStartDate = item.DeliveryStartDate, DeliveryFinishDate = item.DeliveryFinishDate, IsDelevered = false, CreateBy = itemMaster.CreateBy, CreateOn = DateTime.Now, CreatePc = HostService.GetIP(), IsDeleted = false }; DetailItem.Add(Detailitem); OtherDigits++; } //***************************************************End Save Operation************************************************ } else { //***********************************Start Get Data From Related Table to Update********************************* var MasterAll = GenericFactory_EF_SalBookingMaster.GetAll().Where(x => x.BookingID == itemMaster.BookingID && x.CompanyID == itemMaster.CompanyID); var DetailAll = GenericFactory_EF_SalBookingDetail.GetAll().Where(x => x.BookingID == itemMaster.BookingID && x.CompanyID == itemMaster.CompanyID).ToArray(); //*************************************End Get Data From Related Table to Update********************************* //***************************************************Start Update Operation******************************************** MasterItem = MasterAll.First(x => x.BookingID == itemMaster.BookingID); MasterItem.BookingNo = itemMaster.BookingNo; MasterItem.BookingDate = itemMaster.BookingDate; MasterItem.BuyerID = itemMaster.BuyerID; MasterItem.BuyerRefID = itemMaster.BuyerRefID; MasterItem.Description = itemMaster.Description; MasterItem.CompanyID = itemMaster.CompanyID; MasterItem.UpdateBy = itemMaster.CreateBy; MasterItem.UpdateOn = DateTime.Now; MasterItem.UpdatePc = HostService.GetIP(); MasterItem.IsDeleted = false; for (int i = 0; i < UDetail.Count; i++) { item = UDetail[i]; foreach (SalBookingDetail d in DetailAll.Where(d => d.BookingID == itemMaster.BookingID && d.BookingDetailID == item.BookingDetailID)) { d.ItemID = item.ItemID; d.Quantity = item.Quantity; d.DeliveryStartDate = item.DeliveryStartDate; d.DeliveryFinishDate = item.DeliveryFinishDate; d.CompanyID = itemMaster.CompanyID; d.UpdateBy = itemMaster.CreateBy; d.UpdateOn = DateTime.Now; d.UpdatePc = HostService.GetIP(); d.IsDeleted = false; DetailItem.Add(d); break; } } if (SDetail != null && SDetail.Count != 0) { for (int i = 0; i < SDetail.Count; i++) { item = SDetail[i]; DetailId = Convert.ToInt64(GenericFactory_EF_SalBookingDetail.getMaxID("SalBookingDetail")); FirstDigit = Convert.ToInt64(DetailId.ToString().Substring(0, 1)); OtherDigits = Convert.ToInt64(DetailId.ToString().Substring(1, DetailId.ToString().Length - 1)); var Detailitems = new SalBookingDetail { BookingDetailID = Convert.ToInt32(FirstDigit + "" + OtherDigits), BookingID = (long)itemMaster.BookingID, ItemID = item.ItemID, Quantity = item.Quantity, DeliveryStartDate = item.DeliveryStartDate, DeliveryFinishDate = item.DeliveryFinishDate, CompanyID = itemMaster.CompanyID, CreateBy = itemMaster.CreateBy, CreateOn = DateTime.Now, CreatePc = HostService.GetIP(), IsDeleted = false }; DetailItems.Add(Detailitems); GenericFactory_EF_SalBookingDetail.updateMaxID("SalBookingDetail", Convert.ToInt64(FirstDigit + "" + (OtherDigits))); } } if (UDetail.Count < DetailAll.Count()) { for (int i = 0; i < DetailAll.Count(); i++) { itemdel = DetailAll[i]; var delDetail = (from del in DetailItem.Where(x => x.BookingDetailID == itemdel.BookingDetailID) select del.BookingDetailID).FirstOrDefault(); if (delDetail != itemdel.BookingDetailID) { var tem = DetailAll.FirstOrDefault(d => d.BookingID == itemMaster.BookingID && d.BookingDetailID == itemdel.BookingDetailID); tem.CompanyID = itemMaster.CompanyID; tem.DeleteBy = itemMaster.CreateBy; tem.DeleteOn = DateTime.Now; tem.DeletePc = HostService.GetIP(); tem.IsDeleted = true; DetailItem.Add(tem); } } } //***************************************************End Update Operation******************************************** } if (itemMaster.BookingID > 0) { //***************************************************Start Update************************************************ if (MasterItem != null) { GenericFactory_EF_SalBookingMaster.Update(MasterItem); GenericFactory_EF_SalBookingMaster.Save(); } if (DetailItem != null && DetailItem.Count != 0) { GenericFactory_EF_SalBookingDetail.UpdateList(DetailItem.ToList()); GenericFactory_EF_SalBookingDetail.Save(); } if (DetailItems != null && DetailItems.Count != 0) { GenericFactory_EF_SalBookingDetail.InsertList(DetailItems.ToList()); GenericFactory_EF_SalBookingDetail.Save(); } //***************************************************End Update************************************************ } else { //***************************************************Start Save************************************************ if (MasterItem != null) { GenericFactory_EF_SalBookingMaster.Insert(MasterItem); GenericFactory_EF_SalBookingMaster.Save(); GenericFactory_EF_SalBookingMaster.updateMaxID("SalBookingMaster", Convert.ToInt64(MasterId)); GenericFactory_EF_SalBookingMaster.updateCustomCode(menuID, itemMaster.BookingDate, itemMaster.CompanyID, 1, 1); } if (DetailItem != null && DetailItem.Count != 0) { GenericFactory_EF_SalBookingDetail.InsertList(DetailItem.ToList()); GenericFactory_EF_SalBookingDetail.Save(); GenericFactory_EF_SalBookingDetail.updateMaxID("SalBookingDetail", Convert.ToInt64(FirstDigit + "" + (OtherDigits - 1))); } //******************************************************End Save************************************************ } transaction.Complete(); result = MasterItem.BookingNo; } catch (Exception e) { result = ""; e.ToString(); } } else { result = ""; } } return(result); //**************************************************End Main Operation************************************************ }