/// <summary> /// Api method to insert PubCenterMaster /// </summary> /// <param name="mobjPubCenter">accepts PubCenterMaster object as paramater </param> /// <returns></returns> public IHttpActionResult InsertPubCenter(PubCenterMaster mobjPubCenter) { string message = ""; try { message = _mobjPubCenterService.DuplicateCheck(mobjPubCenter); if (message == "Y") { if (mobjPubCenter.Id == 0) { IList <ApplicationSetUp> _mobjApplicationSetUpList = _mobjApplicationSetUpRepository.Table.Where(x => x.key == "PubCenterCode" && x.Deactivate == "N").ToList(); var PubCenterSuggesation = _mobjApplicationSetUpList.Select(P => new { PubCenterCodeValue = P.keyValue, Id = P.Id }); mobjPubCenter.PubcenterCode = "PCC" + PubCenterSuggesation.FirstOrDefault().PubCenterCodeValue; mobjPubCenter.PubcenterCode = mobjPubCenter.PubcenterCode.ToString().ToUpper(); _mobjPubCenterService.InsertPubCenter(mobjPubCenter); ApplicationSetUp mobjApplicationSetUp = new ApplicationSetUp(); mobjApplicationSetUp.Id = PubCenterSuggesation.FirstOrDefault().Id; ApplicationSetUp _ApplicationSetUpUpdate = _mobjApplicationSetUpService.GetApplicationSetUpById(mobjApplicationSetUp); _ApplicationSetUpUpdate.Id = PubCenterSuggesation.FirstOrDefault().Id; int Value = Int32.Parse(PubCenterSuggesation.FirstOrDefault().PubCenterCodeValue) + 1; _ApplicationSetUpUpdate.keyValue = Value.ToString().PadLeft(4, '0'); _ApplicationSetUpUpdate.ModifiedBy = mobjPubCenter.EnteredBy; _ApplicationSetUpUpdate.ModifiedDate = DateTime.Now; _mobjApplicationSetUpService.UpdateApplication(_ApplicationSetUpUpdate); message = _mobjLocalizationService.GetResource("Master.API.Success.Message"); } else { PubCenterMaster _PubCenter = _mobjPubCenterService.GetPubCenterById(mobjPubCenter); _PubCenter.PublishingCompanyid = mobjPubCenter.PublishingCompanyid; _PubCenter.CenterName = mobjPubCenter.CenterName; _PubCenter.ContactPerson = mobjPubCenter.ContactPerson; _PubCenter.PublishingCompanyDivision = mobjPubCenter.PublishingCompanyDivision; _PubCenter.Address = mobjPubCenter.Address; _PubCenter.CountryId = mobjPubCenter.CountryId; _PubCenter.Stateid = mobjPubCenter.Stateid; _PubCenter.Cityid = mobjPubCenter.Cityid; _PubCenter.Pincode = mobjPubCenter.Pincode; _PubCenter.Phone = mobjPubCenter.Phone; _PubCenter.Mobile = mobjPubCenter.Mobile; _PubCenter.Email = mobjPubCenter.Email; _PubCenter.Fax = mobjPubCenter.Fax; _PubCenter.ModifiedBy = mobjPubCenter.EnteredBy; _PubCenter.ModifiedDate = DateTime.Now; _mobjPubCenterService.UpdatePubCenter(_PubCenter); message = _mobjLocalizationService.GetResource("Master.API.Success.Message"); } } else { message = "Duplicate"; } } catch (ACSException ex) { //message = ex.InnerException.Message; _mobjLoggerService.Error(ex.InnerException.Message, ex); message = _mobjLocalizationService.GetResource("Common.API.Exception.Message"); } catch (Exception ex) { //message = ex.InnerException.Message; _mobjLoggerService.Error(ex.InnerException.Message, ex); message = _mobjLocalizationService.GetResource("Common.API.Exception.Message"); } return(Json(message)); }
/// <summary> /// Api method to insert CopyRightHolderMaster /// </summary> /// <param name="mobjCopyrightHolder">accepts CopyRightHolderMaster object as paramater </param> /// <returns></returns> public IHttpActionResult InsertCopyrightHolder(CopyRightHolderMaster mobjCopyrightHolder) { string message = ""; try { message = _mobjCopyrightHolderService.DuplicateCheck(mobjCopyrightHolder); if (message == "Y") { if (mobjCopyrightHolder.Id == 0) { IList <ApplicationSetUp> _mobjApplicationSetUpList = _mobjApplicationSetUpRepository.Table.Where(x => x.key == "CopyrightHolderCode" && x.Deactivate == "N").ToList(); var CopyrightHolderSuggesation = _mobjApplicationSetUpList.Select(P => new { CopyrightHolderCodeValue = P.keyValue, Id = P.Id }); mobjCopyrightHolder.CopyRightHolderCode = "CR" + mobjCopyrightHolder.CopyRightHolderName.Substring(0, 1).ToString() + CopyrightHolderSuggesation.FirstOrDefault().CopyrightHolderCodeValue; mobjCopyrightHolder.CopyRightHolderCode = mobjCopyrightHolder.CopyRightHolderCode.ToString().ToUpper(); _mobjCopyrightHolderService.InsertCopyrightHolder(mobjCopyrightHolder); ApplicationSetUp mobjApplicationSetUp = new ApplicationSetUp(); mobjApplicationSetUp.Id = CopyrightHolderSuggesation.FirstOrDefault().Id; ApplicationSetUp _ApplicationSetUpUpdate = _mobjApplicationSetUpService.GetApplicationSetUpById(mobjApplicationSetUp); _ApplicationSetUpUpdate.Id = CopyrightHolderSuggesation.FirstOrDefault().Id; int Value = Int32.Parse(CopyrightHolderSuggesation.FirstOrDefault().CopyrightHolderCodeValue) + 1; _ApplicationSetUpUpdate.keyValue = Value.ToString().PadLeft(4, '0'); _ApplicationSetUpUpdate.ModifiedBy = mobjCopyrightHolder.EnteredBy; _ApplicationSetUpUpdate.ModifiedDate = DateTime.Now; _mobjApplicationSetUpService.UpdateApplication(_ApplicationSetUpUpdate); message = _mobjLocalizationService.GetResource("Master.API.Success.Message"); } else { CopyRightHolderMaster _CopyrightHolder = _mobjCopyrightHolderService.GetCopyrightHolderById(mobjCopyrightHolder); _CopyrightHolder.CopyRightHolderName = mobjCopyrightHolder.CopyRightHolderName; _CopyrightHolder.ContactPerson = mobjCopyrightHolder.ContactPerson; _CopyrightHolder.Address = mobjCopyrightHolder.Address; _CopyrightHolder.CountryId = mobjCopyrightHolder.CountryId; _CopyrightHolder.Stateid = mobjCopyrightHolder.Stateid; _CopyrightHolder.Cityid = mobjCopyrightHolder.Cityid; _CopyrightHolder.Pincode = mobjCopyrightHolder.Pincode; _CopyrightHolder.Mobile = mobjCopyrightHolder.Mobile; _CopyrightHolder.Email = mobjCopyrightHolder.Email; _CopyrightHolder.URL = mobjCopyrightHolder.URL; _CopyrightHolder.BankName = mobjCopyrightHolder.BankName; _CopyrightHolder.AccountNo = mobjCopyrightHolder.AccountNo; _CopyrightHolder.BankAddress = mobjCopyrightHolder.BankAddress; _CopyrightHolder.IFSCCode = mobjCopyrightHolder.IFSCCode; _CopyrightHolder.PANNo = mobjCopyrightHolder.PANNo; _CopyrightHolder.VendorCOde = mobjCopyrightHolder.VendorCOde; _CopyrightHolder.ModifiedBy = mobjCopyrightHolder.EnteredBy; _CopyrightHolder.ModifiedDate = DateTime.Now; _mobjCopyrightHolderService.UpdateCopyrightHolder(_CopyrightHolder); message = _mobjLocalizationService.GetResource("Master.API.Success.Message"); } } else { message = "Duplicate"; } } catch (ACSException ex) { //message = ex.InnerException.Message; _mobjLoggerService.Error(ex.InnerException.Message, ex); message = _mobjLocalizationService.GetResource("Common.API.Exception.Message"); } catch (Exception ex) { //message = ex.InnerException.Message; _mobjLoggerService.Error(ex.InnerException.Message, ex); message = _mobjLocalizationService.GetResource("Common.API.Exception.Message"); } return(Json(message)); }
public IHttpActionResult InsertOtherContract(Contract_Signed_By_Executive OtherContract) { string status = ""; int OtherContractIdId = 0; string OtherContactCode = string.Empty; try { //if (status == "Y") //{ if (OtherContract.Id == 0) { IList <ApplicationSetUp> _ApplicationSetUpList = _ApplicationSetUp.Table.Where(x => x.key == "Other Contract" && x.Deactivate == "N").ToList(); var OtherContractSuggesation = _ApplicationSetUpList.Select(Au => new { OtherContractValue = Au.keyValue, Id = Au.Id }); IList <ContractType> _ContractTypeList = _ContractType.Table.Where(x => x.Id == OtherContract.Contracttypeid && x.Deactivate == "N").ToList(); var ContractType = _ContractTypeList.Select(CT => new { ContractName = CT.ContractName }); OtherContractMaster _OtherContract = new OtherContractMaster(); string stringTokens = ContractType.FirstOrDefault().ContractName; string strVlaue = string.Empty; string[] words; if (stringTokens.Contains("-")) { words = stringTokens.Split('-'); } else { words = stringTokens.Split(' '); } foreach (string word in words) { strVlaue += word.FirstOrDefault(); } _OtherContract.othercontractcode = "OC" + strVlaue.ToString() + OtherContractSuggesation.FirstOrDefault().OtherContractValue; _OtherContract.othercontractcode = _OtherContract.othercontractcode.ToString().ToUpper(); OtherContactCode = _OtherContract.othercontractcode.ToString().ToUpper(); _OtherContract.partyname = OtherContract.partyname; _OtherContract.natureofserviceid = OtherContract.natureofserviceid; _OtherContract.natureofsubserviceid = OtherContract.natureofsubserviceid; _OtherContract.Address = OtherContract.Address; _OtherContract.CountryId = OtherContract.CountryId; _OtherContract.OtherCountry = OtherContract.OtherCountry; _OtherContract.Stateid = OtherContract.Stateid; _OtherContract.OtherState = OtherContract.OtherState; _OtherContract.Cityid = OtherContract.Cityid; _OtherContract.OtherCity = OtherContract.OtherCity; _OtherContract.Pincode = OtherContract.Pincode; _OtherContract.Mobile = OtherContract.Mobile; _OtherContract.Email = OtherContract.Email; _OtherContract.PANNo = OtherContract.PANNo; _OtherContract.Requestdate = OtherContract.Requestdate; _OtherContract.ProjectTitle = OtherContract.ProjectTitle; _OtherContract.ProjectISBN = OtherContract.ProjectISBN; _OtherContract.Contracttypeid = OtherContract.Contracttypeid; // _OtherContract.ContractDate = OtherContract.ContractDate; // _OtherContract.Periodofagreement = OtherContract.Periodofagreement; // _OtherContract.Expirydate = OtherContract.Expirydate; _OtherContract.Territoryrightsid = OtherContract.Territoryrightsid; _OtherContract.Payment = OtherContract.Payment; _OtherContract.paymentperiodid = OtherContract.paymentperiodid; _OtherContract.NatureOfWork = OtherContract.NatureOfWork; // _OtherContract.divisionid = OtherContract.divisionid; _OtherContract.ContractSignedByExecutiveid = OtherContract.ContractSignedByExecutiveid; _OtherContract.Remarks = OtherContract.Remarks; _OtherContract.EnteredBy = OtherContract.EnteredBy; _OtherContract.PaymentAmount = OtherContract.PaymentAmount; _OtherContract.CurrencyMasterId = OtherContract.CurrencyMasterId; OtherContractIdId = _OtherContractService.InsertOtherContract(_OtherContract); if (OtherContractIdId != 0) { OtherContractDivisionLink DivisionLink = new OtherContractDivisionLink(); int k = 0; foreach (var item in OtherContract.Division) { DivisionLink.othercontractid = OtherContractIdId; DivisionLink.divisionid = item; DivisionLink.EnteredBy = OtherContract.EnteredBy; _OtherContractService.InsertOtherContractDivisionLink(DivisionLink); k++; } OtherContractDocuments _OtherContractDoc = new OtherContractDocuments(); string[] docurl = OtherContract.documentfile.Split(','); int i = 0; foreach (string doc in OtherContract.Documentname) { OtherContractDocuments Link = new OtherContractDocuments(); Link.othercontractid = OtherContractIdId; Link.Documentname = doc; Link.documentfile = docurl[i]; Link.EnteredBy = OtherContract.EnteredBy; _OtherContractService.InsertOtherContractDocumentsLinking(Link); i++; } if (OtherContract.ForImageBank == "1") { /* Added by dheeraj Kumar sharma */ OtherContractImageBank _OtherContractImageBank = new OtherContractImageBank(); IList <VideoImageBank> ImageBankList = new List <VideoImageBank>(); if (OtherContract.VideoImageBank.Count > 0) { foreach (var obj in OtherContract.VideoImageBank) { VideoImageBank obj_VideoImageBank = new VideoImageBank(); obj_VideoImageBank.Type = obj.Type; obj_VideoImageBank.ShortName = obj.ShortName; obj_VideoImageBank.Fullname = obj.Fullname; obj_VideoImageBank.CurrencyId = obj.CurrencyId; obj_VideoImageBank.Cost = obj.Cost; obj_VideoImageBank.Deactivate = "N"; obj_VideoImageBank.EnteredBy = OtherContract.EnteredBy; obj_VideoImageBank.EntryDate = DateTime.Now; ImageBankList.Add(obj_VideoImageBank); } } _OtherContractImageBank.VideoImageBank = ImageBankList; /*End by dheeraj*/ _OtherContractImageBank.Printrunquantity = OtherContract.Printrunquantity; _OtherContractImageBank.PrintRights = OtherContract.PrintRights; _OtherContractImageBank.electronicrights = OtherContract.electronicrights; _OtherContractImageBank.ebookrights = OtherContract.ebookrights; _OtherContractImageBank.cost = OtherContract.cost; _OtherContractImageBank.currencyid = OtherContract.currencyid; _OtherContractImageBank.restriction = OtherContract.restriction; _OtherContractImageBank.othercontractid = OtherContractIdId; _OtherContractImageBank.EnteredBy = OtherContract.EnteredBy; _OtherContractService.InsertOtherContractImageBank(_OtherContractImageBank); } } OtherContractLink _OtherContractLink1 = new OtherContractLink(); _OtherContractLink1.Contractstatus = null; _OtherContractLink1.SignedContractSentDate = null; _OtherContractLink1.SignedContractReceived_Date = null; _OtherContractLink1.CancellationDate = null; _OtherContractLink1.Cancellation_Reason = null; _OtherContractLink1.othercontractid = OtherContractIdId; _OtherContractLink1.Status = "Pending"; _OtherContractLink1.EnteredBy = OtherContract.EnteredBy; _OtherContractLink1.Remarks = OtherContract.PendingRemarks; int OtherContractLinkIdId = _OtherContractService.InsertOtherContractLink(_OtherContractLink1); ApplicationSetUp Mobj_ApplicationSetUp = new ApplicationSetUp(); Mobj_ApplicationSetUp.Id = OtherContractSuggesation.FirstOrDefault().Id; ApplicationSetUp _ApplicationSetUpUpdate = _ApplicationSetUpService.GetApplicationSetUpById(Mobj_ApplicationSetUp); _ApplicationSetUpUpdate.Id = OtherContractSuggesation.FirstOrDefault().Id; int Value = Int32.Parse(OtherContractSuggesation.FirstOrDefault().OtherContractValue) + 1; _ApplicationSetUpUpdate.keyValue = Value.ToString().PadLeft(4, '0'); _ApplicationSetUpUpdate.ModifiedBy = OtherContract.EnteredBy; _ApplicationSetUpUpdate.ModifiedDate = DateTime.Now; _ApplicationSetUpService.UpdateApplication(_ApplicationSetUpUpdate); } else { if (OtherContract.UpdateRight == "rt" || OtherContract.UpdateRight == "fc") { OtherContractLink mobj_OtherContractLink = _OtherContractLink.Table.Where(i => i.othercontractid == OtherContract.Id && i.Deactivate == "N").FirstOrDefault(); if (mobj_OtherContractLink != null) { mobj_OtherContractLink.Contractstatus = OtherContract.Contractstatus; mobj_OtherContractLink.SignedContractSentDate = OtherContract.SignedContractSentDate; mobj_OtherContractLink.SignedContractReceived_Date = OtherContract.SignedContractReceived_Date; mobj_OtherContractLink.CancellationDate = OtherContract.CancellationDate; mobj_OtherContractLink.Cancellation_Reason = OtherContract.Cancellation_Reason; mobj_OtherContractLink.othercontractid = OtherContract.Id; mobj_OtherContractLink.ModifiedBy = OtherContract.EnteredBy; mobj_OtherContractLink.Status = OtherContract.Contractstatus; mobj_OtherContractLink.Remarks = OtherContract.PendingRemarks; mobj_OtherContractLink.AgreementDate = OtherContract.AgreementDate; mobj_OtherContractLink.Effectivedate = OtherContract.Effectivedate; //mobj_OtherContractLink.Contractperiodinmonth = OtherContract.Contractperiodinmonth; mobj_OtherContractLink.Expirydate = OtherContract.Expirydate; _OtherContractService.UpdateOtherContractLink(mobj_OtherContractLink); OtherContractLinkDocument _OtherContractDocLink = new OtherContractLinkDocument(); string[] docurl1 = OtherContract.documentfileLink.Split(','); int i = 0; foreach (string doc in OtherContract.DocumentnameLink) { OtherContractLinkDocument Link = new OtherContractLinkDocument(); Link.othercontractLinkid = mobj_OtherContractLink.Id; Link.DocumentnameLink = doc; Link.documentfileLink = docurl1[i]; Link.EnteredBy = OtherContract.EnteredBy; _OtherContractService.InsertOtherContractDocumentsLinkingLink(Link); i++; } } } else if (OtherContract.UpdateRight == "ad" || OtherContract.UpdateRight == "sa") { OtherContractMaster mobj_OtherDocument = _OtherContractService.GetOtherContractMasterId(OtherContract.Id); mobj_OtherDocument.partyname = OtherContract.partyname; mobj_OtherDocument.natureofserviceid = OtherContract.natureofserviceid; mobj_OtherDocument.natureofsubserviceid = OtherContract.natureofsubserviceid; mobj_OtherDocument.Address = OtherContract.Address; mobj_OtherDocument.CountryId = OtherContract.CountryId; mobj_OtherDocument.OtherCountry = OtherContract.OtherCountry; mobj_OtherDocument.Stateid = OtherContract.Stateid; mobj_OtherDocument.OtherState = OtherContract.OtherState; mobj_OtherDocument.Cityid = OtherContract.Cityid; mobj_OtherDocument.OtherCity = OtherContract.OtherCity; mobj_OtherDocument.Pincode = OtherContract.Pincode; mobj_OtherDocument.Mobile = OtherContract.Mobile; mobj_OtherDocument.Email = OtherContract.Email; mobj_OtherDocument.PANNo = OtherContract.PANNo; mobj_OtherDocument.Requestdate = OtherContract.Requestdate; mobj_OtherDocument.ProjectTitle = OtherContract.ProjectTitle; mobj_OtherDocument.ProjectISBN = OtherContract.ProjectISBN; mobj_OtherDocument.Contracttypeid = OtherContract.Contracttypeid; // mobj_OtherDocument.ContractDate = OtherContract.ContractDate; // mobj_OtherDocument.Periodofagreement = OtherContract.Periodofagreement; // mobj_OtherDocument.Expirydate = OtherContract.Expirydate; mobj_OtherDocument.Territoryrightsid = OtherContract.Territoryrightsid; mobj_OtherDocument.Payment = OtherContract.Payment; mobj_OtherDocument.paymentperiodid = OtherContract.paymentperiodid; mobj_OtherDocument.NatureOfWork = OtherContract.NatureOfWork; // mobj_OtherDocument.divisionid = OtherContract.divisionid; mobj_OtherDocument.ContractSignedByExecutiveid = OtherContract.ContractSignedByExecutiveid; mobj_OtherDocument.Remarks = OtherContract.Remarks; mobj_OtherDocument.ModifiedBy = OtherContract.EnteredBy; mobj_OtherDocument.PaymentAmount = OtherContract.PaymentAmount; mobj_OtherDocument.CurrencyMasterId = OtherContract.CurrencyMasterId; _OtherContractService.UpdateOtherContractMaster(mobj_OtherDocument); _OtherContractService.DeleteOtherContractDivisionLink(OtherContract.Id, OtherContract.EnteredBy); OtherContractDivisionLink DivisionLink = new OtherContractDivisionLink(); int k = 0; foreach (var item in OtherContract.Division) { DivisionLink.othercontractid = OtherContract.Id; DivisionLink.divisionid = item; DivisionLink.EnteredBy = OtherContract.EnteredBy; _OtherContractService.InsertOtherContractDivisionLink(DivisionLink); k++; } OtherContractImageBank mobj_OtherContractImageBank = _OtherContractImageBank.Table.Where(i => i.othercontractid == OtherContract.Id && i.Deactivate == "N").FirstOrDefault(); if (mobj_OtherContractImageBank != null) { _OtherContractService.DeleteVideoImageBankLink(mobj_OtherContractImageBank.Id, OtherContract.EnteredBy); if (OtherContract.VideoImageBank.Count > 0) { int m = 0; foreach (var obj in OtherContract.VideoImageBank) { VideoImageBank obj_VideoImageBank = new VideoImageBank(); obj_VideoImageBank.Type = obj.Type; obj_VideoImageBank.ShortName = obj.ShortName; obj_VideoImageBank.Fullname = obj.Fullname; obj_VideoImageBank.CurrencyId = obj.CurrencyId; obj_VideoImageBank.Cost = obj.Cost; obj_VideoImageBank.ImageBankId = mobj_OtherContractImageBank.Id; obj_VideoImageBank.EnteredBy = OtherContract.EnteredBy; obj_VideoImageBank.EntryDate = DateTime.Now; obj_VideoImageBank.Deactivate = "N"; _OtherContractService.InsertVideoImageBankLink(obj_VideoImageBank); m++; } } mobj_OtherContractImageBank.Printrunquantity = OtherContract.Printrunquantity; mobj_OtherContractImageBank.PrintRights = OtherContract.PrintRights; mobj_OtherContractImageBank.electronicrights = OtherContract.electronicrights; mobj_OtherContractImageBank.ebookrights = OtherContract.ebookrights; mobj_OtherContractImageBank.cost = OtherContract.cost; mobj_OtherContractImageBank.currencyid = OtherContract.currencyid; mobj_OtherContractImageBank.restriction = OtherContract.restriction; mobj_OtherContractImageBank.othercontractid = OtherContract.Id; mobj_OtherContractImageBank.ModifiedBy = OtherContract.EnteredBy; _OtherContractService.UpdateOtherContractImageBank(mobj_OtherContractImageBank); } else if (OtherContract.ForImageBank == "1") { //OtherContractImageBank _OtherConImageBank = new OtherContractImageBank(); //_OtherConImageBank.Printrunquantity = OtherContract.Printrunquantity; //_OtherConImageBank.PrintRights = OtherContract.PrintRights; //_OtherConImageBank.electronicrights = OtherContract.electronicrights; //_OtherConImageBank.ebookrights = OtherContract.ebookrights; //_OtherConImageBank.cost = OtherContract.cost; //_OtherConImageBank.currencyid = OtherContract.currencyid; //_OtherConImageBank.restriction = OtherContract.restriction; //_OtherConImageBank.othercontractid = OtherContract.Id; //_OtherConImageBank.EnteredBy = OtherContract.EnteredBy; //_OtherContractService.InsertOtherContractImageBank(_OtherConImageBank); OtherContractImageBank _OtherConImageBank = new OtherContractImageBank(); IList <VideoImageBank> ImageBankList = new List <VideoImageBank>(); if (OtherContract.VideoImageBank.Count > 0) { foreach (var obj in OtherContract.VideoImageBank) { VideoImageBank obj_VideoImageBank = new VideoImageBank(); obj_VideoImageBank.Type = obj.Type; obj_VideoImageBank.ShortName = obj.ShortName; obj_VideoImageBank.Fullname = obj.Fullname; obj_VideoImageBank.CurrencyId = obj.CurrencyId; obj_VideoImageBank.Cost = obj.Cost; obj_VideoImageBank.Deactivate = "N"; obj_VideoImageBank.EnteredBy = OtherContract.EnteredBy; obj_VideoImageBank.EntryDate = DateTime.Now; ImageBankList.Add(obj_VideoImageBank); } } _OtherConImageBank.VideoImageBank = ImageBankList; /*End by dheeraj*/ _OtherConImageBank.Printrunquantity = OtherContract.Printrunquantity; _OtherConImageBank.PrintRights = OtherContract.PrintRights; _OtherConImageBank.electronicrights = OtherContract.electronicrights; _OtherConImageBank.ebookrights = OtherContract.ebookrights; _OtherConImageBank.cost = OtherContract.cost; _OtherConImageBank.currencyid = OtherContract.currencyid; _OtherConImageBank.restriction = OtherContract.restriction; _OtherConImageBank.othercontractid = OtherContract.Id; _OtherConImageBank.EnteredBy = OtherContract.EnteredBy; _OtherContractService.InsertOtherContractImageBank(_OtherConImageBank); } OtherContractDocuments _OtherContractDoc = new OtherContractDocuments(); string[] docurl = OtherContract.documentfile.Split(','); int j = 0; foreach (string doc in OtherContract.Documentname) { OtherContractDocuments Link = new OtherContractDocuments(); Link.othercontractid = OtherContract.Id; Link.Documentname = doc; Link.documentfile = docurl[j]; Link.EnteredBy = OtherContract.EnteredBy; _OtherContractService.InsertOtherContractDocumentsLinking(Link); j++; } OtherContractLink mobj_OtherContractLink = _OtherContractLink.Table.Where(i => i.othercontractid == OtherContract.Id && i.Deactivate == "N").FirstOrDefault(); if (mobj_OtherContractLink != null) { mobj_OtherContractLink.Contractstatus = OtherContract.Contractstatus; mobj_OtherContractLink.SignedContractSentDate = OtherContract.SignedContractSentDate; mobj_OtherContractLink.SignedContractReceived_Date = OtherContract.SignedContractReceived_Date; mobj_OtherContractLink.CancellationDate = OtherContract.CancellationDate; mobj_OtherContractLink.Cancellation_Reason = OtherContract.Cancellation_Reason; mobj_OtherContractLink.othercontractid = OtherContract.Id; mobj_OtherContractLink.ModifiedBy = OtherContract.EnteredBy; mobj_OtherContractLink.Status = OtherContract.Contractstatus; mobj_OtherContractLink.Remarks = OtherContract.PendingRemarks; mobj_OtherContractLink.AgreementDate = OtherContract.AgreementDate; mobj_OtherContractLink.Effectivedate = OtherContract.Effectivedate; //mobj_OtherContractLink.Contractperiodinmonth = OtherContract.Contractperiodinmonth; mobj_OtherContractLink.Expirydate = OtherContract.Expirydate; _OtherContractService.UpdateOtherContractLink(mobj_OtherContractLink); OtherContractLinkDocument _OtherContractDocLink = new OtherContractLinkDocument(); string[] docurl1 = OtherContract.documentfileLink.Split(','); int i = 0; foreach (string doc in OtherContract.DocumentnameLink) { OtherContractLinkDocument Link = new OtherContractLinkDocument(); Link.othercontractLinkid = mobj_OtherContractLink.Id; Link.DocumentnameLink = doc; Link.documentfileLink = docurl1[i]; Link.EnteredBy = OtherContract.EnteredBy; _OtherContractService.InsertOtherContractDocumentsLinkingLink(Link); i++; } } } //------------------------------------------- OtherContractIdId = OtherContract.Id; OtherContactCode = _OtherContractMaster.Table.Where(a => a.Id == OtherContract.Id).Select(b => b.othercontractcode).SingleOrDefault(); } status = _localizationService.GetResource("Master.API.Success.Message"); } catch (ACSException ex) { status = ex.ToString(); } catch (Exception ex) { status = ex.ToString(); } return(Json(SerializeObj.SerializeObject(new { status, OtherContactCode, OtherContractIdId }))); }
/// <summary> /// Api method to insert LicenseeMaster /// </summary> /// <param name="mobjLicensee">accepts LicenseeMaster object as paramater </param> /// <returns></returns> public IHttpActionResult InsertLicensee(LicenseeMaster mobjLicensee) { string message = ""; try { message = _mobjLicenseeService.DuplicateCheck(mobjLicensee); if (message == "Y") { if (mobjLicensee.Id == 0) { IList <ApplicationSetUp> _mobjApplicationSetUpList = _mobjApplicationSetUpRepository.Table.Where(x => x.key == "LicenseeCode" && x.Deactivate == "N").ToList(); var LicenseeSuggesation = _mobjApplicationSetUpList.Select(P => new { LicenseeCodeValue = P.keyValue, Id = P.Id }); mobjLicensee.Licenseecode = "LC" + mobjLicensee.OrganizationName.Substring(0, 1).ToString() + LicenseeSuggesation.FirstOrDefault().LicenseeCodeValue; mobjLicensee.Licenseecode = mobjLicensee.Licenseecode.ToString().ToUpper(); _mobjLicenseeService.InsertLicensee(mobjLicensee); ApplicationSetUp mobjApplicationSetUp = new ApplicationSetUp(); mobjApplicationSetUp.Id = LicenseeSuggesation.FirstOrDefault().Id; ApplicationSetUp _ApplicationSetUpUpdate = _mobjApplicationSetUpService.GetApplicationSetUpById(mobjApplicationSetUp); _ApplicationSetUpUpdate.Id = LicenseeSuggesation.FirstOrDefault().Id; int Value = Int32.Parse(LicenseeSuggesation.FirstOrDefault().LicenseeCodeValue) + 1; _ApplicationSetUpUpdate.keyValue = Value.ToString().PadLeft(4, '0'); _ApplicationSetUpUpdate.ModifiedBy = mobjLicensee.EnteredBy; _ApplicationSetUpUpdate.ModifiedDate = DateTime.Now; _mobjApplicationSetUpService.UpdateApplication(_ApplicationSetUpUpdate); message = _mobjLocalizationService.GetResource("Master.API.Success.Message"); } else { LicenseeMaster _Licensee = _mobjLicenseeService.GetLicenseeById(mobjLicensee); _Licensee.OrganizationName = mobjLicensee.OrganizationName; _Licensee.ContactPerson = mobjLicensee.ContactPerson; _Licensee.Address = mobjLicensee.Address; _Licensee.CountryId = mobjLicensee.CountryId; _Licensee.Stateid = mobjLicensee.Stateid; _Licensee.Cityid = mobjLicensee.Cityid; _Licensee.Pincode = mobjLicensee.Pincode; _Licensee.Mobile = mobjLicensee.Mobile; _Licensee.Email = mobjLicensee.Email; _Licensee.URL = mobjLicensee.URL; _Licensee.ModifiedBy = mobjLicensee.EnteredBy; _Licensee.ModifiedDate = DateTime.Now; _mobjLicenseeService.UpdateLicensee(_Licensee); message = _mobjLocalizationService.GetResource("Master.API.Success.Message"); } } else { message = "Duplicate"; } } catch (ACSException ex) { //message = ex.InnerException.Message; _mobjLoggerService.Error(ex.InnerException.Message, ex); message = _mobjLocalizationService.GetResource("Common.API.Exception.Message"); } catch (Exception ex) { //message = ex.InnerException.Message; _mobjLoggerService.Error(ex.InnerException.Message, ex); message = _mobjLocalizationService.GetResource("Common.API.Exception.Message"); } return(Json(message)); }
public IHttpActionResult InsertPublishingCompany(PublishingCompanyMaster _publishingCompany) { string status = string.Empty; try { status = _publishingCompanyService.DuplicityCheck(_publishingCompany); if (status == "Y") { if (_publishingCompany.Id == 0) { IList <ApplicationSetUp> _mobjApplicationSetUpList = _mobjApplicationSetUpRepository.Table.Where(x => x.key == "PublishingCompanyCode" && x.Deactivate == "N").ToList(); var PublishingCompanySuggesation = _mobjApplicationSetUpList.Select(P => new { PublishingCompanyCodeValue = P.keyValue, Id = P.Id }); _publishingCompany.PublishingCompanyCode = "PCM" + PublishingCompanySuggesation.FirstOrDefault().PublishingCompanyCodeValue; _publishingCompany.PublishingCompanyCode = _publishingCompany.PublishingCompanyCode.ToString().ToUpper(); _publishingCompanyService.InsertPublishingCompany(_publishingCompany); ApplicationSetUp mobjApplicationSetUp = new ApplicationSetUp(); mobjApplicationSetUp.Id = PublishingCompanySuggesation.FirstOrDefault().Id; ApplicationSetUp _ApplicationSetUpUpdate = _mobjApplicationSetUpService.GetApplicationSetUpById(mobjApplicationSetUp); _ApplicationSetUpUpdate.Id = PublishingCompanySuggesation.FirstOrDefault().Id; int Value = Int32.Parse(PublishingCompanySuggesation.FirstOrDefault().PublishingCompanyCodeValue) + 1; _ApplicationSetUpUpdate.keyValue = Value.ToString().PadLeft(4, '0'); _ApplicationSetUpUpdate.ModifiedBy = _publishingCompany.EnteredBy; _ApplicationSetUpUpdate.ModifiedDate = DateTime.Now; _mobjApplicationSetUpService.UpdateApplication(_ApplicationSetUpUpdate); } else { PublishingCompanyMaster objPublishingCompany = _publishingCompanyService.GetPublishingCompanyById(_publishingCompany); objPublishingCompany.CompanyName = _publishingCompany.CompanyName; objPublishingCompany.ContactPerson = _publishingCompany.ContactPerson; objPublishingCompany.Address = _publishingCompany.Address; objPublishingCompany.Email = _publishingCompany.Email; objPublishingCompany.Phone = _publishingCompany.Phone; objPublishingCompany.Mobile = _publishingCompany.Mobile; objPublishingCompany.Website = _publishingCompany.Website; objPublishingCompany.CountryId = _publishingCompany.CountryId; objPublishingCompany.OtherCountry = _publishingCompany.OtherCountry; objPublishingCompany.Stateid = _publishingCompany.Stateid; objPublishingCompany.OtherState = _publishingCompany.OtherState; objPublishingCompany.Cityid = _publishingCompany.Cityid; objPublishingCompany.OtherCity = _publishingCompany.OtherCity; objPublishingCompany.Pincode = _publishingCompany.Pincode; objPublishingCompany.ModifiedBy = _publishingCompany.EnteredBy; objPublishingCompany.ModifiedDate = System.DateTime.Now; _publishingCompanyService.UpdatePublishingCompany(objPublishingCompany); } status = _localizationService.GetResource("Master.API.Success.Message"); } else { status = "Duplicate"; } } catch (ACSException ex) { status = ex.InnerException.Message; } catch (Exception ex) { status = ex.InnerException.Message; } return(Json(status)); }