EtongFlyChou.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:135k
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- //项目查询依据项目代码
- public DataView PrjQureyData()
- {
- DataView dv = new DataView();
- string strSQL;
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- strSQL = "select * from tb_Project where ProjectID=" + this.m_pID;
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- //项目日志
- public DataView LogQuery()
- {
- string strSQL;
- DataView dv = new DataView();
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- strSQL = "select * from tb_Project_Log where ProjectID=" + this.m_pID;
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- //项目日志新建
- public void LogInsert()
- {
- string strSQL;
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- strSQL = "insert into tb_Project_Log values('" + this.m_lWriter + "','" + this.m_lDate + "','"
- + this.m_lInfo + "'," + this.m_pID;
- MSDA.Open();
- SqlTransaction tran = MSDA.BeginTransaction();
- try
- {
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- tran.Commit();
- }
- catch (Exception ex)
- {
- tran.Rollback();
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- }
- //已办工作查询
- public DataView PrjQureyAlreadyDo()
- {
- string strSQL;
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- QueryParameterCollection Params = new QueryParameterCollection();
- DataView dv = new DataView();
- strSQL = "P_ZFGetAlreadyDo";
- Params.Clear();
- Params.Add("@Param_User", this.m_sUser);
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.StoredProcedure, strSQL, Params);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- //工作流权限
- public DataView PrjGetPermission()
- {
- int err =-1;
- string strSQL = "select OpID from Tb_Sys_EmpOpRole where EmpID=" + this.m_EmpID;
- DataView dv = new DataView();
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text,strSQL,null);
- }
- catch (Exception ex)
- {
- err =1;
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- if (err ==1) return null;
- ArrayList al = new ArrayList();
- for (int i = 0; i < dv.Table.Rows.Count; i++)
- {
- DataView dv2 = new DataView();
- try
- {
- strSQL = "select PermID from tb_Op_Role where OpID=" + Convert.ToInt32(dv.Table.Rows[i]["OpID"]);
- MSDA.Open();
- dv2 = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- for (int j = 0; j < dv2.Table.Rows.Count; j++)
- {
- int s=0;
- for (int k = 0; k < al.Count; k++)
- {
- if (dv2.Table.Rows[j]["PermID"].ToString().Trim() == al[k].ToString()) s = 1;
- }
- if (s == 0) al.Add(dv2.Table.Rows[j]["PermID"].ToString());
- }
- }
- catch (Exception ex)
- {
- err = 1;
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- if (err==1)return null;
- }
- DataView dv1 = new DataView();
- if (al.Count > 0)
- {
- try
- {
- MSDA.Open();
- string stral = "";
- for (int x = 0; x < al.Count; x++)
- {
- if (x == 0) stral = stral + al[x].ToString();
- else stral = stral + "," + al[x].ToString();
- }
- strSQL = "select PermID,DefaultPage,DisplayName from Tb_Sys_Permission where PermID in (" + stral + ")";
- dv1 = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- //for (int x = 0; x < al.Count; x++)
- //{
- // strSQL = "select DefaultPage,DisplayName from Tb_Sys_Permission where PermID=" + Convert.ToInt32(al[x]);
- // if (x == 0) dv1 = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- // else
- // {
- // DataSet ds = new DataSet();
- // dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- // DataRow rows;
- // rows = dv1.Table.NewRow();
- // rows.ItemArray = dv.Table.Rows[0].ItemArray;
- // dv1.Table.Rows.Add(rows);
- // //dv1.Table.Rows[dv1.Table.Rows.Count -1]["DefaultPage"]
- // }
- //}
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- }
- return dv1;
- }
- //工作流下一级的业务角色
- public void PrjGetOpRole()
- {
- int err = -1;
- if (this.m_Must != "0")
- {
- try
- {
- this.PrjGetEmpType();
- }
- catch (Exception ex)
- {
- err = 1;
- throw ex;
- }
- if (err == 1) return;
- }
- try
- {
- this.PrjGetOrgCID();
- }
- catch (Exception ex)
- {
- err = 1;
- throw ex;
- }
- if (err == 1) return;
- string strSQL = "select NDeptID from tb_Task_Role where MustChooseItem='" + this.m_Must +
- "' and ODeptID=" + this.m_DeptID + " and EmpType=" + this.m_EmpType + " and CID='" +
- this.m_cDID + "' and Prj=" + this.m_Psort;
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- DataView dv = new DataView();
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- err = 1;
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- if (err == 1) return;
- if (dv.Table.Rows.Count != 1) { this.Ndept = -1; return; } //未找到
- this.Ndept = Convert.ToInt32(dv.Table.Rows[0]["NDeptID"]);
-
- }
- public void PrjGetEmpType()
- {
- int err=-1;
- int iEmpType;
- string strSQL= "select EmpType from Tb_Sys_Employee where EmpID=" + this.m_EmpID;
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- DataView dv = new DataView();
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- err = 1;
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- if (err == 1) return;
- if (dv.Table.Rows.Count != 1) return;
- //iEmpType = Convert.ToInt32(dv.Table.Rows[0]["EmpType"]);
- this.EmpType = Convert.ToInt32(dv.Table.Rows[0]["EmpType"]);
- }
- public void PrjGetOrgCID()
- {
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- DataView dv = new DataView();
- int err = -1;
- string strSQL = "select OrgLevel,OrgcID,ParentOrgID from Tb_Sys_Organization where OrgID=" + this.m_DeptID;
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- err = 1;
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- if (err == 1) return;
- if (dv.Table.Rows.Count != 1) return;
- int iLevel, iPID;
- string sCID;
- iLevel = Convert.ToInt32(dv.Table.Rows[0]["OrgLevel"]);
- if (iLevel <= 2) sCID = dv.Table.Rows[0]["OrgcID"].ToString();
- else
- {
- iPID = Convert.ToInt32(dv.Table.Rows[0]["ParentOrgID"]);
- strSQL = "select OrgcID from Tb_Sys_Organization where OrgID=" + iPID;
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- err = 1;
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- if (err == 1) return;
- if (dv.Table.Rows.Count != 1) return;
- sCID = dv.Table.Rows[0]["OrgcID"].ToString();
- }
- this.CdID = sCID;
- }
- public void PrjUpdateActStatus()
- {
- string strSQL = "update tb_wf_actins set status=0 where ActinsID=" + this.m_sID ;
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- MSDA.Open();
- SqlTransaction tran = MSDA.BeginTransaction();
- try
- {
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- tran.Commit();
- }
- catch (Exception ex)
- {
- tran.Rollback();
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- }
- //获取所有的业务角色
- public DataView GetAllOpRole()
- {
- DataView dv = new DataView();
- string strSQL = "select * from Tb_Sys_OpRole";
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- //获取指定职工的业务角色
- public DataView GetAssignOpRole()
- {
- string strSQL = "select * from Tb_Sys_EmpOpRole where EmpID=" + this.m_EmpID;
- DataView dv = new DataView();
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- //获取指定工作流的业务角色
- public DataView GetWFAssignOpRole()
- {
- string strSQL = "select * from Tb_WF_OpRole where WFID=" + this.m_wID ;
- DataView dv = new DataView();
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- //获取指定业务角色的名称
- public void GetOpName()
- {
- string strSQL = "select OpName from Tb_Sys_OpRole where OpID=" + this.m_OpID;
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- DataView dv = new DataView();
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- if (dv.Table.Rows.Count > 0)
- this.m_OpName = dv.Table.Rows[0]["OpName"].ToString();
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- }
- //获取指定业务角色权限
- public DataView GetOpPerm()
- {
- DataView dv = new DataView();
- string strSQL = "select PermID from tb_Op_Role where OpID=" + this.OpID;
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- //获取所有业务权限
- public DataView GetOpPermAll()
- {
- DataView dv = new DataView();
- string strSQL = "select PermID,DisplayName from Tb_Sys_Permission where ParentresCode='2'";
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- //获取指定业务角色
- public DataView GetOpRoleByOp()
- {
- string strSQL = "select * from Tb_Sys_OpRole where OpID=" + this.m_OpID;
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- DataView dv = new DataView();
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- //更新业务角色和权限
- public void UpOpPerm()
- {
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- string strSQL = "update Tb_Sys_OpRole set OpName='" + this.m_OpName + "',OrgDesc='" + this.m_OpDesc + "' where OpID=" + this.m_OpID;
- MSDA.Open();
- SqlTransaction tran = MSDA.BeginTransaction();
- try
- {
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- strSQL = "delete from tb_Op_Role where OpID=" + this.m_OpID;
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- for (int i = 0; i < this.m_OpPerm.Count; i++)
- {
- strSQL = "insert into tb_Op_Role values(" + this.m_OpID + "," + Convert.ToInt32(this.m_OpPerm[i]) + ")";
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- }
- tran.Commit();
- }
- catch (Exception ex)
- {
- tran.Rollback();
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- }
- //查询业务角色
- public DataView CheckOpByCondition()
- {
- string strSQL = "select * from Tb_Sys_OpRole";
- if (this.m_OpID > 0)
- {
- strSQL = strSQL + " where OpID=" + this.m_OpID;
- }
- if (this.m_OpName == null || this.m_OpName == "") ;
- else
- {
- strSQL = strSQL + " where OpName='" + this.m_OpName + "'";
- }
- DataView dv = new DataView();
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- }
- //工作流
- public class EtongFlyChouWFNTask
- {
- private int m_pID; //ParentActID TB_CONOLY_USER
- private int m_tID; //ActivityID
- private ArrayList m_rID; //RoleID
- private string m_tUnit; //Unit TB_WF_ACTIVITY
- private string m_tName; //ActName
- private int m_tWFID; //WorkFlowID
- private int m_tPageID; //PageID
- private int m_tStart; //StartEnd
- private int m_tBlock; //BlockFlag
- private int m_tShunt; //ShuntFlag
- private int m_tMode; //ModeFlag
- private string m_wDesc; //WFDesc TB_WORKFOLW
- private string m_wName; //WFName
- private int m_wStatus; //Status
- private int m_wStart; //StartUpType
- private string m_wUnit; //Unit
- private int m_wKind; //KindID
- private string m_wStDesc; //StartDesc
- private int m_wStID; //StartRouterID
- private int m_iID; //WFInstanceID TB_WF_INSTANCE
- private int m_iUser; //CreateUserID
- private int m_iRole; //TargetRoleID
- private int m_iStatus; //Status
- private DateTime m_iEnd; //TheoryEndDate
- private int m_iPrjID; //PrjID
- private int m_aID; //ActInsID TB_WF_ACTINS
- private DateTime m_aCreate; //CreateDate
- private DateTime m_aReal; //RealEndDate
- private int m_aStatus; //Status
- private DateTime m_aTheory; //TheoryEndDate
- private string m_aBlock; //BlockReason
- private int m_aUser; //UserID
- private int m_aRole; //RoleID
-
-
- //上一级活动代码
- public int TaskPID
- {
- set { m_pID = value; }
- get { return m_pID; }
- }
- //流程活动代码
- public int TaskID
- {
- set { m_tID = value; }
- get { return m_tID; }
- }
- //用户列表
- public ArrayList RolesID
- {
- set { m_rID = value; }
- get { return m_rID; }
- }
- //流程活动单位
- public string TaskUnit
- {
- set { m_tUnit = value; }
- get { return m_tUnit; }
- }
- //流程活动名
- public string TaskName
- {
- set { m_tName = value; }
- get { return m_tName; }
- }
- //流程活动工作流代码
- public int TaskWFID
- {
- set { m_tWFID = value; }
- get { return m_tWFID; }
- }
- //流程活动页面代码
- public int TaskPage
- {
- set { m_tPageID = value; }
- get { return m_tPageID; }
- }
- //流程活动任务标志
- public int TaskStart
- {
- set { m_tStart = value; }
- get { return m_tStart; }
- }
- //流程活动阻塞标志
- public int TaskBlock
- {
- set { m_tBlock = value; }
- get { return m_tBlock; }
- }
- //流程活动分流
- public int TaskShunt
- {
- set { m_tShunt = value; }
- get { return m_tShunt; }
- }
- //流程活动工作方式
- public int TaskMode
- {
- set { m_tMode = value; }
- get { return m_tMode; }
- }
- //工作流描述
- public string TaskWDecs
- {
- set { m_wDesc = value; }
- get { return m_wDesc; }
- }
- //工作流名称
- public string TaskWName
- {
- set { m_wName = value; }
- get { return m_wName; }
- }
- //工作流状态
- public int TaskWStatus
- {
- set { m_wStatus = value; }
- get { return m_wStatus; }
- }
- //工作流启动类型
- public int TaskWStart
- {
- set { m_wStart = value; }
- get { return m_wStart; }
- }
- //工作流使用单位
- public string TaskWUnit
- {
- set { m_wUnit = value; }
- get { return m_wUnit; }
- }
- //工作流种类
- public int TaskWKind
- {
- set { m_wKind = value; }
- get { return m_wKind; }
- }
- //工作流关联表
- public string TaskWStDesc
- {
- set { m_wStDesc = value; }
- get { return m_wStDesc; }
- }
- //工作流任务启动位置
- public int TaskWStID
- {
- set { m_wStID = value; }
- get { return m_wStID; }
- }
- //工作流实例代码
- public int TaskIID
- {
- set { m_iID = value; }
- get { return m_iID; }
- }
- //工作流实例接受者用户代码
- public int TaskIUser
- {
- set { m_iUser = value; }
- get { return m_iUser; }
- }
- //工作流实例接受者角色代码
- public int TaskIRole
- {
- set { m_iRole = value; }
- get { return m_iRole; }
- }
- //工作流实例状态
- public int TaskIStatus
- {
- set { m_iStatus = value; }
- get { return m_iStatus; }
- }
- //工作流实例计划结束时间
- public DateTime TaskIEnd
- {
- set { m_iEnd = value; }
- get { return m_iEnd; }
- }
- //工作流实例项目代码
- public int TaskIPrj
- {
- set { m_iPrjID = value; }
- get { return m_iPrjID; }
- }
- //工作流活动实例
- public int TaskIAID
- {
- set { m_aID = value; }
- get { return m_aID; }
- }
- //工作流活动实例创建时间
- public DateTime TaskACreate
- {
- set { m_aCreate = value; }
- get { return m_aCreate; }
- }
- //工作流活动实例实际结束时间
- public DateTime TaskAReal
- {
- set { m_aReal = value; }
- get { return m_aReal; }
- }
- //工作流活动实例状态
- public int TaskAStatus
- {
- set { m_aStatus = value; }
- get { return m_aStatus; }
- }
- //工作流活动实例计划完成时间
- public DateTime TaskATheory
- {
- set { m_aTheory = value; }
- get { return m_aTheory; }
- }
- //工作流活动实例耽误原因
- public string TaskABlock
- {
- set { m_aBlock = value; }
- get { return m_aBlock; }
- }
- //工作流活动实例受理用户
- public int TaskAUser
- {
- set { m_aUser = value; }
- get { return m_aUser; }
- }
- //工作流活动实例受理角色
- public int TaskARole
- {
- set { m_aRole = value; }
- get { return m_aRole; }
- }
- //创建新任务
- public EtongFlyChouWFNTask CreateNewTask()
- {
- return new EtongFlyChouWFNTask();
- }
- //删除工作流
- public void WFDelete()
- {
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- string strSQL;
- strSQL = "delete from tb_WorkFlow where WFID=" + this.m_tWFID;
- try
- {
- MSDA.Open();
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- }
- //是否能删除该工作流
- public bool IsCanWFDelete()
- {
- MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- string strSQL;
- bool result = true;
- strSQL = "select count(*) as iNum from tb_WF_Activity where WorkFlowID=" + this.m_tWFID;
- try
- {
- MSDA.Open();
- SqlDataReader dr = MSDA.ExecuteReader(CommandType.Text, strSQL, null);
- if (dr.Read() == true)
- {
- if (Convert.ToInt32(dr["iNum"]) > 0) result = false;
- }
- dr.Close();
- }
- finally
- {
- MSDA.Close();
- }
- return result;
- }
-
- }
- public class EtongFlyChouWFNM
- {
- private int m_ID; //CommID
- private string m_Name; //CommName
- private decimal m_Bud; //BudGetPrice
- private decimal m_Diff; //DifferencePrice
- private decimal m_DiffSum; //DifferencePriceSum Price
- private decimal m_Mark; //MarketPrice
- private string m_Size; //MeterialSize
- private int m_Num; //Number
- private string m_Unit; //UnitName Memo
- private int m_Prj; //ProjectID
- private int m_wz; //WZID
- private int m_UserID; //uSERID
- private string m_UserName; //UserName
- private string m_Exp; //Explain
- private string m_Field; //字段
- private string m_Table; //表名
- private string m_Condition; //条件
- private Int16 m_sstatus; //sstatus
- private Int16 m_status; //status
- //CommID
- public int CommID
- {
- set { m_ID = value; }
- get { return m_ID; }
- }
- public string CommName
- {
- set {m_Name =value;}
- get { return m_Name; }
- }
- public decimal Bud
- {
- set { m_Bud = value; }
- get { return m_Bud; }
- }
- public decimal Diff
- {
- set { m_Diff = value; }
- get { return m_Diff; }
- }
- public decimal DiffSum
- {
- set { m_DiffSum = value; }
- get { return m_DiffSum; }
- }
- public decimal Mark
- {
- set { m_Mark = value; }
- get { return m_Mark; }
- }
- public string CommSize
- {
- set {m_Size =value;}
- get {return m_Size;}
- }
- public int Num
- {
- set { m_Num = value; }
- get { return m_Num; }
- }
- public string Unit
- {
- set { m_Unit = value; }
- get { return m_Unit; }
- }
- public int Prj
- {
- set { m_Prj = value; }
- get { return m_Prj; }
- }
- public int WZ
- {
- set { m_wz = value; }
- get { return m_wz; }
- }
- public int UserID
- {
- set { m_UserID = value; }
- get { return m_UserID; }
- }
- public string UserName
- {
- set { m_UserName = value; }
- get { return m_UserName; }
- }
- public string Explain
- {
- set { m_Exp = value; }
- get { return m_Exp; }
- }
- public string Filed
- {
- set { m_Field = value; }
- get { return m_Field; }
- }
- public string Table
- {
- set { m_Table = value; }
- get { return m_Table; }
- }
- public string Condition
- {
- set { m_Condition = value; }
- get { return m_Condition; }
- }
- public Int16 sstatus
- {
- set { m_sstatus = value; }
- get { return m_sstatus; }
- }
- public Int16 status
- {
- set { m_status = value; }
- get { return m_status; }
- }
- private QueryParameterCollection Params = new QueryParameterCollection();
- private MSSqlDataAccess MSDA2 = new MSSqlDataAccess(2);
- private MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
-
- /// <summary>
- /// 获取待办事宜等
- /// 1、待办;2、其他
- /// </summary>
- /// <param name="iUserID">用户ID</param>
- /// <param name="iStatus">工作状态</param>
- /// <returns>DataView工作流的事宜信息</returns>
- public DataView GetWaitList(int iFlag,int iUserID,int iDept,int iStatus0,int iStatus2)
- {
- Params.Clear();
- Params.Add("@Param_UserIDflag", iFlag);
- Params.Add("@Param_UserID", iUserID);
- Params.Add("@Param_DeptID", iDept);
- Params.Add("@Param_Status0", iStatus0);
- Params.Add("@Param_Status2", iStatus2);
- DataView dv = new DataView();
- string strSQL = "P_GetWaitList";
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.StoredProcedure,strSQL,Params);
- MSDA.Close();
- return dv;
- }
-
- /// <summary>
- /// 获取物资代码大类
- /// </summary>
- /// <returns>所有的物资代码</returns>
- public DataView GetBigWZList()
- {
- string strSQL = "select wz_code1,wz_code2,wz_namecode2 from wz_code2";
- DataView dv = new DataView();
- try
- {
- MSDA2.Open();
- dv = MSDA2.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch
- {
- }
- finally
- {
- MSDA2.Close();
- }
- return dv;
- }
- /// <summary>
- /// 设备费
- /// </summary>
- public DataView ProEquGetDataByPrj()
- {
- string strSQL = "select * from tb_Project_Equipment where ProjectID=" + this.m_Prj + " order by wz_id";
- MSDA.Open();
- DataView dv = new DataView();
- try
- {
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- public DataView ProEquGetData()
- {
- string strSQL = "select * from tb_Project_Equipment where ProjectID=" +
- this.m_Prj + " and sstatus=" + this.m_sstatus + " order by wz_id";
- MSDA.Open();
- DataView dv = new DataView();
- try
- {
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- public DataView ProEquGetDataByEqu()
- {
- string strSQL = "select * from tb_Project_Equipment where EquipmentID=" + this.CommID + " and sstatus=" + this.m_sstatus;
- MSDA.Open();
- DataView dv = new DataView();
- try
- {
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- public int ProEquInsert()
- {
- int err = -1;
- string strSQL = "select * from tb_Project_Equipment where ProjectID=" +
- this.m_Prj + " and wz_id=" + this.m_wz + " and sstatus=1";
- MSDA.Open();
- DataView dv = new DataView();
- try
- {
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- err = -2;
- throw ex;
- }
- if (err == -2)
- {
- MSDA.Close();
- return err;
- }
- if (dv.Table.Rows.Count > 0)
- {
- MSDA.Close();
- return -1;
- }
- strSQL = "insert into tb_Project_Equipment values('" + this.m_Unit + "'," +
- this.m_wz + ",'" + this.m_Name + "'," + this.m_Num + "," + this.m_Prj + "," +
- this.m_Mark + ",'" + this.m_Size + "',1," + this.status + ",'" + this.m_UserName + "')";
- SqlTransaction tran = MSDA.BeginTransaction();
- try
- {
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- tran.Commit();
- }
- catch (Exception ex)
- {
- tran.Rollback();
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return 1;
- }
- public int ProEquUpdate()
- {
- int err = -1;
- DataView dv = new DataView();
- try
- {
- dv = this.ProEquGetDataByEqu();
- }
- catch (Exception ex)
- {
- err = -2;
- throw ex;
- }
- if (err == -2) return err;
- if (dv.Table.Rows.Count < 1)
- {
- //ex.Message = "未找到要更新的内容,请查证后再试!";
- err = 1;
- return err;
- }
- bool bl=false;
- if (this.m_Unit.Trim() != dv.Table.Rows[0]["UnitName"].ToString().Trim()) bl = true;
- if (this.m_wz != Convert.ToInt32(dv.Table.Rows[0]["wz_id"].ToString())) bl = true;
- if (this.m_Name.Trim() != dv.Table.Rows[0]["EquipmentName"].ToString().Trim()) bl = true;
- if (this.m_Num != Convert.ToInt32(dv.Table.Rows[0]["Number"].ToString())) bl =true;
- if (this.m_Mark != decimal.Parse(dv.Table.Rows[0]["Price"].ToString())) bl = true;
- if (this.m_Size.Trim() != dv.Table.Rows[0]["EquipmentSize"].ToString().Trim()) bl = true;
- if (bl)
- {
- string strSQL = "Update tb_Project_Equipment set sstatus=2 where EquipmentID=" + this.m_ID;
- MSDA.Open();
- SqlTransaction tran = MSDA.BeginTransaction();
- try
- {
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- strSQL = "insert into tb_Project_Equipment values('" + this.m_Unit + "'," +
- this.m_wz + ",'" + this.m_Name + "'," + this.m_Num + "," + this.m_Prj + "," +
- this.m_Mark + ",'" + this.m_Size + "',1," + this.status + ",'" + this.m_UserName + "')";
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- tran.Commit();
- return err;
- }
- catch (Exception ex)
- {
- tran.Rollback();
- err = -2;
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- }
- else
- {
- err = 2;
- //ex.Message = "未发生变化无需更新,请查证后再试!";
- }
- return err;
- }
- public void ProEquDelete()
- {
- int err = -1;
- DataView dv = new DataView();
- try
- {
- dv = this.ProEquGetDataByEqu();
- }
- catch (Exception ex)
- {
- err = -2;
- throw ex;
- }
- if (err == -2) return;
- if (dv.Table.Rows.Count < 1)
- {
- //ex.Message = "未找到要更新的内容,请查证后再试!";
- err = 1;
- return;
- }
- string sSQL = "insert into tb_Project_Equipment values('" + dv.Table.Rows[0]["UnitName"].ToString().Trim() +
- "'," + Convert.ToInt32(dv.Table.Rows[0]["wz_id"].ToString()) + ",'" + dv.Table.Rows[0]["EquipmentName"].ToString().Trim() +
- "'," + Convert.ToInt32(dv.Table.Rows[0]["Number"].ToString()) + "," + dv.Table.Rows[0]["ProjectID"].ToString().Trim() +
- "," + decimal.Parse(dv.Table.Rows[0]["Price"].ToString()) + ",'" + dv.Table.Rows[0]["EquipmentSize"].ToString().Trim() +
- "',2,3,'" + this.m_UserName + "')";
- MSDA.Open();
- SqlTransaction tran = MSDA.BeginTransaction();
- try
- {
- MSDA.ExecuteNonQuery(CommandType.Text, sSQL, null);
- sSQL = "Update tb_Project_Equipment set sstatus=2 where EquipmentID=" + this.m_ID;
- MSDA.ExecuteNonQuery(CommandType.Text, sSQL, null);
- tran.Commit();
- }
- catch (Exception ex)
- {
- tran.Rollback();
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- }
- /// <summary>
- /// 材料费
- /// </summary>
- public int ProMaterialInsert()
- {
- int err = -1;
- string strSQL = "select * from tb_Project_Material where ProjectID=" +
- this.m_Prj + " and wz_id=" + this.m_wz + " and sstatus=1";
- DataView dv = new DataView();
- MSDA.Open();
- try
- {
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- err = -2;
- throw ex;
- }
- if (err == -2)
- {
- MSDA.Close();
- return err;
- }
- if (dv.Table.Rows.Count > 0)
- {
- MSDA.Close();
- return -1;
- }
- strSQL = "insert into tb_Project_Material values(" + this.m_Bud + "," + this.m_Diff + "," +
- this.m_DiffSum + "," + this.m_Mark + ",'" + this.m_Name + "','" +
- this.m_Size + "'," + this.m_wz + "," + this.m_Num + ",'" + this.m_Unit + "'," +
- this.m_Prj + ",1," + this.m_status + ",'" + this.m_UserName + "')";
- SqlTransaction tran = MSDA.BeginTransaction();
- try
- {
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- tran.Commit();
- }
- catch (Exception ex)
- {
- tran.Rollback();
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return 1;
- }
- public string ProMaterialGetMemo()
- {
- string strSQL = "select Memo from tb_Project_Material where MaterialID=" + this.m_ID ;
- MSDA.Open();
- DataView dv = MSDA.ExecuteDataView(CommandType.Text,strSQL,null);
- MSDA.Close();
- string sMemo="";
- if (dv.Table.Rows.Count > 0) sMemo = dv.Table.Rows[0][0].ToString();
- return sMemo;
- }
- public int ProMaterialUpdate()
- {
- int err = -1;
- DataView dv = new DataView();
- try
- {
- dv = this.ProMaterialGetByMat();
- }
- catch (Exception ex)
- {
- err = -2;
- throw ex;
- }
- if (err == -2) return err;
- if (dv.Table.Rows.Count < 1)
- {
- //ex.Message = "未找到要更新的内容,请查证后再试!";
- err = 1;
- return err;
- }
- bool bl = false;
- if (this.m_Bud != decimal.Parse(dv.Table.Rows[0]["BudGetPrice"].ToString())) bl = true;
- if (this.m_DiffSum != decimal.Parse(dv.Table.Rows[0]["DifferencePriceSum"].ToString())) bl = true;
- if (this.m_Mark != decimal.Parse(dv.Table.Rows[0]["MarketPrice"].ToString())) bl = true;
- if (this.m_Name.Trim() != dv.Table.Rows[0]["MeterialName"].ToString().Trim()) bl = true;
- if (this.m_Size.Trim() != dv.Table.Rows[0]["MeterialSize"].ToString().Trim()) bl = true;
- if (this.m_wz != Convert.ToInt32(dv.Table.Rows[0]["wz_id"].ToString())) bl = true;
- if (this.m_Num != Convert.ToInt32(dv.Table.Rows[0]["Number"].ToString())) bl = true;
- if (this.m_Unit.Trim() != dv.Table.Rows[0]["UnitName"].ToString().Trim()) bl = true;
- if (bl)
- {
- string strSQL = "Update tb_Project_Material set sstatus=2 where MaterialID=" + this.m_ID;
- MSDA.Open();
- SqlTransaction tran = MSDA.BeginTransaction();
- try
- {
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- strSQL = "insert into tb_Project_Material values(" + this.m_Bud + "," + this.m_Diff + "," +
- this.m_DiffSum + "," + this.m_Mark + ",'" + this.m_Name + "','" +
- this.m_Size + "'," + this.m_wz + "," + this.m_Num + ",'" + this.m_Unit + "'," +
- this.m_Prj + ",1," + this.m_status + ",'" + this.m_UserName + "')";
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- tran.Commit();
- return err;
- }
- catch (Exception ex)
- {
- tran.Rollback();
- err = -2;
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- }
- else
- {
- err = 2;
- //ex.Message = "未发生变化无需更新,请查证后再试!";
- }
- return err;
- }
- public DataView ProMaterialGetByPrj()
- {
- string strSQL = "select * from tb_Project_Material where ProjectID=" + this.m_Prj + " order by wz_id";
- DataView dv = new DataView();
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- public DataView ProMaterialGetByPrjId()
- {
- string strSQL = "select * from tb_Project_Material where ProjectID=" +
- this.m_Prj + " and sstatus=" + this.sstatus + " order by wz_id";
- DataView dv = new DataView();
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- public DataView ProMaterialGetByMat()
- {
- string strSQL = "select * from tb_Project_Material where MaterialID=" + this.CommID + " and sstatus=" + this.sstatus;
- DataView dv = new DataView();
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- public string ProBudGetPriceGetByWzId()
- {
- string strSQL = "select wz_plan from material_name where wz_id=" + this.m_wz;
- MSDA2.Open();
- DataView dv = MSDA2.ExecuteDataView(CommandType.Text, strSQL, null);
- MSDA2.Close();
- string wz_plan = "";
- if (dv.Table.Rows.Count > 0) wz_plan = dv.Table.Rows[0][0].ToString();
- return wz_plan;
- }
- public void ProMaterialDelete()
- {
- int err = -1;
- DataView dv = new DataView();
- try
- {
- dv = this.ProMaterialGetByMat();
- }
- catch (Exception ex)
- {
- err = -2;
- throw ex;
- }
- if (err == -2) return;
- if (dv.Table.Rows.Count < 1)
- {
- //ex.Message = "未找到要更新的内容,请查证后再试!";
- err = 1;
- return;
- }
- string sSQL = "insert into tb_Project_Material values(" + decimal.Parse(dv.Table.Rows[0]["BudGetPrice"].ToString()) +
- "," + decimal.Parse(dv.Table.Rows[0]["DifferencePrice"].ToString()) + "," + decimal.Parse(dv.Table.Rows[0]["DifferencePriceSum"].ToString()) +
- "," + decimal.Parse(dv.Table.Rows[0]["MarketPrice"].ToString()) + ",'" + dv.Table.Rows[0]["MeterialName"].ToString().Trim() +
- "','" + dv.Table.Rows[0]["MeterialSize"].ToString().Trim() + "'," + Convert.ToInt32(dv.Table.Rows[0]["wz_id"].ToString()) +
- "," + Convert.ToInt32(dv.Table.Rows[0]["Number"].ToString()) + ",'" + dv.Table.Rows[0]["UnitName"].ToString().Trim() +
- "'," + Convert.ToInt32(dv.Table.Rows[0]["ProjectID"].ToString()) +
- ",2,3,'" + this.m_UserName + "')";
- MSDA.Open();
- SqlTransaction tran= MSDA.BeginTransaction();
- try
- {
- MSDA.ExecuteNonQuery(CommandType.Text, sSQL, null);
- sSQL = "Update tb_Project_Material set sstatus=2 where MaterialID=" + this.m_ID;
- MSDA.ExecuteNonQuery(CommandType.Text, sSQL, null);
- tran.Commit();
- }
- catch (Exception ex)
- {
- tran.Rollback();
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- }
- /// <summary>
- /// 其他费用
- /// </summary>
- public DataView ProOtherGetByPrj()
- {
- string strSQL = "select * from tb_Project_Other where ProjectID=" + this.m_Prj;
- DataView dv = new DataView();
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- public DataView ProGetAllFee()
- {
- string strSQL = "select * from " + this.m_Table + " where " + this.m_Condition + "=" + this.m_Prj;
- DataView dv = new DataView();
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- public DataView ProOtherByPrj()
- {
- string strSQL = "select * from tb_Project_Other where ProjectID=" + this.m_Prj + " and sstatus=" + this.m_sstatus;
- DataView dv = new DataView();
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- public DataView ProOtherByOther()
- {
- string strSQL = "select * from tb_Project_Other where OtherID=" + this.m_ID + " and sstatus=" + this.m_sstatus;
- DataView dv = new DataView();
- try
- {
- MSDA.Open();
- dv = MSDA.ExecuteDataView(CommandType.Text, strSQL, null);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- return dv;
- }
- public void ProOtherInsert()
- {
- string strSQL = "insert into tb_Project_Other values('" + this.m_Exp + "','" +
- this.m_Name + "','" + this.m_Unit + "'," + this.m_DiffSum + "," + this.m_Prj +
- ",1," + this.m_status + ",'" + this.m_UserName + "')";
- MSDA.Open();
- SqlTransaction tran = MSDA.BeginTransaction();
- try
- {
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- tran.Commit();
- }
- catch (Exception ex)
- {
- tran.Rollback();
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- }
- public int ProOtherUpdata()
- {
- int err = -1;
- DataView dv = new DataView();
- try
- {
- dv = this.ProOtherByOther();
- }
- catch (Exception ex)
- {
- err = -2;
- throw ex;
- }
- if (err == -2) return err;
- if (dv.Table.Rows.Count < 1)
- {
- //ex.Message = "未找到要更新的内容,请查证后再试!";
- err = 1;
- return err;
- }
- bool bl = false;
- if (this.Explain.Trim() != dv.Table.Rows[0]["Explain"].ToString().Trim()) bl = true;
- if (this.m_Name.Trim() != dv.Table.Rows[0]["OtherName"].ToString().Trim()) bl = true;
- if (this.m_Unit.Trim() != dv.Table.Rows[0]["Memo"].ToString().Trim()) bl = true;
- if (this.m_DiffSum != decimal.Parse(dv.Table.Rows[0]["Price"].ToString())) bl = true;
- if (bl)
- {
- string strSQL = "Update tb_Project_Other set sstatus=2 where OtherID=" + this.m_ID;
- MSDA.Open();
- SqlTransaction tran = MSDA.BeginTransaction();
- try
- {
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- strSQL = "insert into tb_Project_Other values('" + this.m_Exp + "','" +
- this.m_Name + "','" + this.m_Unit + "'," + this.m_DiffSum + "," + this.m_Prj +
- ",1," + this.m_status + ",'" + this.m_UserName + "')";
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- tran.Commit();
- return err;
- }
- catch (Exception ex)
- {
- tran.Rollback();
- err = -2;
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- }
- else
- {
- err = 2;
- //ex.Message = "未发生变化无需更新,请查证后再试!";
- }
- return err;
- }
- public void ProOtherDelete()
- {
- int err = -1;
- DataView dv = new DataView();
- try
- {
- dv = this.ProOtherByOther();
- }
- catch (Exception ex)
- {
- err = -2;
- throw ex;
- }
- if (err == -2) return;
- if (dv.Table.Rows.Count < 1)
- {
- //ex.Message = "未找到要更新的内容,请查证后再试!";
- return ;
- }
- string sSQL = "insert into tb_Project_Other values('" + dv.Table.Rows[0]["Explain"].ToString().Trim() +
- "','" + dv.Table.Rows[0]["OtherName"].ToString().Trim() + "','" + dv.Table.Rows[0]["Memo"].ToString().Trim() +
- "'," + decimal.Parse(dv.Table.Rows[0]["Price"].ToString()) + "," + decimal.Parse(dv.Table.Rows[0]["ProjectID"].ToString()) +
- ",2,3,'" + this.m_UserName + "')";
- MSDA.Open();
- SqlTransaction tran = MSDA.BeginTransaction();
- try
- {
- MSDA.ExecuteNonQuery(CommandType.Text, sSQL, null);
- sSQL = "Update tb_Project_Other set sstatus=2 where OtherID=" + this.m_ID;
- MSDA.ExecuteNonQuery(CommandType.Text, sSQL, null);
- tran.Commit();
- }
- catch (Exception ex)
- {
- tran.Rollback();
- throw ex;
- }
- finally
- {
- MSDA.Close();
- }
- }
- }
- //组织机构和职工初始化
- public class EtongFlyChouInit
- {
- private int m_ID; //组织机构ID EmpID UserID
- private int m_pDI; //上级ID PrimaryOrgID EmpID
- private string m_Name; //名称 EmpName
- private string m_Decs; //OrgDesc EMail UserDecs
- private Int16 m_Inal; //OrgInal TempFlag(0、非临时,1、临时) IsLock
- private int m_Level; //OrgLevel EmpType(1、普通员工2、部门主管3、公司领导4、其他) OrdInal
- private DateTime m_Edit; //EditTime EditDate EditDate
- private string m_Type; //OrgType(TYPE2) IPAddress
- private string m_Path; //OrgPath PhoneNumber UserCode
- private string m_CID; //OrgcID(DEPT_ID) UserAccount
- private string m_Pwd; // UserPwd
- private Int16 m_Bound; // IsIPBound
- public int ID
- {
- set { m_ID = value; }
- get { return m_ID; }
- }
- public int PID
- {
- set { m_pDI = value; }
- get { return m_pDI; }
- }
- public string Name
- {
- set {m_Name =value;}
- get { return m_Name; }
- }
- public string Decs
- {
- set { m_Decs = value; }
- get { return m_Decs; }
- }
- public Int16 Inal
- {
- set { m_Inal = value; }
- get { return m_Inal; }
- }
- public int Level
- {
- set { m_Level = value; }
- get { return m_Level; }
- }
- public DateTime Edit
- {
- set { m_Edit = value; }
- get { return m_Edit; }
- }
- public string Type
- {
- set { m_Type = value; }
- get { return m_Type; }
- }
- public string Path
- {
- set { m_Path = value; }
- get { return m_Path; }
- }
- public string CID
- {
- set { m_CID = value; }
- get { return m_CID; }
- }
- public string Pwd
- {
- set { m_Pwd = value; }
- get { return m_Pwd; }
- }
- public Int16 Bound
- {
- set { m_Bound = value; }
- get { return m_Bound; }
- }
- private MSSqlDataAccess MSDA2 = new MSSqlDataAccess(2);
- private MSSqlDataAccess MSDA = new MSSqlDataAccess(0);
- private QueryParameterCollection Params = new QueryParameterCollection();
- public void OrgInit()
- {
- string strSQL = "delete from Tb_Sys_Organization";
- string InSQL = "",SSQL="";
- MSDA.Open();
- SqlTransaction tran = MSDA.BeginTransaction();
- try
- {
- MSDA2.Open();
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- strSQL = "insert into Tb_Sys_Organization values(1,-1,'供电公司','芜湖市供电公司',1,1,'2007-04-01','行政','1','0')";
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- strSQL = "select menuid,supermenuid,dept_name from usertype where actionpage1='#' and menuid>9999 order by supermenuid";
- DataView dv = MSDA2.ExecuteDataView(CommandType.Text, strSQL, null);
- int i = 1;
- for (int j = 0; j < dv.Table.Rows.Count;j++ )
- {
- i++;
- EtongFlyChouInit EFlyInit = new EtongFlyChouInit();
- EFlyInit.m_ID = i;
- if (dv.Table.Rows[j]["menuid"].ToString().Length == 6)
- {
- EFlyInit.m_pDI = 1;
- EFlyInit.m_Level = 2;
- EFlyInit.m_Path = "1/" + EFlyInit.m_ID.ToString();
- switch (EFlyInit.m_ID)
- {
- case 2:
- EFlyInit.m_CID = "a";
- break;
- case 3:
- EFlyInit.m_CID = "b";
- break;
- case 4:
- EFlyInit.m_CID = "c";
- break;
- case 5:
- EFlyInit.m_CID = "d";
- break;
- case 6:
- EFlyInit.m_CID = "e";
- break;
- default:
- EFlyInit.m_CID = "1";
- break;
- }
- }
- else if (dv.Table.Rows[j]["menuid"].ToString().Length > 6)
- {
- Params.Clear();
- SSQL = "P_GetOrgzationZF";
- Params.Add("@param_menuid", Convert.ToInt32(dv.Table.Rows[j][1].ToString()));
- DataView dv1=MSDA2.ExecuteDataView(CommandType.StoredProcedure, SSQL, Params);
- //EFlyInit.m_pDI = Convert.ToInt32(dv.Table.Rows[0][0].ToString());
- //if (dr["menuid"].ToString().Length == 8)
- //{
- EFlyInit.m_pDI = Convert.ToInt32(dv1.Table.Rows[0][0].ToString());
- EFlyInit.m_Level = 3;
- EFlyInit.m_Path = "1/" + EFlyInit.m_pDI.ToString() + "/" + EFlyInit.m_ID.ToString();
- //}
- //else
- //{
- // EFlyInit.m_Level = 4;
- // EFlyInit.m_Path = "1/" + EFlyInit.m_pDI.ToString() + "/" + i.ToString();
- //}
- EFlyInit.m_CID = "1";
- }
- EFlyInit.m_Name = dv.Table.Rows[j]["dept_name"].ToString();
- EFlyInit.m_Decs = "物资系统导入";
- EFlyInit.m_Inal = 1;
- EFlyInit.m_Edit = System.DateTime.Now;
- EFlyInit.m_Type = dv.Table.Rows[j]["menuid"].ToString();
- InSQL = "insert into Tb_Sys_Organization values(" + EFlyInit.m_ID + "," + EFlyInit.m_pDI + ",'" + EFlyInit.m_Name +
- "','" + EFlyInit.m_Decs + "'," + EFlyInit.m_Inal + "," + EFlyInit.m_Level + ",'" + EFlyInit.m_Edit + "','" +
- EFlyInit.m_Type + "','" + EFlyInit.m_Path + "','" + EFlyInit.m_CID + "')";
- MSDA.ExecuteNonQuery(CommandType.Text, InSQL, null);
- }
- tran.Commit();
- }
- catch (Exception ex)
- {
- tran.Rollback();
- throw ex;
- }
- finally
- {
- MSDA2.Close();
- MSDA.Close();
- }
- }
- public void EmpInit()
- {
- string InSQL = "";
- string SSQL = "";
- string strSQL = "delete from Tb_Sys_Employee";
- MSDA.Open();
- SqlTransaction tran = MSDA.BeginTransaction();
- try
- {
- MSDA2.Open();
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- strSQL = "delete from Tb_Sys_User";
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- strSQL = "insert into Tb_Sys_User values(NULL,'admin','NULL','系统用户',NULL,'111111',0,NULL,0,'2007-04-01','','')";
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- strSQL = "delete from Tb_Sys_UserRole";
- MSDA.ExecuteNonQuery(CommandType.Text, strSQL, null);
- strSQL = "select menuid,supermenuid,passwd,dept_name,pym from usertype where actionpage1='sys_person_main.asp' and pym<>''";
- SqlDataReader dr = MSDA2.ExecuteReader(CommandType.Text, strSQL, null);
- int i = 0;
- while (dr.Read() == true)
- {
- EtongFlyChouInit EFlyInit = new EtongFlyChouInit();
- i++;
- EFlyInit.m_ID = i;
- SSQL = "select OrgID from Tb_Sys_Organization where OrgType='" + dr["supermenuid"].ToString() + "'";
- DataView dv = MSDA.ExecuteDataView(CommandType.Text, SSQL, null);
- if (dv.Table.Rows.Count > 0) EFlyInit.m_pDI = Convert.ToInt32(dv.Table.Rows[0][0].ToString());
- else EFlyInit.m_pDI = -1;
- EFlyInit.m_Name = dr["dept_name"].ToString();
- EFlyInit.m_Level = 1;
- EFlyInit.m_Decs = "wz@wz.com";
- EFlyInit.m_Path = "";
- EFlyInit.m_Edit = System.DateTime.Now;
- EFlyInit.m_Inal = 0;
- InSQL = "insert into Tb_Sys_Employee values(" + EFlyInit.m_ID + ",'" + EFlyInit.m_Name + "'," + EFlyInit.m_pDI +
- "," + EFlyInit.m_Level + ",'" + EFlyInit.m_Decs + "','" + EFlyInit.m_Path + "','" + EFlyInit.m_Edit + "'," +
- EFlyInit.m_Inal + ")";
- MSDA.ExecuteNonQuery(CommandType.Text, InSQL, null);
- EFlyInit.m_pDI = i;
- EFlyInit.m_CID = dr["pym"].ToString();
- EFlyInit.m_Path = "";
- EFlyInit.m_Decs = "物资系统导入";
- EFlyInit.m_Level = 1;
- EFlyInit.m_Pwd = dr["passwd"].ToString();
- EFlyInit.m_Inal = 0;
- EFlyInit.m_Type = "";
- EFlyInit.m_Bound = 0;
- InSQL = "insert into Tb_Sys_User values(" + EFlyInit.m_pDI +",'" + EFlyInit.m_CID + "','" +
- EFlyInit.m_Path + "','" + EFlyInit.m_Decs + "','" + EFlyInit.m_Level + "','" +
- EFlyInit.m_Pwd + "'," + EFlyInit.m_Inal + ",'" + EFlyInit.m_Type + "'," +
- EFlyInit.m_Bound + ",'" + EFlyInit.m_Edit + "','','')";
- MSDA.ExecuteNonQuery(CommandType.Text, InSQL, null);
- }
- dr.Close();
- tran.Commit();
- }
- catch (Exception ex)
- {
- tran.Rollback();
- throw ex;
- }
- finally
- {
- MSDA.Close();
- MSDA2.Close();
- }
- }
- }
- }