Hi All,
I have a code below in asp.net but i dont want to write this code in asp.net instead of this i want to write this in STPRED PROCEDURE.I am very much new to SP.Can u please help
I have a table by name MODEL_CEPT(CUST_ID int,MODEL_ID int)
Here i have to insert the values to MODEL_CEPT table only when the CUST_CODE from customer table must be equal to MODEL_CEPT of CUST CODE and the same for MODEL also if MODEL code from MODEL table must be equal to MODEL CODE from MODEL CEPT then i have to get CUST ID and MODEL ID from the above conditions CUST_ID and MODEL_ID are available in the CUSTOMER and MODEL table .If both MODEL ID and CUST ID exists in MODEL CEPT then it has to display "Records exist" if does not exist then have to "INSERT" to the MODEL CEPT table. The below code helps for the STORED PROCEDURE to understand
if (objEntity.CUSTOMERs.Where(C => C.CUST_CODE == ModelCept.Cust_Code).Count() > 0)
{
if (objEntity.MODELs.Where(M => M.MODEL_CODE == ModelCept.Model_Code).Count() > 0)
{
int CUST_ID = objEntity.CUSTOMERs.Where(C => C.CUST_CODE == ModelCept.Cust_Code).Select(C => C.CUST_ID).First();
int MODEL_ID = objEntity.MODELs.Where(M => M.MODEL_CODE == ModelCept.Model_Code).Select(M => M.MODEL_ID).First();
if (objEntity.MODEL_CEPT.Where(MC => MC.CUST_ID == CUST_ID && MC.MODEL_ID == MODEL_ID).Count()> 0)
{
szStatus = "Existing Record";
}
else
{
szStatus = "New Record";
}
}
else
{
szStatus = "Model not exists in Model Master";
}
}
else
{
szStatus = "Customer not exists in Customer Master";
}