public bool SaveMenifest() { tblManifest objMenifest = new tblManifest(); string strError = ""; if (objMenifest.LoadByPrimaryKey(Convert.ToInt32(txtMenifestNo.Text))) { //if (objMenifest.s_AppUploadedManifest == "") //{ objClsCommon = new clsCommon(); string Time = Convert.ToString(DateTime.Now.Month) + Convert.ToString(DateTime.Now.Day) + Convert.ToString(DateTime.Now.Year) + Convert.ToString(DateTime.Now.Hour) + Convert.ToString(DateTime.Now.Minute) + Convert.ToString(DateTime.Now.Second); string strPath = objClsCommon.FileUpload_Images(FileUploadMenifest.PostedFile, txtMenifestNo.Text.Trim().Replace(" ", "_") + "_" + Time, "Uploads/Menifest/", ref strError, 0, objMenifest.s_AppUploadedManifest, false, 0, 2000); if (strError == "") { objMenifest.AppUploadedManifest = strPath; } else { DInfo.ShowMessage(strError, Enums.MessageType.Error); return(false); } objMenifest.Save(); objClsCommon = null; //} //else { DInfo.ShowMessage("Menifest not exists.", Enums.MessageType.Error); } } else { DInfo.ShowMessage("Enter valid Menifest Number", Enums.MessageType.Error); } resetMenifestForm(); objMenifest = null; return(true); }
protected void dgvGridView_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) { if (!string.IsNullOrEmpty(e.CommandArgument.ToString())) { if (e.CommandName == "SaveFile") { GridViewRow gvRow = (GridViewRow)((Control)e.CommandSource).NamingContainer; Int32 rowind = gvRow.RowIndex; FileUpload FileImg = (FileUpload)gvRow.FindControl("fileUpload"); if (FileImg.HasFile) { tblManifest objMenifest = new tblManifest(); if (objMenifest.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()))) { if (objMenifest.s_AppUploadedManifest == "") { objCommon = new clsCommon(); string strError = ""; string Time = Convert.ToString(DateTime.Now.Month) + Convert.ToString(DateTime.Now.Day) + Convert.ToString(DateTime.Now.Year) + Convert.ToString(DateTime.Now.Hour) + Convert.ToString(DateTime.Now.Minute) + Convert.ToString(DateTime.Now.Second); string strPath = objCommon.FileUpload_Images(FileImg.PostedFile, objMenifest.s_AppManifestID.Trim().Replace(" ", "_") + "_" + Time, "Uploads/Menifest/", ref strError, 0, objMenifest.s_AppUploadedManifest, false, 0, 2000); if (strError == "") { objMenifest.AppUploadedManifest = strPath; } else { DInfo.ShowMessage(strError, Enums.MessageType.Error); return; } objMenifest.Save(); objCommon = null; } else { DInfo.ShowMessage("Menifest not exists.", Enums.MessageType.Error); } } else { DInfo.ShowMessage("Enter valid Menifest Number.", Enums.MessageType.Error); } objMenifest = null; LoadDataGrid(true, false); } else { DInfo.ShowMessage("Select Manifest File.", Enums.MessageType.Error); } } } }