示例#1
0
        public void SaveData(SaveDataModel data, IDbTransaction tran, string caseid, string actid)
        {
            //第一步重新加入采购申请单子表
            if (actid == "A001")
            {
                //先删除
                B_OA_FixedAssets_Son son = new B_OA_FixedAssets_Son();
                son.Condition.Add("caseId = " + caseid);
                Utility.Database.Delete(son, tran);
                //新加入
                List<B_OA_FixedAssets_Son> listSon = data.listSon;
                for (int i = 0; i < listSon.Count; i++)
                {
                    listSon[i].caseId = caseid;
                    Utility.Database.Insert(listSon[i], tran);
                }
            }
            else
            {
                List<B_OA_FixedAssets_Son> listSon = data.listSon;
                for (int i = 0; i < listSon.Count; i++)
                {
                    listSon[i].Condition.Add("id =" + listSon[i].id);
                    Utility.Database.Update(listSon[i], tran);
                }
            }

            //保存采购申请单
            if (caseid != null) data.fixedAssets.caseId = caseid;
            data.fixedAssets.Condition.Add("caseId=" + data.fixedAssets.caseId);
            //更新或插入主业务信息
            if (Utility.Database.Update<B_OA_FixedAssets>(data.fixedAssets, tran) < 1)
            {
                Utility.Database.Insert<B_OA_FixedAssets>(data.fixedAssets, tran);
            }
        }
示例#2
0
        public bool DeleteCase(string caseid, string userid, Object obj)
        {
            IDbTransaction tran = (IDbTransaction)obj;
            //加入针对不同的业务的删除前处理
            FX_WorkFlowCase workFlow = new FX_WorkFlowCase();
            workFlow.Condition.Add("ID =" + caseid);
            workFlow = Utility.Database.QueryObject<FX_WorkFlowCase>(workFlow, tran);
            if (workFlow != null)
            {
                string flowId = workFlow.FlowID;
                switch (flowId)
                {
                    case "W000098": //发文
                        B_OA_SendDoc_QuZhan sendDoc = new B_OA_SendDoc_QuZhan();
                        sendDoc.Condition.Add("caseid=" + caseid);
                        Utility.Database.Delete(sendDoc, tran);
                        break;
                    case "W000099": //收文
                        B_OA_ReceiveDoc_QuZhan receiveDoc = new B_OA_ReceiveDoc_QuZhan();
                        receiveDoc.Condition.Add("caseid=" + caseid);
                        Utility.Database.Delete(receiveDoc, tran);
                        break;
                    case "W000100": //内部事项
                        B_OA_SendDoc_Inner_QuZhan innderDoc = new B_OA_SendDoc_Inner_QuZhan();
                        innderDoc.Condition.Add("caseId=" + caseid);
                        Utility.Database.Delete(innderDoc, tran);
                        break;
                    case "W000070": //车辆申请
                        B_OA_Car car = new B_OA_Car();
                        car.Condition.Add("workflowcaseid=" + caseid);
                        Utility.Database.Delete(car, tran);
                        break;
                    case "W000071": //会议申请
                        B_OA_Meeting data = new B_OA_Meeting();
                        data.Condition.Add("CaseID=" + caseid);
                        Utility.Database.Delete(data, tran);
                        break;
                    case "W000079": //请假申请
                        B_OA_LeaveList leave = new B_OA_LeaveList();
                        leave.Condition.Add("caseId=" + caseid);
                        Utility.Database.Delete(leave, tran);
                        break;
                    case "W000080": //出差申请
                        B_OA_TravelList travel = new B_OA_TravelList();
                        travel.Condition.Add("caseId=" + caseid);
                        Utility.Database.Delete(travel, tran);
                        break;
                    case "W000089": //通知公告
                        B_OA_Notice notice = new B_OA_Notice();
                        notice.Condition.Add("caseid=" + caseid);
                        Utility.Database.Delete(notice, tran);
                        break;
                    case "W000102": //采购申请
                        B_OA_FixedAssets fiexAssets = new B_OA_FixedAssets();
                        fiexAssets.Condition.Add("caseId ="+caseid);
                        Utility.Database.Delete(fiexAssets, tran);

                        B_OA_FixedAssets_Son fixedAssetsSon = new B_OA_FixedAssets_Son();
                        fixedAssetsSon.Condition.Add("caseId = "+caseid);
                        Utility.Database.Delete(fixedAssetsSon, tran);
                        break;

                }
                if (!string.IsNullOrEmpty(caseid))
                {
                    //删除正文路径
                    B_Common_CreateDoc createDoc = new B_Common_CreateDoc();
                    createDoc.Condition.Add("caseid=" + caseid);
                    Utility.Database.Delete(createDoc, tran);
                    //删除附件
                    FX_AttachMent attach  = new FX_AttachMent();
                    attach.Condition.Add("CaseID="+caseid);
                    Utility.Database.Delete(attach, tran);
                    //用户和业务关系表
                    DataRowMap rm = new DataRowMap();
                    rm.TableName = "B_OA_WorkFlow_UserId_R";
                    rm.Condition.Add("caseId=" + caseid);
                    Utility.Database.Delete(rm, tran);
                    //业务数据
                    FX_WorkFlowBusAct workFlowBust = new FX_WorkFlowBusAct();
                    workFlowBust.Condition.Add("CaseID=" + caseid);
                    Utility.Database.Delete(workFlowBust, tran);
                }
            }
            return true;
        }
