protected void grid_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e) { if (Request.QueryString["Job"] != null && Request.QueryString["Sn"] != null) { string job = Request.QueryString["Job"].ToString(); string inv = Request.QueryString["Sn"].ToString(); for (int m = 0; m < list.Count; m++) { int id = list[m].docId; string sql = string.Format("select * from Ctm_Attachment where Id='{0}'", id); DataTable dt = D.List(sql); DataRow dr = dt.Rows[0]; C2.SeaAttachment photo = new C2.SeaAttachment(); photo.JobClass = "IV"; //Request.QueryString["Type"].ToString(); photo.FileName = S.Text(dr["FileName"]); photo.RefNo = inv; photo.JobNo = job; photo.FileNote = ""; photo.FileType = S.Text(dr["FileType"]); photo.FilePath = S.Text(dr["FilePath"]).Replace("http://tsl.cargoerp.com/Photos/", ""); photo.CreateBy = HttpContext.Current.User.Identity.Name; photo.CreateDateTime = DateTime.Now.ToLocalTime(); Manager.ORManager.StartTracking(photo, Wilson.ORMapper.InitialState.Inserted); Manager.ORManager.PersistChanges(photo); } } else { e.Result = "Error, Pls refresh your invoice"; } }
public void AddFile(string type, string code, string _name, string desc) { C2.SeaAttachment photo = new C2.SeaAttachment(); photo.JobClass = Request.QueryString["Type"].ToString(); photo.FileName = _name; photo.RefNo = code; //photo.conterno = cmb_ContNo.Text; photo.JobNo = cmb_DoNo.Text; photo.FileNote = desc; photo.FileType = type; photo.FilePath = GetFilePath(this.txt_Sn.Text, this.cmb_ContNo.Text, this.cmb_DoNo.Text) + _name; photo.CreateBy = HttpContext.Current.User.Identity.Name; photo.CreateDateTime = DateTime.Now.ToLocalTime(); Manager.ORManager.StartTracking(photo, Wilson.ORMapper.InitialState.Inserted); Manager.ORManager.PersistChanges(photo); }