public ActionResult IDFRequest(IDFRequestVM idf, HttpPostedFileBase[] file) { IDFRequestVM model = new IDFRequestVM(); ViewBag.Idftype = PatentIS.IDFTypeList(); ViewBag.pitype = PatentIS.GetPatentInventorType(); ViewBag.dept = PatentIS.DepartmentList(); model.ListAction = PatentIS.ActionList(); model.TMListAction = PatentIS.TMActionList(); model.CRListAction = PatentIS.CRActionList(); model.DPListAction = PatentIS.DesignActionList(); model.Annex.ListStage = PatentIS.StageList(); model.Annex.ListIndustry = PatentIS.IndustryList(); model.Annex.ListIndustry1 = PatentIS.IndustryList1(); model.Annex.IITMode = PatentIS.CommericaliseMode(); model.Annex.JointMode = PatentIS.CommericaliseMode1(); model.Trade.Catlist = PatentIS.TMCategory(); model.DesignClass.ClassList = PatentIS.DPClass(); ViewBag.CRCat = PatentIS.CRCategory(); ViewBag.Nature = PatentIS.CRNature(); ViewBag.CRClass = PatentIS.CRClass(); if (idf.IDFType == "Trademark") { idf.RequestedAction = idf.RequestedTMAction; } else if (idf.IDFType == "Copyright") { idf.RequestedAction = idf.RequestedCRAction; } else if (idf.IDFType == "DesignPatent") { idf.RequestedAction = idf.RequestedDPAction; } if (idf.isDraft == "Form") { if (idf.formUpdate == false) { var seqno = Convert.ToInt64(PatentIS.GetNewFileNo()); if (seqno > 0) { seqno += 1; idf.FileNo = seqno; string IIDF = PatentService.InsertIDFRequest(idf, file, User.Identity.Name); if (IIDF == "Success") { ViewBag.succMsg = "Your request has been created successfully with IDF Number - " + idf.FileNo + "."; if (idf.DraftNo != null) { bool draft = PatentService.DeleteDraft(idf.DraftNo); } //MailMessage mail = new MailMessage(); //mail.To.Add("*****@*****.**"); //mail.From = new MailAddress("*****@*****.**"); //mail.Subject= "Your request has been created successfully with IDF Number - " + idf.FileNo + "."; //mail.Body = "Trial"; //TempData["FileNo"] = idf.FileNo; //var report = new PatentISController().IDFReport(); } else { ViewBag.errMsg = IIDF; } } else { ViewBag.errMsg = "Error Connecting Database.Kindly Contact ICSR Computer Section -9741"; } } else { string IIDF = PatentService.UpdateIDFRequest(idf, file, User.Identity.Name); if (IIDF == "Success") { ViewBag.succMsg = "Your request has been created successfully with IDF Number - " + idf.FileNo + "."; } else { ViewBag.errMsg = IIDF; } } } else if (idf.isDraft == "Draft") { if (idf.draftUpdate == false) { var seqno = Convert.ToInt64(PatentIS.GetNewDraftNo()); if (seqno > 0) { seqno += 1; idf.FileNo = seqno; string IIDF = PatentService.InsertDraft(idf, User.Identity.Name); if (IIDF == "Success") { ViewBag.succMsg = "Your request has been created successfully with draft Number - D" + idf.FileNo + "."; } else { ViewBag.errMsg = IIDF; } } else { ViewBag.errMsg = "Error Connecting Database.Kindly Contact ICSR Computer Section -9741"; } } else { string IIDF = PatentService.UpdateDraft(idf, User.Identity.Name); if (IIDF == "Success") { ViewBag.succMsg = "Your request has been created successfully with Draft Number - " + idf.DraftNo + "."; } else { ViewBag.errMsg = IIDF; } } } return(View(model)); }