示例#3
0
        public object GetData(string userid, string caseId, string baid, string actid)
        {
            try
            {
                if (!String.IsNullOrEmpty(actid))
                {
                    //只有待办箱才有设置为已读
                    if (!String.IsNullOrEmpty(baid)) engineAPI.SetIsReaded(caseId, baid, userid);
                }
                List<B_OA_FixedAssets_Son> listSon = new List<B_OA_FixedAssets_Son>();
                B_OA_FixedAssets_Son fixedAssetsSon = new B_OA_FixedAssets_Son();
                B_OA_FixedAssets fixedAssets = new B_OA_FixedAssets();
                if (caseId == "")
                {
                    fixedAssets.applyManId = userid;
                    DeptInfoAndUserInfo userinfor = ComClass.GetDeptAndUserByUserId(userid);
                    fixedAssets.applyManName = userinfor.userinfo.CnName;
                    fixedAssets.dpName = userinfor.deptinfo.DPName;
                    fixedAssets.createDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                }
                else
                {
                    StringBuilder strSql = new StringBuilder();
                    strSql.AppendFormat(@"SELECT a.*,b.CnName as acceptManName  from B_OA_FixedAssets_Son as a
            LEFT JOIN FX_UserInfo as b on b.UserID = a.acceptManId
             where a.caseId ='{0}'", caseId);
                    DataSet dataSet = Utility.Database.ExcuteDataSet(strSql.ToString());
                    string jsonData = JsonConvert.SerializeObject(dataSet.Tables[0]);
                    listSon = (List<B_OA_FixedAssets_Son>)JsonConvert.DeserializeObject(jsonData, typeof(List<B_OA_FixedAssets_Son>));

                    fixedAssets.Condition.Add("caseId= " + caseId);
                    fixedAssets = Utility.Database.QueryObject<B_OA_FixedAssets>(fixedAssets);
                    string applyManId = fixedAssets.applyManId;
                    DeptInfoAndUserInfo userinfor = ComClass.GetDeptAndUserByUserId(applyManId);
                    fixedAssets.applyManName = userinfor.userinfo.CnName;
                    fixedAssets.dpName = userinfor.deptinfo.DPName;
                }
                return new
                {
                    listSon = listSon,
                    fixedAssetsSon = fixedAssetsSon,
                    fixedAssets = fixedAssets
                };
            }
            catch (Exception ex)
            {
                ComBase.Logger(ex);
                throw (new Exception("获取数据失败!", ex));
            }
        }