Exemple #1
0
        private static EntityData ImportSalPayByClient(string ClientCode, string ProjectCode, DataSet dsSrc, StandardEntityDAO dao)
        {
            EntityData data2;

            try
            {
                DataTable table  = dsSrc.Tables["account"];
                DataTable table2 = dsSrc.Tables["SalPayPlan"];
                DataTable table3 = dsSrc.Tables["SalPayRela"];
                dao.EntityName = "SalPay";
                EntityData entitydata = new EntityData("SalPay");
                string[]   Params     = new string[] { "@ClientCode" };
                object[]   values     = new object[] { ClientCode };
                dao.FillEntity(SqlManager.GetSqlStruct("SalPay", "SelectByClient").SqlString, Params, values, entitydata, "SalPay");
                if (entitydata.HasRecord())
                {
                    dao.DeleteAllRow(entitydata);
                    dao.DeleteEntity(entitydata);
                }
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    DataRow row  = entitydata.CurrentTable.NewRow();
                    DataRow row2 = table.Rows[i];
                    row["ClientCode"]  = ClientCode;
                    row["ProjectCode"] = ProjectCode;
                    row["PayCode"]     = row2["account_code"];
                    row["AccountCode"] = row2["account_code"];
                    row["PayDate"]     = row2["account_date"];
                    row["PayMoney"]    = row2["account_price"];
                    row["PayType"]     = row2["account_type"];
                    row["Remark"]      = row2["remark"];
                    row["CheckDate"]   = row2["check_date"];
                    row["CheckMan"]    = row2["check_man"];
                    string    text     = "";
                    DataRow[] rowArray = table3.Select("account_code = '" + row2["account_code"].ToString() + "'");
                    if (rowArray.Length > 0)
                    {
                        string text2 = rowArray[0]["plan_code"].ToString();
                        if (text2 != "")
                        {
                            DataRow[] rowArray2 = table2.Select("pay_plan_code = '" + text2 + "'");
                            if (rowArray2.Length > 0)
                            {
                                text = rowArray2[0]["contract_code"].ToString();
                            }
                        }
                    }
                    row["ContractCode"] = text;
                    entitydata.AddNewRecord(row);
                    dao.InsertEntity(entitydata);
                }
                data2 = entitydata;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Exemple #2
0
        public static EntityData GetStandard_ClaimsExpressionsByCode(string code, StandardEntityDAO dao)
        {
            EntityData data2;

            try
            {
                EntityData entitydata = new EntityData("Standard_ClaimsExpressions");
                dao.FillEntity(SqlManager.GetSqlStruct("ClaimsExpressions", "Select").GetSqlStringWithOrder(), "@ClaimsExpressionsCode", code, entitydata, "ClaimsExpressions");
                dao.FillEntity(SqlManager.GetSqlStruct("ClaimsExpressionsDetail", "SelectByClaimsExpressionsCode").SqlString, "@ClaimsExpressionsCode", code, entitydata, "ClaimsExpressionsDetail");
                data2 = entitydata;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Exemple #3
0
        private static EntityData ImportSalContractByClient(string ClientCode, string ProjectCode, DataSet dsSrc, StandardEntityDAO dao)
        {
            EntityData data2;

            try
            {
                DataTable table = dsSrc.Tables["Contract"];
                dao.EntityName = "SalContract";
                EntityData entitydata = new EntityData("SalContract");
                string[]   Params     = new string[] { "@ClientCode" };
                object[]   values     = new object[] { ClientCode };
                dao.FillEntity(SqlManager.GetSqlStruct("SalContract", "SelectByClient").SqlString, Params, values, entitydata, "SalContract");
                if (entitydata.HasRecord())
                {
                    dao.DeleteAllRow(entitydata);
                    dao.DeleteEntity(entitydata);
                }
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    DataRow row          = entitydata.CurrentTable.NewRow();
                    DataRow row2         = table.Rows[i];
                    string  contractCode = row2["contract_code"].ToString();
                    row["ProjectCode"]  = ProjectCode;
                    row["ContractCode"] = contractCode;
                    row["ContractID"]   = row2["contract_id"];
                    row["ClientCode"]   = row2["client_code"];
                    row["ClientName"]   = row2["client_name"];
                    row["RoomCode"]     = row2["room_code"];
                    row["ContractDate"] = row2["contract_date"];
                    row["TotalPrice"]   = row2["total_price"];
                    row["FactPrice"]    = row2["fact_price"];
                    row["UnitPrice"]    = row2["unit_price"];
                    //row["Jiesuan"] = row2["jiesuan"];
                    // row["BofangCode"] = row2["bofang_code"];
                    row["ChamberName"]  = row2["chamber"];
                    row["BuildDim"]     = row2["build_dim"];
                    row["RoomDim"]      = row2["room_dim"];
                    row["Room"]         = row2["room"];
                    row["BuildingName"] = row2["build_name"];
                    //row["JiesuanDate"] = row2["jiesuan_date"];
                    string suplCodeByName = GetSuplCodeByName(GetSuplNameByContract(row["ContractID"].ToString(), 4), ProjectCode);
                    row["SuplCode"] = suplCodeByName;
                    string roomCode = ProductRule.GetRoomCodeByChamberRoomName(ConvertRule.ToString(row["ChamberName"]), ConvertRule.ToString(row["Room"]), ProjectCode);
                    row["RoomCode"] = roomCode;
                    UpdateRoomSalState(roomCode, contractCode);
                    entitydata.AddNewRecord(row);
                    dao.InsertEntity(entitydata);
                }
                data2 = entitydata;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Exemple #4
0
        public static EntityData GetStandard_ConstructProgressByCode(string code)
        {
            EntityData data2;

            try
            {
                EntityData entitydata = new EntityData("Standard_ConstructProgress");
                using (StandardEntityDAO ydao = new StandardEntityDAO("Standard_ConstructProgress"))
                {
                    ydao.FillEntity(SqlManager.GetSqlStruct("ConstructProgress", "Select").SqlString, "@ProgressCode", code, entitydata, "ConstructProgress");
                    ydao.FillEntity(SqlManager.GetSqlStruct("ConstructProgressRisk", "SelectByProgressCode").SqlString, "@ProgressCode", code, entitydata, "ConstructProgressRisk");
                }
                data2 = entitydata;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Exemple #5
0
        public static EntityData GetStandard_ResourceByCode(string code)
        {
            EntityData data2;

            try
            {
                EntityData entitydata = new EntityData("Standard_Resource");
                using (StandardEntityDAO ydao = new StandardEntityDAO("Standard_Resource"))
                {
                    ydao.FillEntity(SqlManager.GetSqlStruct("Resource", "Select").SqlString, "@ResourceCode", code, entitydata, "Resource");
                    ydao.FillEntity(SqlManager.GetSqlStruct("AccessRange", "SelectByResourceCode").SqlString, "@ResourceCode", code, entitydata, "AccessRange");
                }
                data2 = entitydata;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Exemple #6
0
        public static EntityData GetStandard_DocumentByCode(string code)
        {
            EntityData data2;

            try
            {
                EntityData entitydata = new EntityData("Standard_Document");
                using (StandardEntityDAO ydao = new StandardEntityDAO("Standard_Document"))
                {
                    ydao.FillEntity(SqlManager.GetSqlStruct("Document", "Select").SqlString, "@DocumentCode", code, entitydata, "Document");
                    ydao.FillEntity(SqlManager.GetSqlStruct("DocumentConfig", "SelectByDocumentCode").SqlString, "@DocumentCode", code, entitydata, "DocumentConfig");
                }
                data2 = entitydata;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Exemple #7
0
        public static EntityData GetStandard_NoticeByCode(string code)
        {
            EntityData data2;

            try
            {
                EntityData entitydata = new EntityData("Standard_Notice");
                using (StandardEntityDAO ydao = new StandardEntityDAO("Standard_Notice"))
                {
                    ydao.FillEntity(SqlManager.GetSqlStruct("Notice", "Select").SqlString, "@NoticeCode", code, entitydata, "Notice");
                    ydao.FillEntity(SqlManager.GetSqlStruct("NoticeUser", "SelectByNoticeCode").GetSqlStringWithOrder(), "@NoticeCode", code, entitydata, "NoticeUser");
                    ydao.FillEntity(SqlManager.GetSqlStruct("NoticeAttachMent", "SelectByNoticeCode").GetSqlStringWithOrder(), "@NoticeCode", code, entitydata, "NoticeAttachMent");
                }
                data2 = entitydata;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Exemple #8
0
        public static EntityData GetStandard_SalContractByCode(string code)
        {
            EntityData data2;

            try
            {
                EntityData entitydata = new EntityData("Standard_SalContract");
                using (StandardEntityDAO ydao = new StandardEntityDAO("Standard_SalContract"))
                {
                    ydao.FillEntity(SqlManager.GetSqlStruct("SalContract", "Select").SqlString, "@ContractCode", code, entitydata, "SalContract");
                    ydao.FillEntity(SqlManager.GetSqlStruct("SalPay", "SelectByContract").GetSqlStringWithOrder(), "@ContractCode", code, entitydata, "SalPay");
                    ydao.FillEntity(SqlManager.GetSqlStruct("SalPayPlan", "SelectByContract").GetSqlStringWithOrder(), "@ContractCode", code, entitydata, "SalPayPlan");
                }
                data2 = entitydata;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Exemple #9
0
        public static EntityData GetStandard_SupplierByCode(string code)
        {
            EntityData data2;

            try
            {
                EntityData entitydata = new EntityData("Standard_Supplier");
                using (StandardEntityDAO ydao = new StandardEntityDAO("Standard_Supplier"))
                {
                    ydao.FillEntity(SqlManager.GetSqlStruct("Supplier", "Select").SqlString, "@SupplierCode", code, entitydata, "Supplier");
                    ydao.FillEntity(SqlManager.GetSqlStruct("SupplierOpinion", "SelectBySupplierCode").SqlString, "@SupplierCode", code, entitydata, "SupplierOpinion");
                    ydao.FillEntity(SqlManager.GetSqlStruct("SupplierSubjectSet", "SelectBySupplierCode").SqlString, "@SupplierCode", code, entitydata, "SupplierSubjectSet");
                    ydao.FillEntity(SqlManager.GetSqlStruct("ContractBiddingSupplier", "SelectBySupplierCode").SqlString, "@SupplierCode", code, entitydata, "ContractBiddingSupplier");
                }
                data2 = entitydata;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Exemple #10
0
        private void ImportSalPay(string[] m_strSub, string ContractCode, string ProjectCode, StandardEntityDAO dao)
        {
            try
            {
                dao.EntityName = "SalPay";
                EntityData entity = new EntityData("SalPay");

                string[] os = { "@ContractCode" };
                object[] ob = { ContractCode };
                dao.FillEntity(SqlManager.GetSqlStruct("SalPay", "SelectByContract").SqlString, os, ob, entity, "SalPay");

                if (entity.HasRecord())
                {
                    dao.DeleteAllRow(entity);
                    dao.DeleteEntity(entity);
                }

                DataRow dr;

                dr = entity.CurrentTable.NewRow();

                dr["ProjectCode"]  = ProjectCode;
                dr["ContractCode"] = ContractCode;
                dr["ContractID"]   = m_strSub[2];
                dr["PayCode"]      = m_strSub[2];
                dr["AccountCode"]  = m_strSub[2];

                try
                {
                    dr["PayMoney"] = m_strSub[9];
                }
                catch
                {
                    dr["PayMoney"] = 0;
                }

                entity.AddNewRecord(dr);
                dao.InsertEntity(entity);

                entity.Dispose();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #11
0
        private static EntityData ImportSalPayPlanByClient(string ClientCode, string ProjectCode, DataSet dsSrc, StandardEntityDAO dao)
        {
            EntityData data2;

            try
            {
                DataTable table = dsSrc.Tables["SalPayPlan"];
                dao.EntityName = "SalPayPlan";
                EntityData entitydata = new EntityData("SalPayPlan");
                string[]   Params     = new string[] { "@ClientCode" };
                object[]   values     = new object[] { ClientCode };
                dao.FillEntity(SqlManager.GetSqlStruct("SalPayPlan", "SelectByClient").SqlString, Params, values, entitydata, "SalPayPlan");
                if (entitydata.HasRecord())
                {
                    dao.DeleteAllRow(entitydata);
                    dao.DeleteEntity(entitydata);
                }
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    DataRow row  = entitydata.CurrentTable.NewRow();
                    DataRow row2 = table.Rows[i];
                    row["PayPlanCode"]  = row2["pay_plan_code"];
                    row["ClientCode"]   = ClientCode;
                    row["ProjectCode"]  = ProjectCode;
                    row["ContractCode"] = row2["contract_code"];
                    row["PayMode"]      = row2["pay_mode"];
                    row["Prompt"]       = row2["Prompt"];
                    row["PlanMoney"]    = row2["price"];
                    row["ItemName"]     = row2["item_name"];
                    entitydata.AddNewRecord(row);
                    dao.InsertEntity(entitydata);
                }
                data2 = entitydata;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Exemple #12
0
        public static void PBSTypeCopyByProject(string srcProjectCode, string dstProjectCode)
        {
            Exception exception;

            try
            {
                using (StandardEntityDAO ydao = new StandardEntityDAO("PBSType"))
                {
                    ydao.BeginTrans();
                    try
                    {
                        EntityData entitydata = new EntityData("PBSType");
                        ydao.FillEntity(SqlManager.GetSqlStruct("PBSType", "SelectByProjectCode").SqlString, "@ProjectCode", dstProjectCode, entitydata, "PBSType");
                        ydao.DeleteAllRow(entitydata);
                        ydao.DeleteEntity(entitydata);
                        DataTable table = new DataTable();
                        table.Columns.Add("OldPBSTypeCode", typeof(string));
                        table.Columns.Add("NewPBSTypeCode", typeof(string));
                        EntityData data2 = new EntityData("PBSType");
                        ydao.FillEntity(SqlManager.GetSqlStruct("PBSType", "SelectByProjectCode").SqlString, "@ProjectCode", srcProjectCode, data2, "PBSType");
                        int num = 1;
                        for (DataRow[] rowArray = data2.CurrentTable.Select("deep=" + num.ToString()); rowArray.Length > 0; rowArray = data2.CurrentTable.Select("deep=" + num.ToString()))
                        {
                            foreach (DataRow row in rowArray)
                            {
                                DataRow row2       = entitydata.CurrentTable.NewRow();
                                string  newSysCode = SystemManageDAO.GetNewSysCode("PBSTypeCode");
                                row2["PBSTypeCode"] = newSysCode;
                                row2["ProjectCode"] = dstProjectCode;
                                row2["PBSTypeName"] = ConvertRule.ToString(row["PBSTypeName"]);
                                row2["Description"] = ConvertRule.ToString(row["Description"]);
                                row2["Deep"]        = ConvertRule.ToInt(row["Deep"]);
                                row2["SortID"]      = ConvertRule.ToInt(row["SortID"]);
                                DataRow row3 = table.NewRow();
                                row3["OldPBSTypeCode"] = ConvertRule.ToString(row["PBSTypeCode"]);
                                row3["NewPBSTypeCode"] = newSysCode;
                                table.Rows.Add(row3);
                                string text2 = ConvertRule.ToString(row["ParentCode"]);
                                if (text2 != "")
                                {
                                    DataRow[] rowArray2 = table.Select("OldPBSTypeCode='" + text2 + "'");
                                    if (rowArray2.Length > 0)
                                    {
                                        text2 = ConvertRule.ToString(rowArray2[0]["NewPBSTypeCode"]);
                                    }
                                }
                                string text3 = "";
                                if (text2 != "")
                                {
                                    DataRow[] rowArray3 = entitydata.CurrentTable.Select("PBSTypeCode='" + text2 + "'");
                                    if (rowArray3.Length > 0)
                                    {
                                        text3 = ConvertRule.ToString(rowArray3[0]["FullID"]);
                                    }
                                }
                                string text4 = newSysCode;
                                if (text3 != "")
                                {
                                    text4 = text3 + "-" + text4;
                                }
                                row2["ParentCode"] = text2;
                                row2["FullID"]     = text4;
                                entitydata.CurrentTable.Rows.Add(row2);
                            }
                            num++;
                        }
                        ydao.InsertEntity(entitydata);
                        ydao.CommitTrans();
                        data2.Dispose();
                        entitydata.Dispose();
                    }
                    catch (Exception exception1)
                    {
                        exception = exception1;
                        try
                        {
                            ydao.RollBackTrans();
                        }
                        catch
                        {
                        }
                        throw exception;
                    }
                }
            }
            catch (Exception exception2)
            {
                exception = exception2;
                throw exception;
            }
        }