/// <summary> /// 在本地创建文档 /// </summary> /// <param name="documentName"></param> /// <param name="inProjectID"></param> public static void CreateDocmentToLocal(string documentName, int inProjectID, string lockPath, Int64 fileSize, DateTime fileDate) { string sql; string fileExtension; int fileExtensionID; string icoFileName; fileExtension = (Path.GetExtension(documentName)); if (fileExtension == ".exe" || fileExtension == "" || fileExtension == ".lnk") { icoFileName = Path.GetFileNameWithoutExtension(documentName); } else { icoFileName = Path.GetExtension(documentName).Substring(1); } try { //增加新的文件类型 sql = "insert into SA_FileExtension (Extension, Flags) " + "select '" + icoFileName + "', 0 where '" + icoFileName + "' not in (select Extension from SA_FileExtension ) "; BaseSQL.ExecuteSql(sql); //获得指定文件类型对应ID sql = "select a.ExtensionID from SA_FileExtension a " + "where a.extension like '" + icoFileName + "'"; fileExtensionID = Convert.ToInt32(BaseSQL.GetTableBySql(sql).Rows[0][0]); lockPath = Path.GetDirectoryName(lockPath); //增加文档信息【需将用户iD等改为变量】change int newDocumentID = BaseSQL.GetMaxID("documentID", "SA_Documents"); sqlLlist.Clear(); sql = "insert into SA_Documents(filename,busy,extensionID,deleted,flags," + "lockProject,userId,lockDomain,lockPath,lockDate,latestRevisionNo,objectTypeID,defValStored) " + "values('" + documentName + "', 0," + fileExtensionID + " , 0,0," + inProjectID + ",'" + SystemInfo.user.AutoId + "','pc-songxi','" + lockPath + "','" + DateTime.Now + "',0 ,1,0)";//'90':userID sqlLlist.Add(sql); //增加文档和项目关联关系信息 sql = "insert into SA_DocumentsInProjects(projectID,documentID,Deleted) " + "values(" + inProjectID + "," + newDocumentID + ",0)"; sqlLlist.Add(sql); //增加文档版本信息 sql = "insert into SA_Revisions(documentID,RevNr,date,UserID,fileSize,fileDate) " + "values(" + newDocumentID + ",0,'" + DateTime.Now + "'," + SystemInfo.user.AutoId + "," + fileSize + ",'" + fileDate + "')";//change 90 sqlLlist.Add(sql); BaseSQL.ExecuteSqlTran(sqlLlist); } catch (Exception ex) { ExceptionHandler.HandleException("在本地创建文档错误。", ex); } }
private void addRootTreeNode_Click(object sender, EventArgs e) { try { tvtbQueryList.Nodes.Add("新建文件夹"); tvtbQueryList.SelectedNode.Expand(); //选定新建节点 tvtbQueryList.SelectedNode = tvtbQueryList.Nodes[tvtbQueryList.Nodes.Count - 1]; string nodeId = BaseSQL.GetMaxID("AutoId", "BS_QuerySql").ToString(); tvtbQueryList.SelectedNode.Name = nodeId; saveNodeToTable();//将新建节点同步到数据库 } catch (Exception e1) { MessageBox.Show(e1.Message); } }
private void addRootTreeNode_Click(object sender, EventArgs e) { try { tvtbQueryList.Nodes.Add("新建文件夹"); tvtbQueryList.SelectedNode.Expand(); //选定新建节点 tvtbQueryList.SelectedNode = tvtbQueryList.Nodes[tvtbQueryList.Nodes.Count - 1]; string nodeId = BaseSQL.GetMaxID("AutoId", "BS_QuerySql").ToString(); tvtbQueryList.SelectedNode.Name = nodeId; saveNodeToTable();//将新建节点同步到数据库 } catch (Exception ex) { ExceptionHandler.HandleException(this.Text + "--插入树根节点事件错误。", ex); } }
private void insertTreeNode_Click(object sender, EventArgs e) { try { string nName; nName = tvtbQueryList.SelectedNode.Name; tvtbQueryList.SelectedNode.Parent.Nodes.Insert(tvtbQueryList.SelectedNode.Index, "插入查询"); tvtbQueryList.SelectedNode.Expand(); tvtbQueryList.SelectedNode = tvtbQueryList.SelectedNode.PrevNode; string nodeId = BaseSQL.GetMaxID("AutoId", "BS_QuerySql").ToString(); tvtbQueryList.SelectedNode.Name = nodeId; saveNodeToTable();//将新建节点同步到数据库 } catch (Exception e1) { MessageBox.Show(e1.Message); } }
private void insertTreeNode_Click(object sender, EventArgs e) { try { string nName; nName = tvtbQueryList.SelectedNode.Name; tvtbQueryList.SelectedNode.Parent.Nodes.Insert(tvtbQueryList.SelectedNode.Index, "插入查询"); tvtbQueryList.SelectedNode.Expand(); tvtbQueryList.SelectedNode = tvtbQueryList.SelectedNode.PrevNode; string nodeId = BaseSQL.GetMaxID("AutoId", "BS_QuerySql").ToString(); tvtbQueryList.SelectedNode.Name = nodeId; saveNodeToTable();//将新建节点同步到数据库 } catch (Exception ex) { ExceptionHandler.HandleException(this.Text + "--插入树节点事件错误。", ex); } }
private void addChildTreeNode_Click(object sender, EventArgs e) { if (tvtbQueryList.SelectedNode.Parent == null) { try { tvtbQueryList.SelectedNode.Nodes.Add("新建查询"); tvtbQueryList.SelectedNode.Expand(); tvtbQueryList.SelectedNode = tvtbQueryList.SelectedNode.LastNode; string nodeId = BaseSQL.GetMaxID("AutoId", "BS_QuerySql").ToString(); tvtbQueryList.SelectedNode.Name = nodeId; saveNodeToTable();//将新建节点同步到数据库 } catch (Exception e1) { MessageBox.Show(e1.Message); } } }
private void addChildTreeNode_Click(object sender, EventArgs e) { if (tvtbQueryList.SelectedNode.Parent == null) { try { tvtbQueryList.SelectedNode.Nodes.Add("新建查询"); tvtbQueryList.SelectedNode.Expand(); tvtbQueryList.SelectedNode = tvtbQueryList.SelectedNode.LastNode; string nodeId = BaseSQL.GetMaxID("AutoId", "BS_QuerySql").ToString(); tvtbQueryList.SelectedNode.Name = nodeId; saveNodeToTable();//将新建节点同步到数据库 } catch (Exception ex) { ExceptionHandler.HandleException(this.Text + "--插入树子节点事件错误。", ex); } } }
/// <summary> /// 生成报价单 /// </summary> /// <param name="lv"></param> public static void CreateQuotation(ListView lv) { sqlLlist.Clear(); int projectID = Convert.ToInt32(lv.SelectedItems[0].Tag); try { string sql = "insert into SA_quotation(quotationNo,SN,projectID,year) " + "values('" + FrmProjectDocumentBLL.CreateQuotationNo() + "'," + BaseSQL.GetMaxID("SN", "SA_quotation", "year", DateTime.Now.Year) + "," + projectID + "," + DateTime.Now.Year + ")"; sqlLlist.Add(sql); sql = "update a set a.FolderType=3 from SA_Projects a where a.ProjectID=" + projectID; sqlLlist.Add(sql); BaseSQL.ExecuteSqlTran(sqlLlist); } catch (Exception ex) { ExceptionHandler.HandleException("生成报价单错误。", ex); } }
/// <summary> /// 生成报价单 /// </summary> /// <param name="lv"></param> public static void CreateQuotation(ListView lv) { sqlLlist.Clear(); int projectID = Convert.ToInt32(lv.SelectedItems[0].Tag); try { string sql = "insert into SA_quotation(quotationNo,SN,projectID,year) " + "values('" + FrmProjectDocumentBLL.CreateQuotationNo() + "'," + BaseSQL.GetMaxID("SN", "SA_quotation", "year", DateTime.Now.Year) + "," + projectID + "," + DateTime.Now.Year + ")"; sqlLlist.Add(sql); sql = "update a set a.FolderType=3 from SA_Projects a where a.ProjectID=" + projectID; sqlLlist.Add(sql); BaseSQL.ExecuteSqlTran(sqlLlist); } catch (Exception ex) { MessageBox.Show(ex.Message, f.tsmiTs.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } }