Ejemplo n.º 1
0
 public static void InsertStandard_Resource(EntityData entity)
 {
     try
     {
         using (StandardEntityDAO ydao = new StandardEntityDAO("Standard_Resource"))
         {
             ydao.InsertEntity(entity);
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Ejemplo n.º 2
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;
            }
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        private static EntityData ImportSalClientByClient(string ClientCode, string ProjectCode, DataSet dsSrc, StandardEntityDAO dao)
        {
            EntityData data2;

            try
            {
                DataRow   row;
                DataTable table = dsSrc.Tables["Client"];
                DataRow   row2  = table.Rows[0];
                dao.EntityName = "SalClient";
                EntityData entitydata = new EntityData("SalClient");
                entitydata = dao.SelectbyPrimaryKey(ClientCode);
                if (entitydata.HasRecord())
                {
                    row = entitydata.CurrentTable.Rows[0];
                }
                else
                {
                    row = entitydata.CurrentTable.NewRow();
                }
                row["ProjectCode"] = ProjectCode;
                row["ClientCode"]  = row2["client_code"];
                row["ClientName"]  = row2["client_name"];
                if (!entitydata.HasRecord())
                {
                    entitydata.AddNewRecord(row);
                    dao.InsertEntity(entitydata);
                }
                else
                {
                    dao.UpdateEntity(entitydata);
                }
                data2 = entitydata;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Ejemplo n.º 5
0
        private void ImportSalContract(string[] m_strSub, string ContractCode, string ProjectCode, StandardEntityDAO dao)
        {
            try
            {
                dao.EntityName = "SalContract";
                EntityData entity = new EntityData("SalContract");
                entity = dao.SelectbyPrimaryKey(ContractCode);
                DataRow dr;

                if (entity.HasRecord())
                {
                    dr = entity.CurrentTable.Rows[0];
                }
                else
                {
                    dr = entity.CurrentTable.NewRow();
                }

                dr["ProjectCode"]  = ProjectCode;
                dr["ContractCode"] = ContractCode;
                dr["ContractID"]   = m_strSub[2];
                dr["ClientName"]   = m_strSub[1];
                dr["Room"]         = m_strSub[6];

                try
                {
                    dr["UnitPrice"] = decimal.Parse(m_strSub[8]);
                }
                catch
                {
                    dr["UnitPrice"] = 0;
                }

                dr["BofangCode"]   = m_strSub[3];
                dr["BuildingName"] = m_strSub[4];
                dr["ChamberName"]  = m_strSub[5];

                try
                {
                    dr["BuildDim"] = decimal.Parse(m_strSub[7]);
                }
                catch
                {
                    dr["BuildDim"] = 0;
                }

                //按合同号取供应商代码
                //					string SuplName = GetSuplNameByContract(dr["ContractID"].ToString());
                //					string SuplCode = GetSuplCodeByName(SuplName, ProjectCode);
                //					dr["SuplCode"] = SuplCode;

                if (!entity.HasRecord())
                {
                    entity.AddNewRecord(dr);
                    dao.InsertEntity(entity);
                }
                else
                {
                    dao.UpdateEntity(entity);
                }

                entity.Dispose();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 6
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;
            }
        }