Ejemplo n.º 1
0
 /// <summary>
 /// Update User Document
 /// </summary>
 /// <param name="transporterDocument">Transporter Document</param>
 /// <returns>return success 1</returns>
 public static int UpdateUserDocument(TransporterDocument transporterDocument)
 {
     int result;
     TMSDataLibrary.TransporterDocument objTranDocument = new TMSDataLibrary.TransporterDocument();
     result = objTranDocument.UpdateUserDocument(transporterDocument.DocTypeId, transporterDocument.DocumentNo, transporterDocument.DocPath,
         transporterDocument.IssueDate, transporterDocument.UserId);
     return result;
 }
Ejemplo n.º 2
0
        protected void lnkAddUserDocument_Click(object sender, EventArgs e)
        {
            TMSLibrary.TransporterDocument obj = new TMSLibrary.TransporterDocument();
            if (ddlUserDocumentType.SelectedValue != "0")
            {
                obj.DocTypeId = Convert.ToInt32(ddlUserDocumentType.SelectedItem.Value);
            }
            else
            {
                ValidatePopup("Please Select Document Type");
                return;
            }
            if (fluUserDocument.HasFile)
            {
                string fileExt = System.IO.Path.GetExtension(fluUserDocument.FileName);

                if (fileExt == ".jpeg" || fileExt == ".jpg" || fileExt == ".bmp" || fileExt == ".gif" || fileExt == ".png")
                {

                    _user = (TMSLibrary.User)Session["userInfo"];
                    string fileName = _user.UserId + "-" + txtUserDocumentNo.Text.Trim() + System.IO.Path.GetExtension(fluUserDocument.PostedFile.FileName);
                    fluUserDocument.PostedFile.SaveAs(Server.MapPath("~/Document/UserDocument/") + fileName);
                    obj.DocPath = "~/Document/UserDocument/" + fileName;
                }
                else
                {
                    ValidatePopup("File should be .jpg, .jpeg, .bmp, .gif, .png format");
                    return;
                }
            }
            else
            {
                ValidatePopup("Please Select File");
                return;
            }
            if (txtUserDocumentNo.Text.Trim() != "")
            {
                obj.DocumentNo = txtUserDocumentNo.Text.Trim();
            }
            else
            {
                ValidatePopup("Please Enter Document Number");
                return;
            }
            if (txtUserIssueDate.Text != "")
            {
                obj.IssueDate = Convert.ToDateTime(txtUserIssueDate.Text);
            }
            else
            {
                ValidatePopup("Please Enter Issue Date");
                return;
            }
            if (((TMSLibrary.User)Session["userInfo"]).UserId != 0)
            {
                obj.UserId = ((TMSLibrary.User)Session["userInfo"]).UserId;
            }
            int result = TMSLibrary.TransporterDocumentMethods.AddUserDocument(obj);
            if (result >= 1)
            {
                ValidatePopup("Document Added");
                ClearInputs(Page.Controls);
            }
            else
            {
                ValidatePopup("Please Try Again");
                return;
            }
            FillRptUserDocument();
        }