// public HttpResponseMessage Fundcenter_POManager_Mapping(TEPOFundCenterPOMgrMapping Fund_Managermapping) public HttpResponseMessage Fundcenter_POManager_Mapping(JObject json) { try { int center = 0; int manager = 0; int LastModifiedBy = 0; // if (json["FundCenterId"] != null && json["FundCenterId"].ToString() != "") center = json["FundCenterId"].ToObject <int>(); manager = json["POManagerId"].ToObject <int>(); TEPOFundCenterPOMgrMapping Fund_Managermapping = new TEPOFundCenterPOMgrMapping(); Fund_Managermapping.FundCenterId = center; Fund_Managermapping.CreatedBy = GetLogInUserId(); //Fund_Managermapping.POManagerId = LastModifiedBy; Fund_Managermapping.POManagerId = json["POManagerId"].ToObject <int>(); //TEPOFundCenterPOMgrMapping Fund_Managermapping = new TEPOFundCenterPOMgrMapping(); //int center = json["FundCenterId"].ToObject<int>(); string mesg = ""; if (Fund_Managermapping == null) { mesg = "check object"; return(new HttpResponseMessage() { StatusCode = HttpStatusCode.NoContent, Content = new StringContent(mesg) }); } //Fund_Managermapping.FundCenterId = 1; //Fund_Managermapping.POManagerId = 1; //Fund_Managermapping.LastModifiedOn = DateTime.Now; Fund_Managermapping.CreatedOn = DateTime.Now; Fund_Managermapping.IsDeleted = false; db.TEPOFundCenterPOMgrMappings.Add(Fund_Managermapping); db.SaveChanges(); sinfo.errorcode = 0; sinfo.errormessage = "Successfully Saved"; return(new HttpResponseMessage() { Content = new JsonContent(new { info = sinfo }) }); } catch (Exception e) { ExceptionObj.RecordUnHandledException(e); return(new HttpResponseMessage() { StatusCode = HttpStatusCode.BadRequest, Content = new StringContent(e.Message) }); } }
public HttpResponseMessage SavePlantStorageDetails(TEPOPlantStorageDetail plntstoragedtl) { try { TEProject proj = db.TEProjects.Where(a => a.ProjectID == plntstoragedtl.ProjectID && a.IsDeleted == false).FirstOrDefault(); plntstoragedtl.LastModifiedOn = DateTime.Now; plntstoragedtl.isdeleted = false; if (proj != null) { plntstoragedtl.ProjectName = proj.ProjectName; plntstoragedtl.ProjectCode = proj.ProjectCode; } TEGSTNStateMaster state = db.TEGSTNStateMasters.Where(a => a.StateID == plntstoragedtl.StateID && a.IsDeleted == false).FirstOrDefault(); if (state != null) { plntstoragedtl.StateCode = state.StateCode; plntstoragedtl.StateCodeDescription = state.StateName; } db.TEPOPlantStorageDetails.Add(plntstoragedtl); db.SaveChanges(); sinfo.errorcode = 0; sinfo.errormessage = "Successfully Saved"; return(new HttpResponseMessage() { Content = new JsonContent(new { info = sinfo }) }); } catch (Exception ex) { ExceptionObj.RecordUnHandledException(ex); sinfo.errorcode = 1; sinfo.errormessage = "Fail To Save"; return(new HttpResponseMessage() { Content = new JsonContent(new { info = sinfo }) }); } }
public HttpResponseMessage GetHSNTaxRate(JObject json) { int pagenumber = json["page_number"].ToObject <int>(); int pagepercount = json["pagepercount"].ToObject <int>(); int count = 0; try { var HSNTaxCodeList = (from HSNTx in db.TEPOHSNTaxCodeMappings //join VenCatMast in db.TEPOVendorCategoryMasters on //HSNTx.GSTVendorClassification equals VenCatMast.UniqueID into temp //from tempVenCat in temp.DefaultIfEmpty() join GSTAppMast in db.TEPOGSTApplicabilityMasters on HSNTx.MaterialGSTApplicability equals GSTAppMast.UniqueID into tempMat from tempMatApp in tempMat.DefaultIfEmpty() join GSTVenAppMast in db.TEPOGSTApplicabilityMasters on HSNTx.VendorGSTApplicability equals GSTVenAppMast.UniqueID into tempVen from tempVenApp in tempVen.DefaultIfEmpty() join user in db.UserProfiles on HSNTx.LastModifiedBy equals user.UserId into tempuser from prof in tempuser.DefaultIfEmpty() where HSNTx.IsDeleted == false select new { HSNTx.ApplicableTo, HSNTx.DestinationCountry, HSNTx.VendorRegionDescription, HSNTx.DeliveryPlantRegionDescription, HSNTx.HSNCode, MaterialGSTApplicability = tempMatApp.Description, VendorGSTApplicability = tempVenApp.Description, HSNTx.ValidFrom, HSNTx.ValidTo, HSNTx.TaxType, HSNTx.TaxCode, HSNTx.TaxRate, HSNTx.UniqueID, HSNTx.LastModifiedOn, prof.UserName, HSNTx.IsDeleted }).OrderByDescending(x => x.UniqueID).ToList(); count = HSNTaxCodeList.Count(); if (count > 0) { if (pagenumber == 0) { pagenumber = 1; } int iPageNum = pagenumber; int iPageSize = pagepercount; int start = iPageNum - 1; start = start * iPageSize; var finalResult = HSNTaxCodeList.Skip(start).Take(iPageSize).ToList(); sinfo.errorcode = 0; sinfo.errormessage = "Success"; sinfo.fromrecords = (start == 0) ? 1 : start + 1; sinfo.torecords = finalResult.Count() + start; sinfo.totalrecords = count; sinfo.listcount = finalResult.Count(); sinfo.pages = "1"; if (finalResult.Count() > 0) { sinfo.errorcode = 0; sinfo.errormessage = "Successfully"; return(new HttpResponseMessage() { Content = new JsonContent(new { result = finalResult, info = sinfo }) }); } else { sinfo.errorcode = 0; sinfo.errormessage = "No Records"; sinfo.listcount = 0; return(new HttpResponseMessage() { Content = new JsonContent(new { result = finalResult, info = sinfo }) }); } } else { sinfo.errorcode = 0; sinfo.errormessage = "No Records"; sinfo.listcount = 0; return(new HttpResponseMessage() { Content = new JsonContent(new { result = HSNTaxCodeList, info = sinfo }) }); } } catch (Exception ex) { ExceptionObj.RecordUnHandledException(ex); sinfo.errorcode = 1; sinfo.errormessage = "Fail"; sinfo.listcount = 0; return(new HttpResponseMessage() { Content = new JsonContent(new { info = sinfo }) }); } }